1
#pragma once
2

            
3
#include <string>
4

            
5
#include "envoy/http/header_map.h"
6

            
7
#include "source/common/singleton/const_singleton.h"
8
#include "source/common/tracing/trace_context_impl.h"
9

            
10
namespace Envoy {
11
namespace Extensions {
12
namespace Tracers {
13
namespace Zipkin {
14

            
15
namespace {
16

            
17
constexpr char KIND_CLIENT[] = "CLIENT";
18
constexpr char KIND_SERVER[] = "SERVER";
19

            
20
constexpr char CLIENT_SEND[] = "cs";
21
constexpr char CLIENT_RECV[] = "cr";
22
constexpr char SERVER_SEND[] = "ss";
23
constexpr char SERVER_RECV[] = "sr";
24

            
25
constexpr char HTTP_HOST[] = "http.host";
26
constexpr char HTTP_METHOD[] = "http.method";
27
constexpr char HTTP_PATH[] = "http.path";
28
constexpr char HTTP_URL[] = "http.url";
29
constexpr char HTTP_STATUS_CODE[] = "http.status_code";
30
constexpr char HTTP_REQUEST_SIZE[] = "http.request.size";
31
constexpr char HTTP_RESPONSE_SIZE[] = "http.response.size";
32

            
33
constexpr char LOCAL_COMPONENT[] = "lc";
34
constexpr char ERROR[] = "error";
35
constexpr char CLIENT_ADDR[] = "ca";
36
constexpr char SERVER_ADDR[] = "sa";
37

            
38
constexpr char SAMPLED[] = "1";
39
constexpr char NOT_SAMPLED[] = "0";
40

            
41
constexpr bool DEFAULT_SHARED_SPAN_CONTEXT = true;
42

            
43
} // namespace
44

            
45
class ZipkinCoreConstantValues {
46
public:
47
  // Zipkin B3 headers
48
  const Tracing::TraceContextHandler X_B3_TRACE_ID{"x-b3-traceid"};
49
  const Tracing::TraceContextHandler X_B3_SPAN_ID{"x-b3-spanid"};
50
  const Tracing::TraceContextHandler X_B3_PARENT_SPAN_ID{"x-b3-parentspanid"};
51
  const Tracing::TraceContextHandler X_B3_SAMPLED{"x-b3-sampled"};
52
  const Tracing::TraceContextHandler X_B3_FLAGS{"x-b3-flags"};
53

            
54
  // Zipkin b3 single header
55
  const Tracing::TraceContextHandler B3{"b3"};
56

            
57
  // W3C trace context headers
58
  const Tracing::TraceContextHandler TRACE_PARENT{"traceparent"};
59
  const Tracing::TraceContextHandler TRACE_STATE{"tracestate"};
60
};
61

            
62
using ZipkinCoreConstants = ConstSingleton<ZipkinCoreConstantValues>;
63

            
64
} // namespace Zipkin
65
} // namespace Tracers
66
} // namespace Extensions
67
} // namespace Envoy