1
#pragma once
2

            
3
#include "envoy/tracing/custom_tag.h"
4

            
5
namespace Envoy {
6
namespace Tracing {
7

            
8
constexpr uint32_t DefaultMaxPathTagLength = 256;
9

            
10
enum class OperationName { Ingress, Egress };
11

            
12
/**
13
 * Tracing configuration, it carries additional data needed to populate the span.
14
 */
15
class Config {
16
public:
17
101318
  virtual ~Config() = default;
18

            
19
  /**
20
   * @return operation name for tracing, e.g., ingress.
21
   */
22
  virtual OperationName operationName() const PURE;
23

            
24
  /**
25
   * @return create separated child span for upstream request if true.
26
   */
27
  virtual bool spawnUpstreamSpan() const PURE;
28

            
29
  /**
30
   * @return modify the span. For example, set custom tags from configuration or
31
   * make other modifications.
32
   * This method MUST be called at most ONLY once per span before the span is
33
   * finished.
34
   * @param span the span to modify.
35
   * @param upstream_span true if the span is an upstream span that created for outgoing request.
36
   */
37
  virtual void modifySpan(Span& span, bool upstream_span) const PURE;
38

            
39
  /**
40
   * @return true if spans should be annotated with more detailed information.
41
   */
42
  virtual bool verbose() const PURE;
43

            
44
  /**
45
   * @return the maximum length allowed for paths in the extracted HttpUrl tag. This is only used
46
   * for HTTP protocol tracing.
47
   */
48
  virtual uint32_t maxPathTagLength() const PURE;
49

            
50
  /**
51
   * @return true if trace context propagation should be disabled. When true, trace context headers
52
   * (e.g., traceparent, tracestate, X-B3-* headers) will not be injected when proxying requests
53
   * to upstreams. Span reporting still occurs; only context propagation is disabled.
54
   */
55
  virtual bool noContextPropagation() const PURE;
56
};
57

            
58
} // namespace Tracing
59
} // namespace Envoy