1// Copyright (c) 2017 Uber Technologies, Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package jaeger
16
17import (
18	"fmt"
19
20	"github.com/opentracing/opentracing-go"
21)
22
23const (
24	// JaegerClientVersion is the version of the client library reported as Span tag.
25	JaegerClientVersion = "Go-2.28.0"
26
27	// JaegerClientVersionTagKey is the name of the tag used to report client version.
28	JaegerClientVersionTagKey = "jaeger.version"
29
30	// JaegerDebugHeader is the name of HTTP header or a TextMap carrier key which,
31	// if found in the carrier, forces the trace to be sampled as "debug" trace.
32	// The value of the header is recorded as the tag on the root span, so that the
33	// trace can be found in the UI using this value as a correlation ID.
34	JaegerDebugHeader = "jaeger-debug-id"
35
36	// JaegerBaggageHeader is the name of the HTTP header that is used to submit baggage.
37	// It differs from TraceBaggageHeaderPrefix in that it can be used only in cases where
38	// a root span does not exist.
39	JaegerBaggageHeader = "jaeger-baggage"
40
41	// TracerHostnameTagKey used to report host name of the process.
42	TracerHostnameTagKey = "hostname"
43
44	// TracerIPTagKey used to report ip of the process.
45	TracerIPTagKey = "ip"
46
47	// TracerUUIDTagKey used to report UUID of the client process.
48	TracerUUIDTagKey = "client-uuid"
49
50	// SamplerTypeTagKey reports which sampler was used on the root span.
51	SamplerTypeTagKey = "sampler.type"
52
53	// SamplerParamTagKey reports the parameter of the sampler, like sampling probability.
54	SamplerParamTagKey = "sampler.param"
55
56	// TraceContextHeaderName is the http header name used to propagate tracing context.
57	// This must be in lower-case to avoid mismatches when decoding incoming headers.
58	TraceContextHeaderName = "uber-trace-id"
59
60	// TracerStateHeaderName is deprecated.
61	// Deprecated: use TraceContextHeaderName
62	TracerStateHeaderName = TraceContextHeaderName
63
64	// TraceBaggageHeaderPrefix is the prefix for http headers used to propagate baggage.
65	// This must be in lower-case to avoid mismatches when decoding incoming headers.
66	TraceBaggageHeaderPrefix = "uberctx-"
67
68	// SamplerTypeConst is the type of sampler that always makes the same decision.
69	SamplerTypeConst = "const"
70
71	// SamplerTypeRemote is the type of sampler that polls Jaeger agent for sampling strategy.
72	SamplerTypeRemote = "remote"
73
74	// SamplerTypeProbabilistic is the type of sampler that samples traces
75	// with a certain fixed probability.
76	SamplerTypeProbabilistic = "probabilistic"
77
78	// SamplerTypeRateLimiting is the type of sampler that samples
79	// only up to a fixed number of traces per second.
80	SamplerTypeRateLimiting = "ratelimiting"
81
82	// SamplerTypeLowerBound is the type of sampler that samples
83	// at least a fixed number of traces per second.
84	SamplerTypeLowerBound = "lowerbound"
85
86	// DefaultUDPSpanServerHost is the default host to send the spans to, via UDP
87	DefaultUDPSpanServerHost = "localhost"
88
89	// DefaultUDPSpanServerPort is the default port to send the spans to, via UDP
90	DefaultUDPSpanServerPort = 6831
91
92	// DefaultSamplingServerPort is the default port to fetch sampling config from, via http
93	DefaultSamplingServerPort = 5778
94
95	// DefaultMaxTagValueLength is the default max length of byte array or string allowed in the tag value.
96	DefaultMaxTagValueLength = 256
97
98	// SelfRefType is a jaeger specific reference type that supports creating a span
99	// with an already defined context.
100	selfRefType opentracing.SpanReferenceType = 99
101)
102
103var (
104	// DefaultSamplingServerURL is the default url to fetch sampling config from, via http
105	DefaultSamplingServerURL = fmt.Sprintf("http://127.0.0.1:%d/sampling", DefaultSamplingServerPort)
106)
107