repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
grpc-ecosystem/go-grpc-prometheus | client.go | EnableClientStreamSendTimeHistogram | func EnableClientStreamSendTimeHistogram(opts ...HistogramOption) {
DefaultClientMetrics.EnableClientStreamSendTimeHistogram(opts...)
prom.Register(DefaultClientMetrics.clientStreamSendHistogram)
} | go | func EnableClientStreamSendTimeHistogram(opts ...HistogramOption) {
DefaultClientMetrics.EnableClientStreamSendTimeHistogram(opts...)
prom.Register(DefaultClientMetrics.clientStreamSendHistogram)
} | [
"func",
"EnableClientStreamSendTimeHistogram",
"(",
"opts",
"...",
"HistogramOption",
")",
"{",
"DefaultClientMetrics",
".",
"EnableClientStreamSendTimeHistogram",
"(",
"opts",
"...",
")",
"\n",
"prom",
".",
"Register",
"(",
"DefaultClientMetrics",
".",
"clientStreamSendH... | // EnableClientStreamReceiveTimeHistogram turns on recording of
// single message send time of streaming RPCs.
// This function acts on the DefaultClientMetrics variable and the
// default Prometheus metrics registry. | [
"EnableClientStreamReceiveTimeHistogram",
"turns",
"on",
"recording",
"of",
"single",
"message",
"send",
"time",
"of",
"streaming",
"RPCs",
".",
"This",
"function",
"acts",
"on",
"the",
"DefaultClientMetrics",
"variable",
"and",
"the",
"default",
"Prometheus",
"metric... | ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da | https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/client.go#L54-L57 | train |
grpc-ecosystem/go-grpc-prometheus | metric_options.go | WithConstLabels | func WithConstLabels(labels prom.Labels) CounterOption {
return func(o *prom.CounterOpts) {
o.ConstLabels = labels
}
} | go | func WithConstLabels(labels prom.Labels) CounterOption {
return func(o *prom.CounterOpts) {
o.ConstLabels = labels
}
} | [
"func",
"WithConstLabels",
"(",
"labels",
"prom",
".",
"Labels",
")",
"CounterOption",
"{",
"return",
"func",
"(",
"o",
"*",
"prom",
".",
"CounterOpts",
")",
"{",
"o",
".",
"ConstLabels",
"=",
"labels",
"\n",
"}",
"\n",
"}"
] | // WithConstLabels allows you to add ConstLabels to Counter metrics. | [
"WithConstLabels",
"allows",
"you",
"to",
"add",
"ConstLabels",
"to",
"Counter",
"metrics",
"."
] | ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da | https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/metric_options.go#L20-L24 | train |
grpc-ecosystem/go-grpc-prometheus | metric_options.go | WithHistogramBuckets | func WithHistogramBuckets(buckets []float64) HistogramOption {
return func(o *prom.HistogramOpts) { o.Buckets = buckets }
} | go | func WithHistogramBuckets(buckets []float64) HistogramOption {
return func(o *prom.HistogramOpts) { o.Buckets = buckets }
} | [
"func",
"WithHistogramBuckets",
"(",
"buckets",
"[",
"]",
"float64",
")",
"HistogramOption",
"{",
"return",
"func",
"(",
"o",
"*",
"prom",
".",
"HistogramOpts",
")",
"{",
"o",
".",
"Buckets",
"=",
"buckets",
"}",
"\n",
"}"
] | // WithHistogramBuckets allows you to specify custom bucket ranges for histograms if EnableHandlingTimeHistogram is on. | [
"WithHistogramBuckets",
"allows",
"you",
"to",
"specify",
"custom",
"bucket",
"ranges",
"for",
"histograms",
"if",
"EnableHandlingTimeHistogram",
"is",
"on",
"."
] | ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da | https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/metric_options.go#L31-L33 | train |
grpc-ecosystem/go-grpc-prometheus | metric_options.go | WithHistogramConstLabels | func WithHistogramConstLabels(labels prom.Labels) HistogramOption {
return func(o *prom.HistogramOpts) {
o.ConstLabels = labels
}
} | go | func WithHistogramConstLabels(labels prom.Labels) HistogramOption {
return func(o *prom.HistogramOpts) {
o.ConstLabels = labels
}
} | [
"func",
"WithHistogramConstLabels",
"(",
"labels",
"prom",
".",
"Labels",
")",
"HistogramOption",
"{",
"return",
"func",
"(",
"o",
"*",
"prom",
".",
"HistogramOpts",
")",
"{",
"o",
".",
"ConstLabels",
"=",
"labels",
"\n",
"}",
"\n",
"}"
] | // WithHistogramConstLabels allows you to add custom ConstLabels to
// histograms metrics. | [
"WithHistogramConstLabels",
"allows",
"you",
"to",
"add",
"custom",
"ConstLabels",
"to",
"histograms",
"metrics",
"."
] | ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da | https://github.com/grpc-ecosystem/go-grpc-prometheus/blob/ae0d8660c5f2108ca70a3776dbe0fb53cf79f1da/metric_options.go#L37-L41 | train |
jaegertracing/jaeger-client-go | metrics.go | NewMetrics | func NewMetrics(factory metrics.Factory, globalTags map[string]string) *Metrics {
m := &Metrics{}
// TODO the namespace "jaeger" should be configurable
metrics.MustInit(m, factory.Namespace(metrics.NSOptions{Name: "jaeger"}).Namespace(metrics.NSOptions{Name: "tracer"}), globalTags)
return m
} | go | func NewMetrics(factory metrics.Factory, globalTags map[string]string) *Metrics {
m := &Metrics{}
// TODO the namespace "jaeger" should be configurable
metrics.MustInit(m, factory.Namespace(metrics.NSOptions{Name: "jaeger"}).Namespace(metrics.NSOptions{Name: "tracer"}), globalTags)
return m
} | [
"func",
"NewMetrics",
"(",
"factory",
"metrics",
".",
"Factory",
",",
"globalTags",
"map",
"[",
"string",
"]",
"string",
")",
"*",
"Metrics",
"{",
"m",
":=",
"&",
"Metrics",
"{",
"}",
"\n",
"// TODO the namespace \"jaeger\" should be configurable",
"metrics",
".... | // NewMetrics creates a new Metrics struct and initializes it. | [
"NewMetrics",
"creates",
"a",
"new",
"Metrics",
"struct",
"and",
"initializes",
"it",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/metrics.go#L97-L102 | train |
jaegertracing/jaeger-client-go | rpcmetrics/metrics.go | getWithWriteLock | func (m *MetricsByEndpoint) getWithWriteLock(safeName string) *Metrics {
m.mux.Lock()
defer m.mux.Unlock()
// it is possible that the name has been already registered after we released
// the read lock and before we grabbed the write lock, so check for that.
if met, ok := m.metricsByEndpoint[safeName]; ok {
ret... | go | func (m *MetricsByEndpoint) getWithWriteLock(safeName string) *Metrics {
m.mux.Lock()
defer m.mux.Unlock()
// it is possible that the name has been already registered after we released
// the read lock and before we grabbed the write lock, so check for that.
if met, ok := m.metricsByEndpoint[safeName]; ok {
ret... | [
"func",
"(",
"m",
"*",
"MetricsByEndpoint",
")",
"getWithWriteLock",
"(",
"safeName",
"string",
")",
"*",
"Metrics",
"{",
"m",
".",
"mux",
".",
"Lock",
"(",
")",
"\n",
"defer",
"m",
".",
"mux",
".",
"Unlock",
"(",
")",
"\n\n",
"// it is possible that the... | // split to make easier to test | [
"split",
"to",
"make",
"easier",
"to",
"test"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/metrics.go#L106-L124 | train |
jaegertracing/jaeger-client-go | internal/baggage/remote/restriction_manager.go | NewRestrictionManager | func NewRestrictionManager(serviceName string, options ...Option) *RestrictionManager {
// TODO there is a developing use case where a single tracer can generate traces on behalf of many services.
// restrictionsMap will need to exist per service
opts := applyOptions(options...)
m := &RestrictionManager{
serviceN... | go | func NewRestrictionManager(serviceName string, options ...Option) *RestrictionManager {
// TODO there is a developing use case where a single tracer can generate traces on behalf of many services.
// restrictionsMap will need to exist per service
opts := applyOptions(options...)
m := &RestrictionManager{
serviceN... | [
"func",
"NewRestrictionManager",
"(",
"serviceName",
"string",
",",
"options",
"...",
"Option",
")",
"*",
"RestrictionManager",
"{",
"// TODO there is a developing use case where a single tracer can generate traces on behalf of many services.",
"// restrictionsMap will need to exist per ... | // NewRestrictionManager returns a BaggageRestrictionManager that polls the agent for the latest
// baggage restrictions. | [
"NewRestrictionManager",
"returns",
"a",
"BaggageRestrictionManager",
"that",
"polls",
"the",
"agent",
"for",
"the",
"latest",
"baggage",
"restrictions",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/remote/restriction_manager.go#L67-L83 | train |
jaegertracing/jaeger-client-go | internal/baggage/remote/restriction_manager.go | isReady | func (m *RestrictionManager) isReady() bool {
m.mux.RLock()
defer m.mux.RUnlock()
return m.initialized
} | go | func (m *RestrictionManager) isReady() bool {
m.mux.RLock()
defer m.mux.RUnlock()
return m.initialized
} | [
"func",
"(",
"m",
"*",
"RestrictionManager",
")",
"isReady",
"(",
")",
"bool",
"{",
"m",
".",
"mux",
".",
"RLock",
"(",
")",
"\n",
"defer",
"m",
".",
"mux",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"m",
".",
"initialized",
"\n",
"}"
] | // isReady returns true if the manager has retrieved baggage restrictions from the remote source. | [
"isReady",
"returns",
"true",
"if",
"the",
"manager",
"has",
"retrieved",
"baggage",
"restrictions",
"from",
"the",
"remote",
"source",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/remote/restriction_manager.go#L86-L90 | train |
jaegertracing/jaeger-client-go | internal/baggage/remote/restriction_manager.go | Close | func (m *RestrictionManager) Close() error {
close(m.stopPoll)
m.pollStopped.Wait()
return nil
} | go | func (m *RestrictionManager) Close() error {
close(m.stopPoll)
m.pollStopped.Wait()
return nil
} | [
"func",
"(",
"m",
"*",
"RestrictionManager",
")",
"Close",
"(",
")",
"error",
"{",
"close",
"(",
"m",
".",
"stopPoll",
")",
"\n",
"m",
".",
"pollStopped",
".",
"Wait",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // Close stops remote polling and closes the RemoteRestrictionManager. | [
"Close",
"stops",
"remote",
"polling",
"and",
"closes",
"the",
"RemoteRestrictionManager",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/remote/restriction_manager.go#L109-L113 | train |
jaegertracing/jaeger-client-go | transport_udp.go | NewUDPTransport | func NewUDPTransport(hostPort string, maxPacketSize int) (Transport, error) {
if len(hostPort) == 0 {
hostPort = fmt.Sprintf("%s:%d", DefaultUDPSpanServerHost, DefaultUDPSpanServerPort)
}
if maxPacketSize == 0 {
maxPacketSize = utils.UDPPacketMaxLength
}
protocolFactory := thrift.NewTCompactProtocolFactory()
... | go | func NewUDPTransport(hostPort string, maxPacketSize int) (Transport, error) {
if len(hostPort) == 0 {
hostPort = fmt.Sprintf("%s:%d", DefaultUDPSpanServerHost, DefaultUDPSpanServerPort)
}
if maxPacketSize == 0 {
maxPacketSize = utils.UDPPacketMaxLength
}
protocolFactory := thrift.NewTCompactProtocolFactory()
... | [
"func",
"NewUDPTransport",
"(",
"hostPort",
"string",
",",
"maxPacketSize",
"int",
")",
"(",
"Transport",
",",
"error",
")",
"{",
"if",
"len",
"(",
"hostPort",
")",
"==",
"0",
"{",
"hostPort",
"=",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"DefaultU... | // NewUDPTransport creates a reporter that submits spans to jaeger-agent | [
"NewUDPTransport",
"creates",
"a",
"reporter",
"that",
"submits",
"spans",
"to",
"jaeger",
"-",
"agent"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/transport_udp.go#L50-L75 | train |
jaegertracing/jaeger-client-go | internal/baggage/restriction_manager.go | NewRestriction | func NewRestriction(keyAllowed bool, maxValueLength int) *Restriction {
return &Restriction{
keyAllowed: keyAllowed,
maxValueLength: maxValueLength,
}
} | go | func NewRestriction(keyAllowed bool, maxValueLength int) *Restriction {
return &Restriction{
keyAllowed: keyAllowed,
maxValueLength: maxValueLength,
}
} | [
"func",
"NewRestriction",
"(",
"keyAllowed",
"bool",
",",
"maxValueLength",
"int",
")",
"*",
"Restriction",
"{",
"return",
"&",
"Restriction",
"{",
"keyAllowed",
":",
"keyAllowed",
",",
"maxValueLength",
":",
"maxValueLength",
",",
"}",
"\n",
"}"
] | // NewRestriction returns a new Restriction. | [
"NewRestriction",
"returns",
"a",
"new",
"Restriction",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/restriction_manager.go#L28-L33 | train |
jaegertracing/jaeger-client-go | internal/baggage/restriction_manager.go | NewDefaultRestrictionManager | func NewDefaultRestrictionManager(maxValueLength int) *DefaultRestrictionManager {
if maxValueLength == 0 {
maxValueLength = defaultMaxValueLength
}
return &DefaultRestrictionManager{
defaultRestriction: &Restriction{keyAllowed: true, maxValueLength: maxValueLength},
}
} | go | func NewDefaultRestrictionManager(maxValueLength int) *DefaultRestrictionManager {
if maxValueLength == 0 {
maxValueLength = defaultMaxValueLength
}
return &DefaultRestrictionManager{
defaultRestriction: &Restriction{keyAllowed: true, maxValueLength: maxValueLength},
}
} | [
"func",
"NewDefaultRestrictionManager",
"(",
"maxValueLength",
"int",
")",
"*",
"DefaultRestrictionManager",
"{",
"if",
"maxValueLength",
"==",
"0",
"{",
"maxValueLength",
"=",
"defaultMaxValueLength",
"\n",
"}",
"\n",
"return",
"&",
"DefaultRestrictionManager",
"{",
... | // NewDefaultRestrictionManager returns a DefaultRestrictionManager. | [
"NewDefaultRestrictionManager",
"returns",
"a",
"DefaultRestrictionManager",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/restriction_manager.go#L59-L66 | train |
jaegertracing/jaeger-client-go | transport/http.go | HTTPBasicAuth | func HTTPBasicAuth(username string, password string) HTTPOption {
return func(c *HTTPTransport) {
c.httpCredentials = &HTTPBasicAuthCredentials{username: username, password: password}
}
} | go | func HTTPBasicAuth(username string, password string) HTTPOption {
return func(c *HTTPTransport) {
c.httpCredentials = &HTTPBasicAuthCredentials{username: username, password: password}
}
} | [
"func",
"HTTPBasicAuth",
"(",
"username",
"string",
",",
"password",
"string",
")",
"HTTPOption",
"{",
"return",
"func",
"(",
"c",
"*",
"HTTPTransport",
")",
"{",
"c",
".",
"httpCredentials",
"=",
"&",
"HTTPBasicAuthCredentials",
"{",
"username",
":",
"usernam... | // HTTPBasicAuth sets the credentials required to perform HTTP basic auth | [
"HTTPBasicAuth",
"sets",
"the",
"credentials",
"required",
"to",
"perform",
"HTTP",
"basic",
"auth"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/transport/http.go#L65-L69 | train |
jaegertracing/jaeger-client-go | context.go | ContextFromString | func ContextFromString(value string) (SpanContext, error) {
var context SpanContext
if value == "" {
return emptyContext, errEmptyTracerStateString
}
parts := strings.Split(value, ":")
if len(parts) != 4 {
return emptyContext, errMalformedTracerStateString
}
var err error
if context.traceID, err = TraceIDFr... | go | func ContextFromString(value string) (SpanContext, error) {
var context SpanContext
if value == "" {
return emptyContext, errEmptyTracerStateString
}
parts := strings.Split(value, ":")
if len(parts) != 4 {
return emptyContext, errMalformedTracerStateString
}
var err error
if context.traceID, err = TraceIDFr... | [
"func",
"ContextFromString",
"(",
"value",
"string",
")",
"(",
"SpanContext",
",",
"error",
")",
"{",
"var",
"context",
"SpanContext",
"\n",
"if",
"value",
"==",
"\"",
"\"",
"{",
"return",
"emptyContext",
",",
"errEmptyTracerStateString",
"\n",
"}",
"\n",
"p... | // ContextFromString reconstructs the Context encoded in a string | [
"ContextFromString",
"reconstructs",
"the",
"Context",
"encoded",
"in",
"a",
"string"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/context.go#L104-L129 | train |
jaegertracing/jaeger-client-go | context.go | NewSpanContext | func NewSpanContext(traceID TraceID, spanID, parentID SpanID, sampled bool, baggage map[string]string) SpanContext {
flags := byte(0)
if sampled {
flags = flagSampled
}
return SpanContext{
traceID: traceID,
spanID: spanID,
parentID: parentID,
flags: flags,
baggage: baggage}
} | go | func NewSpanContext(traceID TraceID, spanID, parentID SpanID, sampled bool, baggage map[string]string) SpanContext {
flags := byte(0)
if sampled {
flags = flagSampled
}
return SpanContext{
traceID: traceID,
spanID: spanID,
parentID: parentID,
flags: flags,
baggage: baggage}
} | [
"func",
"NewSpanContext",
"(",
"traceID",
"TraceID",
",",
"spanID",
",",
"parentID",
"SpanID",
",",
"sampled",
"bool",
",",
"baggage",
"map",
"[",
"string",
"]",
"string",
")",
"SpanContext",
"{",
"flags",
":=",
"byte",
"(",
"0",
")",
"\n",
"if",
"sample... | // NewSpanContext creates a new instance of SpanContext | [
"NewSpanContext",
"creates",
"a",
"new",
"instance",
"of",
"SpanContext"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/context.go#L147-L158 | train |
jaegertracing/jaeger-client-go | context.go | WithBaggageItem | func (c SpanContext) WithBaggageItem(key, value string) SpanContext {
var newBaggage map[string]string
if c.baggage == nil {
newBaggage = map[string]string{key: value}
} else {
newBaggage = make(map[string]string, len(c.baggage)+1)
for k, v := range c.baggage {
newBaggage[k] = v
}
newBaggage[key] = valu... | go | func (c SpanContext) WithBaggageItem(key, value string) SpanContext {
var newBaggage map[string]string
if c.baggage == nil {
newBaggage = map[string]string{key: value}
} else {
newBaggage = make(map[string]string, len(c.baggage)+1)
for k, v := range c.baggage {
newBaggage[k] = v
}
newBaggage[key] = valu... | [
"func",
"(",
"c",
"SpanContext",
")",
"WithBaggageItem",
"(",
"key",
",",
"value",
"string",
")",
"SpanContext",
"{",
"var",
"newBaggage",
"map",
"[",
"string",
"]",
"string",
"\n",
"if",
"c",
".",
"baggage",
"==",
"nil",
"{",
"newBaggage",
"=",
"map",
... | // WithBaggageItem creates a new context with an extra baggage item. | [
"WithBaggageItem",
"creates",
"a",
"new",
"context",
"with",
"an",
"extra",
"baggage",
"item",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/context.go#L178-L191 | train |
jaegertracing/jaeger-client-go | context.go | SpanIDFromString | func SpanIDFromString(s string) (SpanID, error) {
if len(s) > 16 {
return SpanID(0), fmt.Errorf("SpanID cannot be longer than 16 hex characters: %s", s)
}
id, err := strconv.ParseUint(s, 16, 64)
if err != nil {
return SpanID(0), err
}
return SpanID(id), nil
} | go | func SpanIDFromString(s string) (SpanID, error) {
if len(s) > 16 {
return SpanID(0), fmt.Errorf("SpanID cannot be longer than 16 hex characters: %s", s)
}
id, err := strconv.ParseUint(s, 16, 64)
if err != nil {
return SpanID(0), err
}
return SpanID(id), nil
} | [
"func",
"SpanIDFromString",
"(",
"s",
"string",
")",
"(",
"SpanID",
",",
"error",
")",
"{",
"if",
"len",
"(",
"s",
")",
">",
"16",
"{",
"return",
"SpanID",
"(",
"0",
")",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"s",
")",
"\n",
"}",
"... | // SpanIDFromString creates a SpanID from a hexadecimal string | [
"SpanIDFromString",
"creates",
"a",
"SpanID",
"from",
"a",
"hexadecimal",
"string"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/context.go#L249-L258 | train |
jaegertracing/jaeger-client-go | utils/utils.go | ParsePort | func ParsePort(portString string) (uint16, error) {
port, err := strconv.ParseUint(portString, 10, 16)
return uint16(port), err
} | go | func ParsePort(portString string) (uint16, error) {
port, err := strconv.ParseUint(portString, 10, 16)
return uint16(port), err
} | [
"func",
"ParsePort",
"(",
"portString",
"string",
")",
"(",
"uint16",
",",
"error",
")",
"{",
"port",
",",
"err",
":=",
"strconv",
".",
"ParseUint",
"(",
"portString",
",",
"10",
",",
"16",
")",
"\n",
"return",
"uint16",
"(",
"port",
")",
",",
"err",... | // ParsePort converts port number from string to uin16 | [
"ParsePort",
"converts",
"port",
"number",
"from",
"string",
"to",
"uin16"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/utils/utils.go#L65-L68 | train |
jaegertracing/jaeger-client-go | utils/utils.go | PackIPAsUint32 | func PackIPAsUint32(ip net.IP) uint32 {
if ipv4 := ip.To4(); ipv4 != nil {
return binary.BigEndian.Uint32(ipv4)
}
return 0
} | go | func PackIPAsUint32(ip net.IP) uint32 {
if ipv4 := ip.To4(); ipv4 != nil {
return binary.BigEndian.Uint32(ipv4)
}
return 0
} | [
"func",
"PackIPAsUint32",
"(",
"ip",
"net",
".",
"IP",
")",
"uint32",
"{",
"if",
"ipv4",
":=",
"ip",
".",
"To4",
"(",
")",
";",
"ipv4",
"!=",
"nil",
"{",
"return",
"binary",
".",
"BigEndian",
".",
"Uint32",
"(",
"ipv4",
")",
"\n",
"}",
"\n",
"ret... | // PackIPAsUint32 packs an IPv4 as uint32 | [
"PackIPAsUint32",
"packs",
"an",
"IPv4",
"as",
"uint32"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/utils/utils.go#L71-L76 | train |
jaegertracing/jaeger-client-go | jaeger_tag.go | ConvertLogsToJaegerTags | func ConvertLogsToJaegerTags(logFields []log.Field) []*j.Tag {
fields := tags(make([]*j.Tag, 0, len(logFields)))
for _, field := range logFields {
field.Marshal(&fields)
}
return fields
} | go | func ConvertLogsToJaegerTags(logFields []log.Field) []*j.Tag {
fields := tags(make([]*j.Tag, 0, len(logFields)))
for _, field := range logFields {
field.Marshal(&fields)
}
return fields
} | [
"func",
"ConvertLogsToJaegerTags",
"(",
"logFields",
"[",
"]",
"log",
".",
"Field",
")",
"[",
"]",
"*",
"j",
".",
"Tag",
"{",
"fields",
":=",
"tags",
"(",
"make",
"(",
"[",
"]",
"*",
"j",
".",
"Tag",
",",
"0",
",",
"len",
"(",
"logFields",
")",
... | // ConvertLogsToJaegerTags converts log Fields into jaeger tags. | [
"ConvertLogsToJaegerTags",
"converts",
"log",
"Fields",
"into",
"jaeger",
"tags",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/jaeger_tag.go#L28-L34 | train |
jaegertracing/jaeger-client-go | internal/throttler/remote/throttler.go | FetchCredits | func (m *httpCreditManagerProxy) FetchCredits(uuid, serviceName string, operations []string) (*creditResponse, error) {
params := url.Values{}
params.Set("service", serviceName)
params.Set("uuid", uuid)
for _, op := range operations {
params.Add("operations", op)
}
var resp creditResponse
if err := utils.GetJS... | go | func (m *httpCreditManagerProxy) FetchCredits(uuid, serviceName string, operations []string) (*creditResponse, error) {
params := url.Values{}
params.Set("service", serviceName)
params.Set("uuid", uuid)
for _, op := range operations {
params.Add("operations", op)
}
var resp creditResponse
if err := utils.GetJS... | [
"func",
"(",
"m",
"*",
"httpCreditManagerProxy",
")",
"FetchCredits",
"(",
"uuid",
",",
"serviceName",
"string",
",",
"operations",
"[",
"]",
"string",
")",
"(",
"*",
"creditResponse",
",",
"error",
")",
"{",
"params",
":=",
"url",
".",
"Values",
"{",
"}... | // N.B. Operations list must not be empty. | [
"N",
".",
"B",
".",
"Operations",
"list",
"must",
"not",
"be",
"empty",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/throttler/remote/throttler.go#L60-L72 | train |
jaegertracing/jaeger-client-go | internal/throttler/remote/throttler.go | NewThrottler | func NewThrottler(service string, options ...Option) *Throttler {
opts := applyOptions(options...)
creditManager := newHTTPCreditManagerProxy(opts.hostPort)
t := &Throttler{
options: opts,
creditManager: creditManager,
service: service,
credits: make(map[string]float64),
close: ma... | go | func NewThrottler(service string, options ...Option) *Throttler {
opts := applyOptions(options...)
creditManager := newHTTPCreditManagerProxy(opts.hostPort)
t := &Throttler{
options: opts,
creditManager: creditManager,
service: service,
credits: make(map[string]float64),
close: ma... | [
"func",
"NewThrottler",
"(",
"service",
"string",
",",
"options",
"...",
"Option",
")",
"*",
"Throttler",
"{",
"opts",
":=",
"applyOptions",
"(",
"options",
"...",
")",
"\n",
"creditManager",
":=",
"newHTTPCreditManagerProxy",
"(",
"opts",
".",
"hostPort",
")"... | // NewThrottler returns a Throttler that polls agent for credits and uses them to throttle
// the service. | [
"NewThrottler",
"returns",
"a",
"Throttler",
"that",
"polls",
"agent",
"for",
"credits",
"and",
"uses",
"them",
"to",
"throttle",
"the",
"service",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/throttler/remote/throttler.go#L89-L102 | train |
jaegertracing/jaeger-client-go | internal/throttler/remote/throttler.go | Close | func (t *Throttler) Close() error {
close(t.close)
t.stopped.Wait()
return nil
} | go | func (t *Throttler) Close() error {
close(t.close)
t.stopped.Wait()
return nil
} | [
"func",
"(",
"t",
"*",
"Throttler",
")",
"Close",
"(",
")",
"error",
"{",
"close",
"(",
"t",
".",
"close",
")",
"\n",
"t",
".",
"stopped",
".",
"Wait",
"(",
")",
"\n",
"return",
"nil",
"\n",
"}"
] | // Close stops the throttler from fetching credits from remote. | [
"Close",
"stops",
"the",
"throttler",
"from",
"fetching",
"credits",
"from",
"remote",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/throttler/remote/throttler.go#L140-L144 | train |
jaegertracing/jaeger-client-go | internal/throttler/remote/throttler.go | isAllowed | func (t *Throttler) isAllowed(operation string) bool {
credits := t.credits[operation]
if credits < minimumCredits {
t.metrics.ThrottledDebugSpans.Inc(1)
return false
}
t.credits[operation] = credits - minimumCredits
return true
} | go | func (t *Throttler) isAllowed(operation string) bool {
credits := t.credits[operation]
if credits < minimumCredits {
t.metrics.ThrottledDebugSpans.Inc(1)
return false
}
t.credits[operation] = credits - minimumCredits
return true
} | [
"func",
"(",
"t",
"*",
"Throttler",
")",
"isAllowed",
"(",
"operation",
"string",
")",
"bool",
"{",
"credits",
":=",
"t",
".",
"credits",
"[",
"operation",
"]",
"\n",
"if",
"credits",
"<",
"minimumCredits",
"{",
"t",
".",
"metrics",
".",
"ThrottledDebugS... | // N.B. This function must be called with the Write Lock | [
"N",
".",
"B",
".",
"This",
"function",
"must",
"be",
"called",
"with",
"the",
"Write",
"Lock"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/throttler/remote/throttler.go#L155-L163 | train |
jaegertracing/jaeger-client-go | internal/baggage/remote/options.go | DenyBaggageOnInitializationFailure | func (options) DenyBaggageOnInitializationFailure(b bool) Option {
return func(o *options) {
o.denyBaggageOnInitializationFailure = b
}
} | go | func (options) DenyBaggageOnInitializationFailure(b bool) Option {
return func(o *options) {
o.denyBaggageOnInitializationFailure = b
}
} | [
"func",
"(",
"options",
")",
"DenyBaggageOnInitializationFailure",
"(",
"b",
"bool",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"options",
")",
"{",
"o",
".",
"denyBaggageOnInitializationFailure",
"=",
"b",
"\n",
"}",
"\n",
"}"
] | // DenyBaggageOnInitializationFailure creates an Option that determines the startup failure mode of RestrictionManager.
// If DenyBaggageOnInitializationFailure is true, RestrictionManager will not allow any baggage to be written until baggage
// restrictions have been retrieved from agent.
// If DenyBaggageOnInitializ... | [
"DenyBaggageOnInitializationFailure",
"creates",
"an",
"Option",
"that",
"determines",
"the",
"startup",
"failure",
"mode",
"of",
"RestrictionManager",
".",
"If",
"DenyBaggageOnInitializationFailure",
"is",
"true",
"RestrictionManager",
"will",
"not",
"allow",
"any",
"bag... | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/remote/options.go#L48-L52 | train |
jaegertracing/jaeger-client-go | internal/baggage/remote/options.go | Metrics | func (options) Metrics(m *jaeger.Metrics) Option {
return func(o *options) {
o.metrics = m
}
} | go | func (options) Metrics(m *jaeger.Metrics) Option {
return func(o *options) {
o.metrics = m
}
} | [
"func",
"(",
"options",
")",
"Metrics",
"(",
"m",
"*",
"jaeger",
".",
"Metrics",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"options",
")",
"{",
"o",
".",
"metrics",
"=",
"m",
"\n",
"}",
"\n",
"}"
] | // Metrics creates an Option that initializes Metrics on the RestrictionManager, which is used to emit statistics. | [
"Metrics",
"creates",
"an",
"Option",
"that",
"initializes",
"Metrics",
"on",
"the",
"RestrictionManager",
"which",
"is",
"used",
"to",
"emit",
"statistics",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/remote/options.go#L55-L59 | train |
jaegertracing/jaeger-client-go | internal/baggage/remote/options.go | Logger | func (options) Logger(logger jaeger.Logger) Option {
return func(o *options) {
o.logger = logger
}
} | go | func (options) Logger(logger jaeger.Logger) Option {
return func(o *options) {
o.logger = logger
}
} | [
"func",
"(",
"options",
")",
"Logger",
"(",
"logger",
"jaeger",
".",
"Logger",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"options",
")",
"{",
"o",
".",
"logger",
"=",
"logger",
"\n",
"}",
"\n",
"}"
] | // Logger creates an Option that sets the logger used by the RestrictionManager. | [
"Logger",
"creates",
"an",
"Option",
"that",
"sets",
"the",
"logger",
"used",
"by",
"the",
"RestrictionManager",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/remote/options.go#L62-L66 | train |
jaegertracing/jaeger-client-go | internal/baggage/remote/options.go | HostPort | func (options) HostPort(hostPort string) Option {
return func(o *options) {
o.hostPort = hostPort
}
} | go | func (options) HostPort(hostPort string) Option {
return func(o *options) {
o.hostPort = hostPort
}
} | [
"func",
"(",
"options",
")",
"HostPort",
"(",
"hostPort",
"string",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"options",
")",
"{",
"o",
".",
"hostPort",
"=",
"hostPort",
"\n",
"}",
"\n",
"}"
] | // HostPort creates an Option that sets the hostPort of the local agent that contains the baggage restrictions. | [
"HostPort",
"creates",
"an",
"Option",
"that",
"sets",
"the",
"hostPort",
"of",
"the",
"local",
"agent",
"that",
"contains",
"the",
"baggage",
"restrictions",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/remote/options.go#L69-L73 | train |
jaegertracing/jaeger-client-go | internal/baggage/remote/options.go | RefreshInterval | func (options) RefreshInterval(refreshInterval time.Duration) Option {
return func(o *options) {
o.refreshInterval = refreshInterval
}
} | go | func (options) RefreshInterval(refreshInterval time.Duration) Option {
return func(o *options) {
o.refreshInterval = refreshInterval
}
} | [
"func",
"(",
"options",
")",
"RefreshInterval",
"(",
"refreshInterval",
"time",
".",
"Duration",
")",
"Option",
"{",
"return",
"func",
"(",
"o",
"*",
"options",
")",
"{",
"o",
".",
"refreshInterval",
"=",
"refreshInterval",
"\n",
"}",
"\n",
"}"
] | // RefreshInterval creates an Option that sets how often the RestrictionManager will poll local agent for
// the baggage restrictions. | [
"RefreshInterval",
"creates",
"an",
"Option",
"that",
"sets",
"how",
"often",
"the",
"RestrictionManager",
"will",
"poll",
"local",
"agent",
"for",
"the",
"baggage",
"restrictions",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/internal/baggage/remote/options.go#L77-L81 | train |
jaegertracing/jaeger-client-go | rpcmetrics/observer.go | NewObserver | func NewObserver(metricsFactory metrics.Factory, normalizer NameNormalizer) *Observer {
return &Observer{
metricsByEndpoint: newMetricsByEndpoint(
metricsFactory,
normalizer,
defaultMaxNumberOfEndpoints,
),
}
} | go | func NewObserver(metricsFactory metrics.Factory, normalizer NameNormalizer) *Observer {
return &Observer{
metricsByEndpoint: newMetricsByEndpoint(
metricsFactory,
normalizer,
defaultMaxNumberOfEndpoints,
),
}
} | [
"func",
"NewObserver",
"(",
"metricsFactory",
"metrics",
".",
"Factory",
",",
"normalizer",
"NameNormalizer",
")",
"*",
"Observer",
"{",
"return",
"&",
"Observer",
"{",
"metricsByEndpoint",
":",
"newMetricsByEndpoint",
"(",
"metricsFactory",
",",
"normalizer",
",",
... | // NewObserver creates a new observer that can emit RPC metrics. | [
"NewObserver",
"creates",
"a",
"new",
"observer",
"that",
"can",
"emit",
"RPC",
"metrics",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/observer.go#L37-L45 | train |
jaegertracing/jaeger-client-go | rpcmetrics/observer.go | OnStartSpan | func (o *Observer) OnStartSpan(
operationName string,
options opentracing.StartSpanOptions,
) jaeger.SpanObserver {
return NewSpanObserver(o.metricsByEndpoint, operationName, options)
} | go | func (o *Observer) OnStartSpan(
operationName string,
options opentracing.StartSpanOptions,
) jaeger.SpanObserver {
return NewSpanObserver(o.metricsByEndpoint, operationName, options)
} | [
"func",
"(",
"o",
"*",
"Observer",
")",
"OnStartSpan",
"(",
"operationName",
"string",
",",
"options",
"opentracing",
".",
"StartSpanOptions",
",",
")",
"jaeger",
".",
"SpanObserver",
"{",
"return",
"NewSpanObserver",
"(",
"o",
".",
"metricsByEndpoint",
",",
"... | // OnStartSpan creates a new Observer for the span. | [
"OnStartSpan",
"creates",
"a",
"new",
"Observer",
"for",
"the",
"span",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/observer.go#L48-L53 | train |
jaegertracing/jaeger-client-go | rpcmetrics/observer.go | NewSpanObserver | func NewSpanObserver(
metricsByEndpoint *MetricsByEndpoint,
operationName string,
options opentracing.StartSpanOptions,
) *SpanObserver {
so := &SpanObserver{
metricsByEndpoint: metricsByEndpoint,
operationName: operationName,
startTime: options.StartTime,
}
for k, v := range options.Tags {
so... | go | func NewSpanObserver(
metricsByEndpoint *MetricsByEndpoint,
operationName string,
options opentracing.StartSpanOptions,
) *SpanObserver {
so := &SpanObserver{
metricsByEndpoint: metricsByEndpoint,
operationName: operationName,
startTime: options.StartTime,
}
for k, v := range options.Tags {
so... | [
"func",
"NewSpanObserver",
"(",
"metricsByEndpoint",
"*",
"MetricsByEndpoint",
",",
"operationName",
"string",
",",
"options",
"opentracing",
".",
"StartSpanOptions",
",",
")",
"*",
"SpanObserver",
"{",
"so",
":=",
"&",
"SpanObserver",
"{",
"metricsByEndpoint",
":",... | // NewSpanObserver creates a new SpanObserver that can emit RPC metrics. | [
"NewSpanObserver",
"creates",
"a",
"new",
"SpanObserver",
"that",
"can",
"emit",
"RPC",
"metrics",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/observer.go#L79-L93 | train |
jaegertracing/jaeger-client-go | rpcmetrics/observer.go | handleTagInLock | func (so *SpanObserver) handleTagInLock(key string, value interface{}) {
if key == string(ext.SpanKind) {
if v, ok := value.(ext.SpanKindEnum); ok {
value = string(v)
}
if v, ok := value.(string); ok {
if v == string(ext.SpanKindRPCClientEnum) {
so.kind = Outbound
} else if v == string(ext.SpanKindR... | go | func (so *SpanObserver) handleTagInLock(key string, value interface{}) {
if key == string(ext.SpanKind) {
if v, ok := value.(ext.SpanKindEnum); ok {
value = string(v)
}
if v, ok := value.(string); ok {
if v == string(ext.SpanKindRPCClientEnum) {
so.kind = Outbound
} else if v == string(ext.SpanKindR... | [
"func",
"(",
"so",
"*",
"SpanObserver",
")",
"handleTagInLock",
"(",
"key",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"if",
"key",
"==",
"string",
"(",
"ext",
".",
"SpanKind",
")",
"{",
"if",
"v",
",",
"ok",
":=",
"value",
".",
"(",
... | // handleTags watches for special tags
// - SpanKind
// - HttpStatusCode
// - Error | [
"handleTags",
"watches",
"for",
"special",
"tags",
"-",
"SpanKind",
"-",
"HttpStatusCode",
"-",
"Error"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/observer.go#L99-L135 | train |
jaegertracing/jaeger-client-go | rpcmetrics/observer.go | OnFinish | func (so *SpanObserver) OnFinish(options opentracing.FinishOptions) {
so.mux.Lock()
defer so.mux.Unlock()
if so.operationName == "" || so.kind != Inbound {
return
}
mets := so.metricsByEndpoint.get(so.operationName)
latency := options.FinishTime.Sub(so.startTime)
if so.err {
mets.RequestCountFailures.Inc(1... | go | func (so *SpanObserver) OnFinish(options opentracing.FinishOptions) {
so.mux.Lock()
defer so.mux.Unlock()
if so.operationName == "" || so.kind != Inbound {
return
}
mets := so.metricsByEndpoint.get(so.operationName)
latency := options.FinishTime.Sub(so.startTime)
if so.err {
mets.RequestCountFailures.Inc(1... | [
"func",
"(",
"so",
"*",
"SpanObserver",
")",
"OnFinish",
"(",
"options",
"opentracing",
".",
"FinishOptions",
")",
"{",
"so",
".",
"mux",
".",
"Lock",
"(",
")",
"\n",
"defer",
"so",
".",
"mux",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"so",
".",
"ope... | // OnFinish emits the RPC metrics. It only has an effect when operation name
// is not blank, and the span kind is an RPC server. | [
"OnFinish",
"emits",
"the",
"RPC",
"metrics",
".",
"It",
"only",
"has",
"an",
"effect",
"when",
"operation",
"name",
"is",
"not",
"blank",
"and",
"the",
"span",
"kind",
"is",
"an",
"RPC",
"server",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/observer.go#L139-L157 | train |
jaegertracing/jaeger-client-go | rpcmetrics/observer.go | OnSetOperationName | func (so *SpanObserver) OnSetOperationName(operationName string) {
so.mux.Lock()
so.operationName = operationName
so.mux.Unlock()
} | go | func (so *SpanObserver) OnSetOperationName(operationName string) {
so.mux.Lock()
so.operationName = operationName
so.mux.Unlock()
} | [
"func",
"(",
"so",
"*",
"SpanObserver",
")",
"OnSetOperationName",
"(",
"operationName",
"string",
")",
"{",
"so",
".",
"mux",
".",
"Lock",
"(",
")",
"\n",
"so",
".",
"operationName",
"=",
"operationName",
"\n",
"so",
".",
"mux",
".",
"Unlock",
"(",
")... | // OnSetOperationName records new operation name. | [
"OnSetOperationName",
"records",
"new",
"operation",
"name",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/observer.go#L160-L164 | train |
jaegertracing/jaeger-client-go | rpcmetrics/observer.go | OnSetTag | func (so *SpanObserver) OnSetTag(key string, value interface{}) {
so.mux.Lock()
so.handleTagInLock(key, value)
so.mux.Unlock()
} | go | func (so *SpanObserver) OnSetTag(key string, value interface{}) {
so.mux.Lock()
so.handleTagInLock(key, value)
so.mux.Unlock()
} | [
"func",
"(",
"so",
"*",
"SpanObserver",
")",
"OnSetTag",
"(",
"key",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"{",
"so",
".",
"mux",
".",
"Lock",
"(",
")",
"\n",
"so",
".",
"handleTagInLock",
"(",
"key",
",",
"value",
")",
"\n",
"so",
... | // OnSetTag implements SpanObserver | [
"OnSetTag",
"implements",
"SpanObserver"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/observer.go#L167-L171 | train |
jaegertracing/jaeger-client-go | sampler_options.go | Metrics | func (samplerOptions) Metrics(m *Metrics) SamplerOption {
return func(o *samplerOptions) {
o.metrics = m
}
} | go | func (samplerOptions) Metrics(m *Metrics) SamplerOption {
return func(o *samplerOptions) {
o.metrics = m
}
} | [
"func",
"(",
"samplerOptions",
")",
"Metrics",
"(",
"m",
"*",
"Metrics",
")",
"SamplerOption",
"{",
"return",
"func",
"(",
"o",
"*",
"samplerOptions",
")",
"{",
"o",
".",
"metrics",
"=",
"m",
"\n",
"}",
"\n",
"}"
] | // Metrics creates a SamplerOption that initializes Metrics on the sampler,
// which is used to emit statistics. | [
"Metrics",
"creates",
"a",
"SamplerOption",
"that",
"initializes",
"Metrics",
"on",
"the",
"sampler",
"which",
"is",
"used",
"to",
"emit",
"statistics",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/sampler_options.go#L38-L42 | train |
jaegertracing/jaeger-client-go | sampler_options.go | MaxOperations | func (samplerOptions) MaxOperations(maxOperations int) SamplerOption {
return func(o *samplerOptions) {
o.maxOperations = maxOperations
}
} | go | func (samplerOptions) MaxOperations(maxOperations int) SamplerOption {
return func(o *samplerOptions) {
o.maxOperations = maxOperations
}
} | [
"func",
"(",
"samplerOptions",
")",
"MaxOperations",
"(",
"maxOperations",
"int",
")",
"SamplerOption",
"{",
"return",
"func",
"(",
"o",
"*",
"samplerOptions",
")",
"{",
"o",
".",
"maxOperations",
"=",
"maxOperations",
"\n",
"}",
"\n",
"}"
] | // MaxOperations creates a SamplerOption that sets the maximum number of
// operations the sampler will keep track of. | [
"MaxOperations",
"creates",
"a",
"SamplerOption",
"that",
"sets",
"the",
"maximum",
"number",
"of",
"operations",
"the",
"sampler",
"will",
"keep",
"track",
"of",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/sampler_options.go#L46-L50 | train |
jaegertracing/jaeger-client-go | sampler_options.go | InitialSampler | func (samplerOptions) InitialSampler(sampler Sampler) SamplerOption {
return func(o *samplerOptions) {
o.sampler = sampler
}
} | go | func (samplerOptions) InitialSampler(sampler Sampler) SamplerOption {
return func(o *samplerOptions) {
o.sampler = sampler
}
} | [
"func",
"(",
"samplerOptions",
")",
"InitialSampler",
"(",
"sampler",
"Sampler",
")",
"SamplerOption",
"{",
"return",
"func",
"(",
"o",
"*",
"samplerOptions",
")",
"{",
"o",
".",
"sampler",
"=",
"sampler",
"\n",
"}",
"\n",
"}"
] | // InitialSampler creates a SamplerOption that sets the initial sampler
// to use before a remote sampler is created and used. | [
"InitialSampler",
"creates",
"a",
"SamplerOption",
"that",
"sets",
"the",
"initial",
"sampler",
"to",
"use",
"before",
"a",
"remote",
"sampler",
"is",
"created",
"and",
"used",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/sampler_options.go#L54-L58 | train |
jaegertracing/jaeger-client-go | sampler_options.go | Logger | func (samplerOptions) Logger(logger Logger) SamplerOption {
return func(o *samplerOptions) {
o.logger = logger
}
} | go | func (samplerOptions) Logger(logger Logger) SamplerOption {
return func(o *samplerOptions) {
o.logger = logger
}
} | [
"func",
"(",
"samplerOptions",
")",
"Logger",
"(",
"logger",
"Logger",
")",
"SamplerOption",
"{",
"return",
"func",
"(",
"o",
"*",
"samplerOptions",
")",
"{",
"o",
".",
"logger",
"=",
"logger",
"\n",
"}",
"\n",
"}"
] | // Logger creates a SamplerOption that sets the logger used by the sampler. | [
"Logger",
"creates",
"a",
"SamplerOption",
"that",
"sets",
"the",
"logger",
"used",
"by",
"the",
"sampler",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/sampler_options.go#L61-L65 | train |
jaegertracing/jaeger-client-go | sampler_options.go | SamplingServerURL | func (samplerOptions) SamplingServerURL(samplingServerURL string) SamplerOption {
return func(o *samplerOptions) {
o.samplingServerURL = samplingServerURL
}
} | go | func (samplerOptions) SamplingServerURL(samplingServerURL string) SamplerOption {
return func(o *samplerOptions) {
o.samplingServerURL = samplingServerURL
}
} | [
"func",
"(",
"samplerOptions",
")",
"SamplingServerURL",
"(",
"samplingServerURL",
"string",
")",
"SamplerOption",
"{",
"return",
"func",
"(",
"o",
"*",
"samplerOptions",
")",
"{",
"o",
".",
"samplingServerURL",
"=",
"samplingServerURL",
"\n",
"}",
"\n",
"}"
] | // SamplingServerURL creates a SamplerOption that sets the sampling server url
// of the local agent that contains the sampling strategies. | [
"SamplingServerURL",
"creates",
"a",
"SamplerOption",
"that",
"sets",
"the",
"sampling",
"server",
"url",
"of",
"the",
"local",
"agent",
"that",
"contains",
"the",
"sampling",
"strategies",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/sampler_options.go#L69-L73 | train |
jaegertracing/jaeger-client-go | sampler_options.go | SamplingRefreshInterval | func (samplerOptions) SamplingRefreshInterval(samplingRefreshInterval time.Duration) SamplerOption {
return func(o *samplerOptions) {
o.samplingRefreshInterval = samplingRefreshInterval
}
} | go | func (samplerOptions) SamplingRefreshInterval(samplingRefreshInterval time.Duration) SamplerOption {
return func(o *samplerOptions) {
o.samplingRefreshInterval = samplingRefreshInterval
}
} | [
"func",
"(",
"samplerOptions",
")",
"SamplingRefreshInterval",
"(",
"samplingRefreshInterval",
"time",
".",
"Duration",
")",
"SamplerOption",
"{",
"return",
"func",
"(",
"o",
"*",
"samplerOptions",
")",
"{",
"o",
".",
"samplingRefreshInterval",
"=",
"samplingRefresh... | // SamplingRefreshInterval creates a SamplerOption that sets how often the
// sampler will poll local agent for the appropriate sampling strategy. | [
"SamplingRefreshInterval",
"creates",
"a",
"SamplerOption",
"that",
"sets",
"how",
"often",
"the",
"sampler",
"will",
"poll",
"local",
"agent",
"for",
"the",
"appropriate",
"sampling",
"strategy",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/sampler_options.go#L77-L81 | train |
jaegertracing/jaeger-client-go | utils/udp_client.go | NewAgentClientUDP | func NewAgentClientUDP(hostPort string, maxPacketSize int) (*AgentClientUDP, error) {
if maxPacketSize == 0 {
maxPacketSize = UDPPacketMaxLength
}
thriftBuffer := thrift.NewTMemoryBufferLen(maxPacketSize)
protocolFactory := thrift.NewTCompactProtocolFactory()
client := agent.NewAgentClientFactory(thriftBuffer, ... | go | func NewAgentClientUDP(hostPort string, maxPacketSize int) (*AgentClientUDP, error) {
if maxPacketSize == 0 {
maxPacketSize = UDPPacketMaxLength
}
thriftBuffer := thrift.NewTMemoryBufferLen(maxPacketSize)
protocolFactory := thrift.NewTCompactProtocolFactory()
client := agent.NewAgentClientFactory(thriftBuffer, ... | [
"func",
"NewAgentClientUDP",
"(",
"hostPort",
"string",
",",
"maxPacketSize",
"int",
")",
"(",
"*",
"AgentClientUDP",
",",
"error",
")",
"{",
"if",
"maxPacketSize",
"==",
"0",
"{",
"maxPacketSize",
"=",
"UDPPacketMaxLength",
"\n",
"}",
"\n\n",
"thriftBuffer",
... | // NewAgentClientUDP creates a client that sends spans to Jaeger Agent over UDP. | [
"NewAgentClientUDP",
"creates",
"a",
"client",
"that",
"sends",
"spans",
"to",
"Jaeger",
"Agent",
"over",
"UDP",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/utils/udp_client.go#L45-L73 | train |
jaegertracing/jaeger-client-go | crossdock/client/client.go | AsyncStart | func (c *Client) AsyncStart() error {
if err := c.Listen(); err != nil {
return err
}
var started sync.WaitGroup
started.Add(1)
go func() {
started.Done()
c.Serve()
}()
started.Wait()
return nil
} | go | func (c *Client) AsyncStart() error {
if err := c.Listen(); err != nil {
return err
}
var started sync.WaitGroup
started.Add(1)
go func() {
started.Done()
c.Serve()
}()
started.Wait()
return nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AsyncStart",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"Listen",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"var",
"started",
"sync",
".",
"WaitGroup",
"\n",
"starte... | // AsyncStart begins a Crossdock client in the background,
// but does not return until it started serving. | [
"AsyncStart",
"begins",
"a",
"Crossdock",
"client",
"in",
"the",
"background",
"but",
"does",
"not",
"return",
"until",
"it",
"started",
"serving",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/crossdock/client/client.go#L46-L58 | train |
jaegertracing/jaeger-client-go | crossdock/client/client.go | Listen | func (c *Client) Listen() error {
c.setDefaultPort(&c.ClientHostPort, ":"+common.DefaultClientPortHTTP)
c.setDefaultPort(&c.ServerPortHTTP, common.DefaultServerPortHTTP)
behaviors := crossdock.Behaviors{
behaviorTrace: c.trace,
}
http.Handle("/", crossdock.Handler(behaviors, true))
listener, err := net.Liste... | go | func (c *Client) Listen() error {
c.setDefaultPort(&c.ClientHostPort, ":"+common.DefaultClientPortHTTP)
c.setDefaultPort(&c.ServerPortHTTP, common.DefaultServerPortHTTP)
behaviors := crossdock.Behaviors{
behaviorTrace: c.trace,
}
http.Handle("/", crossdock.Handler(behaviors, true))
listener, err := net.Liste... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Listen",
"(",
")",
"error",
"{",
"c",
".",
"setDefaultPort",
"(",
"&",
"c",
".",
"ClientHostPort",
",",
"\"",
"\"",
"+",
"common",
".",
"DefaultClientPortHTTP",
")",
"\n",
"c",
".",
"setDefaultPort",
"(",
"&",
"... | // Listen initializes the server | [
"Listen",
"initializes",
"the",
"server"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/crossdock/client/client.go#L61-L78 | train |
jaegertracing/jaeger-client-go | zipkin_thrift_span.go | BuildZipkinThrift | func BuildZipkinThrift(s *Span) *z.Span {
span := &zipkinSpan{Span: s}
span.handleSpecialTags()
parentID := int64(span.context.parentID)
var ptrParentID *int64
if parentID != 0 {
ptrParentID = &parentID
}
traceIDHigh := int64(span.context.traceID.High)
var ptrTraceIDHigh *int64
if traceIDHigh != 0 {
ptrTra... | go | func BuildZipkinThrift(s *Span) *z.Span {
span := &zipkinSpan{Span: s}
span.handleSpecialTags()
parentID := int64(span.context.parentID)
var ptrParentID *int64
if parentID != 0 {
ptrParentID = &parentID
}
traceIDHigh := int64(span.context.traceID.High)
var ptrTraceIDHigh *int64
if traceIDHigh != 0 {
ptrTra... | [
"func",
"BuildZipkinThrift",
"(",
"s",
"*",
"Span",
")",
"*",
"z",
".",
"Span",
"{",
"span",
":=",
"&",
"zipkinSpan",
"{",
"Span",
":",
"s",
"}",
"\n",
"span",
".",
"handleSpecialTags",
"(",
")",
"\n",
"parentID",
":=",
"int64",
"(",
"span",
".",
"... | // BuildZipkinThrift builds thrift span based on internal span. | [
"BuildZipkinThrift",
"builds",
"thrift",
"span",
"based",
"on",
"internal",
"span",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/zipkin_thrift_span.go#L43-L73 | train |
jaegertracing/jaeger-client-go | zipkin_thrift_span.go | int32ToBytes | func int32ToBytes(i int32) []byte {
buf := make([]byte, 4)
binary.BigEndian.PutUint32(buf, uint32(i))
return buf
} | go | func int32ToBytes(i int32) []byte {
buf := make([]byte, 4)
binary.BigEndian.PutUint32(buf, uint32(i))
return buf
} | [
"func",
"int32ToBytes",
"(",
"i",
"int32",
")",
"[",
"]",
"byte",
"{",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"4",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint32",
"(",
"buf",
",",
"uint32",
"(",
"i",
")",
")",
"\n",
"return",
... | // int32ToBytes converts int32 to bytes. | [
"int32ToBytes",
"converts",
"int32",
"to",
"bytes",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/zipkin_thrift_span.go#L217-L221 | train |
jaegertracing/jaeger-client-go | zipkin_thrift_span.go | int64ToBytes | func int64ToBytes(i int64) []byte {
buf := make([]byte, 8)
binary.BigEndian.PutUint64(buf, uint64(i))
return buf
} | go | func int64ToBytes(i int64) []byte {
buf := make([]byte, 8)
binary.BigEndian.PutUint64(buf, uint64(i))
return buf
} | [
"func",
"int64ToBytes",
"(",
"i",
"int64",
")",
"[",
"]",
"byte",
"{",
"buf",
":=",
"make",
"(",
"[",
"]",
"byte",
",",
"8",
")",
"\n",
"binary",
".",
"BigEndian",
".",
"PutUint64",
"(",
"buf",
",",
"uint64",
"(",
"i",
")",
")",
"\n",
"return",
... | // int64ToBytes converts int64 to bytes. | [
"int64ToBytes",
"converts",
"int64",
"to",
"bytes",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/zipkin_thrift_span.go#L224-L228 | train |
jaegertracing/jaeger-client-go | propagation.go | NewTextMapPropagator | func NewTextMapPropagator(headerKeys *HeadersConfig, metrics Metrics) *TextMapPropagator {
return &TextMapPropagator{
headerKeys: headerKeys,
metrics: metrics,
encodeValue: func(val string) string {
return val
},
decodeValue: func(val string) string {
return val
},
}
} | go | func NewTextMapPropagator(headerKeys *HeadersConfig, metrics Metrics) *TextMapPropagator {
return &TextMapPropagator{
headerKeys: headerKeys,
metrics: metrics,
encodeValue: func(val string) string {
return val
},
decodeValue: func(val string) string {
return val
},
}
} | [
"func",
"NewTextMapPropagator",
"(",
"headerKeys",
"*",
"HeadersConfig",
",",
"metrics",
"Metrics",
")",
"*",
"TextMapPropagator",
"{",
"return",
"&",
"TextMapPropagator",
"{",
"headerKeys",
":",
"headerKeys",
",",
"metrics",
":",
"metrics",
",",
"encodeValue",
":... | // NewTextMapPropagator creates a combined Injector and Extractor for TextMap format | [
"NewTextMapPropagator",
"creates",
"a",
"combined",
"Injector",
"and",
"Extractor",
"for",
"TextMap",
"format"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/propagation.go#L63-L74 | train |
jaegertracing/jaeger-client-go | propagation.go | NewHTTPHeaderPropagator | func NewHTTPHeaderPropagator(headerKeys *HeadersConfig, metrics Metrics) *TextMapPropagator {
return &TextMapPropagator{
headerKeys: headerKeys,
metrics: metrics,
encodeValue: func(val string) string {
return url.QueryEscape(val)
},
decodeValue: func(val string) string {
// ignore decoding errors, c... | go | func NewHTTPHeaderPropagator(headerKeys *HeadersConfig, metrics Metrics) *TextMapPropagator {
return &TextMapPropagator{
headerKeys: headerKeys,
metrics: metrics,
encodeValue: func(val string) string {
return url.QueryEscape(val)
},
decodeValue: func(val string) string {
// ignore decoding errors, c... | [
"func",
"NewHTTPHeaderPropagator",
"(",
"headerKeys",
"*",
"HeadersConfig",
",",
"metrics",
"Metrics",
")",
"*",
"TextMapPropagator",
"{",
"return",
"&",
"TextMapPropagator",
"{",
"headerKeys",
":",
"headerKeys",
",",
"metrics",
":",
"metrics",
",",
"encodeValue",
... | // NewHTTPHeaderPropagator creates a combined Injector and Extractor for HTTPHeaders format | [
"NewHTTPHeaderPropagator",
"creates",
"a",
"combined",
"Injector",
"and",
"Extractor",
"for",
"HTTPHeaders",
"format"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/propagation.go#L77-L92 | train |
jaegertracing/jaeger-client-go | propagation.go | NewBinaryPropagator | func NewBinaryPropagator(tracer *Tracer) *BinaryPropagator {
return &BinaryPropagator{
tracer: tracer,
buffers: sync.Pool{New: func() interface{} { return &bytes.Buffer{} }},
}
} | go | func NewBinaryPropagator(tracer *Tracer) *BinaryPropagator {
return &BinaryPropagator{
tracer: tracer,
buffers: sync.Pool{New: func() interface{} { return &bytes.Buffer{} }},
}
} | [
"func",
"NewBinaryPropagator",
"(",
"tracer",
"*",
"Tracer",
")",
"*",
"BinaryPropagator",
"{",
"return",
"&",
"BinaryPropagator",
"{",
"tracer",
":",
"tracer",
",",
"buffers",
":",
"sync",
".",
"Pool",
"{",
"New",
":",
"func",
"(",
")",
"interface",
"{",
... | // NewBinaryPropagator creates a combined Injector and Extractor for Binary format | [
"NewBinaryPropagator",
"creates",
"a",
"combined",
"Injector",
"and",
"Extractor",
"for",
"Binary",
"format"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/propagation.go#L101-L106 | train |
jaegertracing/jaeger-client-go | propagation.go | Inject | func (p *TextMapPropagator) Inject(
sc SpanContext,
abstractCarrier interface{},
) error {
textMapWriter, ok := abstractCarrier.(opentracing.TextMapWriter)
if !ok {
return opentracing.ErrInvalidCarrier
}
// Do not encode the string with trace context to avoid accidental double-encoding
// if people are using ... | go | func (p *TextMapPropagator) Inject(
sc SpanContext,
abstractCarrier interface{},
) error {
textMapWriter, ok := abstractCarrier.(opentracing.TextMapWriter)
if !ok {
return opentracing.ErrInvalidCarrier
}
// Do not encode the string with trace context to avoid accidental double-encoding
// if people are using ... | [
"func",
"(",
"p",
"*",
"TextMapPropagator",
")",
"Inject",
"(",
"sc",
"SpanContext",
",",
"abstractCarrier",
"interface",
"{",
"}",
",",
")",
"error",
"{",
"textMapWriter",
",",
"ok",
":=",
"abstractCarrier",
".",
"(",
"opentracing",
".",
"TextMapWriter",
")... | // Inject implements Injector of TextMapPropagator | [
"Inject",
"implements",
"Injector",
"of",
"TextMapPropagator"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/propagation.go#L109-L128 | train |
jaegertracing/jaeger-client-go | propagation.go | Extract | func (p *TextMapPropagator) Extract(abstractCarrier interface{}) (SpanContext, error) {
textMapReader, ok := abstractCarrier.(opentracing.TextMapReader)
if !ok {
return emptyContext, opentracing.ErrInvalidCarrier
}
var ctx SpanContext
var baggage map[string]string
err := textMapReader.ForeachKey(func(rawKey, va... | go | func (p *TextMapPropagator) Extract(abstractCarrier interface{}) (SpanContext, error) {
textMapReader, ok := abstractCarrier.(opentracing.TextMapReader)
if !ok {
return emptyContext, opentracing.ErrInvalidCarrier
}
var ctx SpanContext
var baggage map[string]string
err := textMapReader.ForeachKey(func(rawKey, va... | [
"func",
"(",
"p",
"*",
"TextMapPropagator",
")",
"Extract",
"(",
"abstractCarrier",
"interface",
"{",
"}",
")",
"(",
"SpanContext",
",",
"error",
")",
"{",
"textMapReader",
",",
"ok",
":=",
"abstractCarrier",
".",
"(",
"opentracing",
".",
"TextMapReader",
")... | // Extract implements Extractor of TextMapPropagator | [
"Extract",
"implements",
"Extractor",
"of",
"TextMapPropagator"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/propagation.go#L131-L174 | train |
jaegertracing/jaeger-client-go | propagation.go | Inject | func (p *BinaryPropagator) Inject(
sc SpanContext,
abstractCarrier interface{},
) error {
carrier, ok := abstractCarrier.(io.Writer)
if !ok {
return opentracing.ErrInvalidCarrier
}
// Handle the tracer context
if err := binary.Write(carrier, binary.BigEndian, sc.traceID); err != nil {
return err
}
if err ... | go | func (p *BinaryPropagator) Inject(
sc SpanContext,
abstractCarrier interface{},
) error {
carrier, ok := abstractCarrier.(io.Writer)
if !ok {
return opentracing.ErrInvalidCarrier
}
// Handle the tracer context
if err := binary.Write(carrier, binary.BigEndian, sc.traceID); err != nil {
return err
}
if err ... | [
"func",
"(",
"p",
"*",
"BinaryPropagator",
")",
"Inject",
"(",
"sc",
"SpanContext",
",",
"abstractCarrier",
"interface",
"{",
"}",
",",
")",
"error",
"{",
"carrier",
",",
"ok",
":=",
"abstractCarrier",
".",
"(",
"io",
".",
"Writer",
")",
"\n",
"if",
"!... | // Inject implements Injector of BinaryPropagator | [
"Inject",
"implements",
"Injector",
"of",
"BinaryPropagator"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/propagation.go#L177-L216 | train |
jaegertracing/jaeger-client-go | propagation.go | Extract | func (p *BinaryPropagator) Extract(abstractCarrier interface{}) (SpanContext, error) {
carrier, ok := abstractCarrier.(io.Reader)
if !ok {
return emptyContext, opentracing.ErrInvalidCarrier
}
var ctx SpanContext
if err := binary.Read(carrier, binary.BigEndian, &ctx.traceID); err != nil {
return emptyContext, ... | go | func (p *BinaryPropagator) Extract(abstractCarrier interface{}) (SpanContext, error) {
carrier, ok := abstractCarrier.(io.Reader)
if !ok {
return emptyContext, opentracing.ErrInvalidCarrier
}
var ctx SpanContext
if err := binary.Read(carrier, binary.BigEndian, &ctx.traceID); err != nil {
return emptyContext, ... | [
"func",
"(",
"p",
"*",
"BinaryPropagator",
")",
"Extract",
"(",
"abstractCarrier",
"interface",
"{",
"}",
")",
"(",
"SpanContext",
",",
"error",
")",
"{",
"carrier",
",",
"ok",
":=",
"abstractCarrier",
".",
"(",
"io",
".",
"Reader",
")",
"\n",
"if",
"!... | // Extract implements Extractor of BinaryPropagator | [
"Extract",
"implements",
"Extractor",
"of",
"BinaryPropagator"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/propagation.go#L219-L274 | train |
jaegertracing/jaeger-client-go | propagation.go | addBaggageKeyPrefix | func (p *TextMapPropagator) addBaggageKeyPrefix(key string) string {
// TODO encodeBaggageKeyAsHeader add caching and escaping
return fmt.Sprintf("%v%v", p.headerKeys.TraceBaggageHeaderPrefix, key)
} | go | func (p *TextMapPropagator) addBaggageKeyPrefix(key string) string {
// TODO encodeBaggageKeyAsHeader add caching and escaping
return fmt.Sprintf("%v%v", p.headerKeys.TraceBaggageHeaderPrefix, key)
} | [
"func",
"(",
"p",
"*",
"TextMapPropagator",
")",
"addBaggageKeyPrefix",
"(",
"key",
"string",
")",
"string",
"{",
"// TODO encodeBaggageKeyAsHeader add caching and escaping",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"headerKeys",
".",
"Trac... | // Converts a baggage item key into an http header format,
// by prepending TraceBaggageHeaderPrefix and encoding the key string | [
"Converts",
"a",
"baggage",
"item",
"key",
"into",
"an",
"http",
"header",
"format",
"by",
"prepending",
"TraceBaggageHeaderPrefix",
"and",
"encoding",
"the",
"key",
"string"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/propagation.go#L301-L304 | train |
jaegertracing/jaeger-client-go | config/options.go | Metrics | func Metrics(factory metrics.Factory) Option {
return func(c *Options) {
c.metrics = factory
}
} | go | func Metrics(factory metrics.Factory) Option {
return func(c *Options) {
c.metrics = factory
}
} | [
"func",
"Metrics",
"(",
"factory",
"metrics",
".",
"Factory",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Options",
")",
"{",
"c",
".",
"metrics",
"=",
"factory",
"\n",
"}",
"\n",
"}"
] | // Metrics creates an Option that initializes Metrics in the tracer,
// which is used to emit statistics about spans. | [
"Metrics",
"creates",
"an",
"Option",
"that",
"initializes",
"Metrics",
"in",
"the",
"tracer",
"which",
"is",
"used",
"to",
"emit",
"statistics",
"about",
"spans",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/config/options.go#L46-L50 | train |
jaegertracing/jaeger-client-go | config/options.go | Logger | func Logger(logger jaeger.Logger) Option {
return func(c *Options) {
c.logger = logger
}
} | go | func Logger(logger jaeger.Logger) Option {
return func(c *Options) {
c.logger = logger
}
} | [
"func",
"Logger",
"(",
"logger",
"jaeger",
".",
"Logger",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Options",
")",
"{",
"c",
".",
"logger",
"=",
"logger",
"\n",
"}",
"\n",
"}"
] | // Logger can be provided to log Reporter errors, as well as to log spans
// if Reporter.LogSpans is set to true. | [
"Logger",
"can",
"be",
"provided",
"to",
"log",
"Reporter",
"errors",
"as",
"well",
"as",
"to",
"log",
"spans",
"if",
"Reporter",
".",
"LogSpans",
"is",
"set",
"to",
"true",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/config/options.go#L54-L58 | train |
jaegertracing/jaeger-client-go | config/options.go | Sampler | func Sampler(sampler jaeger.Sampler) Option {
return func(c *Options) {
c.sampler = sampler
}
} | go | func Sampler(sampler jaeger.Sampler) Option {
return func(c *Options) {
c.sampler = sampler
}
} | [
"func",
"Sampler",
"(",
"sampler",
"jaeger",
".",
"Sampler",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Options",
")",
"{",
"c",
".",
"sampler",
"=",
"sampler",
"\n",
"}",
"\n",
"}"
] | // Sampler can be provided explicitly to override the configuration. | [
"Sampler",
"can",
"be",
"provided",
"explicitly",
"to",
"override",
"the",
"configuration",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/config/options.go#L69-L73 | train |
jaegertracing/jaeger-client-go | config/options.go | Observer | func Observer(observer jaeger.Observer) Option {
return func(c *Options) {
c.observers = append(c.observers, observer)
}
} | go | func Observer(observer jaeger.Observer) Option {
return func(c *Options) {
c.observers = append(c.observers, observer)
}
} | [
"func",
"Observer",
"(",
"observer",
"jaeger",
".",
"Observer",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Options",
")",
"{",
"c",
".",
"observers",
"=",
"append",
"(",
"c",
".",
"observers",
",",
"observer",
")",
"\n",
"}",
"\n",
"}"
] | // Observer can be registered with the Tracer to receive notifications about new Spans. | [
"Observer",
"can",
"be",
"registered",
"with",
"the",
"Tracer",
"to",
"receive",
"notifications",
"about",
"new",
"Spans",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/config/options.go#L76-L80 | train |
jaegertracing/jaeger-client-go | config/options.go | ContribObserver | func ContribObserver(observer jaeger.ContribObserver) Option {
return func(c *Options) {
c.contribObservers = append(c.contribObservers, observer)
}
} | go | func ContribObserver(observer jaeger.ContribObserver) Option {
return func(c *Options) {
c.contribObservers = append(c.contribObservers, observer)
}
} | [
"func",
"ContribObserver",
"(",
"observer",
"jaeger",
".",
"ContribObserver",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Options",
")",
"{",
"c",
".",
"contribObservers",
"=",
"append",
"(",
"c",
".",
"contribObservers",
",",
"observer",
")",
"\... | // ContribObserver can be registered with the Tracer to receive notifications
// about new spans. | [
"ContribObserver",
"can",
"be",
"registered",
"with",
"the",
"Tracer",
"to",
"receive",
"notifications",
"about",
"new",
"spans",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/config/options.go#L84-L88 | train |
jaegertracing/jaeger-client-go | config/options.go | Tag | func Tag(key string, value interface{}) Option {
return func(c *Options) {
c.tags = append(c.tags, opentracing.Tag{Key: key, Value: value})
}
} | go | func Tag(key string, value interface{}) Option {
return func(c *Options) {
c.tags = append(c.tags, opentracing.Tag{Key: key, Value: value})
}
} | [
"func",
"Tag",
"(",
"key",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Options",
")",
"{",
"c",
".",
"tags",
"=",
"append",
"(",
"c",
".",
"tags",
",",
"opentracing",
".",
"Tag",
"{",
"Key"... | // Tag creates an option that adds a tracer-level tag. | [
"Tag",
"creates",
"an",
"option",
"that",
"adds",
"a",
"tracer",
"-",
"level",
"tag",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/config/options.go#L121-L125 | train |
jaegertracing/jaeger-client-go | config/options.go | Injector | func Injector(format interface{}, injector jaeger.Injector) Option {
return func(c *Options) {
c.injectors[format] = injector
}
} | go | func Injector(format interface{}, injector jaeger.Injector) Option {
return func(c *Options) {
c.injectors[format] = injector
}
} | [
"func",
"Injector",
"(",
"format",
"interface",
"{",
"}",
",",
"injector",
"jaeger",
".",
"Injector",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Options",
")",
"{",
"c",
".",
"injectors",
"[",
"format",
"]",
"=",
"injector",
"\n",
"}",
"\n... | // Injector registers an Injector with the given format. | [
"Injector",
"registers",
"an",
"Injector",
"with",
"the",
"given",
"format",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/config/options.go#L128-L132 | train |
jaegertracing/jaeger-client-go | config/options.go | Extractor | func Extractor(format interface{}, extractor jaeger.Extractor) Option {
return func(c *Options) {
c.extractors[format] = extractor
}
} | go | func Extractor(format interface{}, extractor jaeger.Extractor) Option {
return func(c *Options) {
c.extractors[format] = extractor
}
} | [
"func",
"Extractor",
"(",
"format",
"interface",
"{",
"}",
",",
"extractor",
"jaeger",
".",
"Extractor",
")",
"Option",
"{",
"return",
"func",
"(",
"c",
"*",
"Options",
")",
"{",
"c",
".",
"extractors",
"[",
"format",
"]",
"=",
"extractor",
"\n",
"}",
... | // Extractor registers an Extractor with the given format. | [
"Extractor",
"registers",
"an",
"Extractor",
"with",
"the",
"given",
"format",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/config/options.go#L135-L139 | train |
jaegertracing/jaeger-client-go | span.go | SetOperationName | func (s *Span) SetOperationName(operationName string) opentracing.Span {
s.Lock()
defer s.Unlock()
if s.context.IsSampled() {
s.operationName = operationName
}
s.observer.OnSetOperationName(operationName)
return s
} | go | func (s *Span) SetOperationName(operationName string) opentracing.Span {
s.Lock()
defer s.Unlock()
if s.context.IsSampled() {
s.operationName = operationName
}
s.observer.OnSetOperationName(operationName)
return s
} | [
"func",
"(",
"s",
"*",
"Span",
")",
"SetOperationName",
"(",
"operationName",
"string",
")",
"opentracing",
".",
"Span",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"s",
".",
"context",
".",
"IsSampled",
... | // SetOperationName sets or changes the operation name. | [
"SetOperationName",
"sets",
"or",
"changes",
"the",
"operation",
"name",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L75-L83 | train |
jaegertracing/jaeger-client-go | span.go | LogFields | func (s *Span) LogFields(fields ...log.Field) {
s.Lock()
defer s.Unlock()
if !s.context.IsSampled() {
return
}
s.logFieldsNoLocking(fields...)
} | go | func (s *Span) LogFields(fields ...log.Field) {
s.Lock()
defer s.Unlock()
if !s.context.IsSampled() {
return
}
s.logFieldsNoLocking(fields...)
} | [
"func",
"(",
"s",
"*",
"Span",
")",
"LogFields",
"(",
"fields",
"...",
"log",
".",
"Field",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"!",
"s",
".",
"context",
".",
"IsSampled",
"(",
")",
"... | // LogFields implements opentracing.Span API | [
"LogFields",
"implements",
"opentracing",
".",
"Span",
"API"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L104-L111 | train |
jaegertracing/jaeger-client-go | span.go | LogKV | func (s *Span) LogKV(alternatingKeyValues ...interface{}) {
s.RLock()
sampled := s.context.IsSampled()
s.RUnlock()
if !sampled {
return
}
fields, err := log.InterleavedKVToFields(alternatingKeyValues...)
if err != nil {
s.LogFields(log.Error(err), log.String("function", "LogKV"))
return
}
s.LogFields(fie... | go | func (s *Span) LogKV(alternatingKeyValues ...interface{}) {
s.RLock()
sampled := s.context.IsSampled()
s.RUnlock()
if !sampled {
return
}
fields, err := log.InterleavedKVToFields(alternatingKeyValues...)
if err != nil {
s.LogFields(log.Error(err), log.String("function", "LogKV"))
return
}
s.LogFields(fie... | [
"func",
"(",
"s",
"*",
"Span",
")",
"LogKV",
"(",
"alternatingKeyValues",
"...",
"interface",
"{",
"}",
")",
"{",
"s",
".",
"RLock",
"(",
")",
"\n",
"sampled",
":=",
"s",
".",
"context",
".",
"IsSampled",
"(",
")",
"\n",
"s",
".",
"RUnlock",
"(",
... | // LogKV implements opentracing.Span API | [
"LogKV",
"implements",
"opentracing",
".",
"Span",
"API"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L123-L136 | train |
jaegertracing/jaeger-client-go | span.go | Log | func (s *Span) Log(ld opentracing.LogData) {
s.Lock()
defer s.Unlock()
if s.context.IsSampled() {
if ld.Timestamp.IsZero() {
ld.Timestamp = s.tracer.timeNow()
}
s.appendLog(ld.ToLogRecord())
}
} | go | func (s *Span) Log(ld opentracing.LogData) {
s.Lock()
defer s.Unlock()
if s.context.IsSampled() {
if ld.Timestamp.IsZero() {
ld.Timestamp = s.tracer.timeNow()
}
s.appendLog(ld.ToLogRecord())
}
} | [
"func",
"(",
"s",
"*",
"Span",
")",
"Log",
"(",
"ld",
"opentracing",
".",
"LogData",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"if",
"s",
".",
"context",
".",
"IsSampled",
"(",
")",
"{",
"if",
"l... | // Log implements opentracing.Span API | [
"Log",
"implements",
"opentracing",
".",
"Span",
"API"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L149-L158 | train |
jaegertracing/jaeger-client-go | span.go | FinishWithOptions | func (s *Span) FinishWithOptions(options opentracing.FinishOptions) {
if options.FinishTime.IsZero() {
options.FinishTime = s.tracer.timeNow()
}
s.observer.OnFinish(options)
s.Lock()
if s.context.IsSampled() {
s.duration = options.FinishTime.Sub(s.startTime)
// Note: bulk logs are not subject to maxLogsPerSp... | go | func (s *Span) FinishWithOptions(options opentracing.FinishOptions) {
if options.FinishTime.IsZero() {
options.FinishTime = s.tracer.timeNow()
}
s.observer.OnFinish(options)
s.Lock()
if s.context.IsSampled() {
s.duration = options.FinishTime.Sub(s.startTime)
// Note: bulk logs are not subject to maxLogsPerSp... | [
"func",
"(",
"s",
"*",
"Span",
")",
"FinishWithOptions",
"(",
"options",
"opentracing",
".",
"FinishOptions",
")",
"{",
"if",
"options",
".",
"FinishTime",
".",
"IsZero",
"(",
")",
"{",
"options",
".",
"FinishTime",
"=",
"s",
".",
"tracer",
".",
"timeNow... | // FinishWithOptions implements opentracing.Span API | [
"FinishWithOptions",
"implements",
"opentracing",
".",
"Span",
"API"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L189-L209 | train |
jaegertracing/jaeger-client-go | span.go | Context | func (s *Span) Context() opentracing.SpanContext {
s.Lock()
defer s.Unlock()
return s.context
} | go | func (s *Span) Context() opentracing.SpanContext {
s.Lock()
defer s.Unlock()
return s.context
} | [
"func",
"(",
"s",
"*",
"Span",
")",
"Context",
"(",
")",
"opentracing",
".",
"SpanContext",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n",
"return",
"s",
".",
"context",
"\n",
"}"
] | // Context implements opentracing.Span API | [
"Context",
"implements",
"opentracing",
".",
"Span",
"API"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L212-L216 | train |
jaegertracing/jaeger-client-go | span.go | OperationName | func (s *Span) OperationName() string {
s.RLock()
defer s.RUnlock()
return s.operationName
} | go | func (s *Span) OperationName() string {
s.RLock()
defer s.RUnlock()
return s.operationName
} | [
"func",
"(",
"s",
"*",
"Span",
")",
"OperationName",
"(",
")",
"string",
"{",
"s",
".",
"RLock",
"(",
")",
"\n",
"defer",
"s",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"s",
".",
"operationName",
"\n",
"}"
] | // OperationName allows retrieving current operation name. | [
"OperationName",
"allows",
"retrieving",
"current",
"operation",
"name",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L230-L234 | train |
jaegertracing/jaeger-client-go | span.go | Release | func (s *Span) Release() {
if atomic.AddInt32(&s.referenceCounter, -1) == -1 {
s.tracer.spanAllocator.Put(s)
}
} | go | func (s *Span) Release() {
if atomic.AddInt32(&s.referenceCounter, -1) == -1 {
s.tracer.spanAllocator.Put(s)
}
} | [
"func",
"(",
"s",
"*",
"Span",
")",
"Release",
"(",
")",
"{",
"if",
"atomic",
".",
"AddInt32",
"(",
"&",
"s",
".",
"referenceCounter",
",",
"-",
"1",
")",
"==",
"-",
"1",
"{",
"s",
".",
"tracer",
".",
"spanAllocator",
".",
"Put",
"(",
"s",
")",... | // Release decrements object counter and return to the
// allocator manager when counter will below zero | [
"Release",
"decrements",
"object",
"counter",
"and",
"return",
"to",
"the",
"allocator",
"manager",
"when",
"counter",
"will",
"below",
"zero"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L244-L248 | train |
jaegertracing/jaeger-client-go | span.go | reset | func (s *Span) reset() {
s.firstInProcess = false
s.context = emptyContext
s.operationName = ""
s.tracer = nil
s.startTime = time.Time{}
s.duration = 0
s.observer = nil
atomic.StoreInt32(&s.referenceCounter, 0)
// Note: To reuse memory we can save the pointers on the heap
s.tags = s.tags[:0]
s.logs = s.logs... | go | func (s *Span) reset() {
s.firstInProcess = false
s.context = emptyContext
s.operationName = ""
s.tracer = nil
s.startTime = time.Time{}
s.duration = 0
s.observer = nil
atomic.StoreInt32(&s.referenceCounter, 0)
// Note: To reuse memory we can save the pointers on the heap
s.tags = s.tags[:0]
s.logs = s.logs... | [
"func",
"(",
"s",
"*",
"Span",
")",
"reset",
"(",
")",
"{",
"s",
".",
"firstInProcess",
"=",
"false",
"\n",
"s",
".",
"context",
"=",
"emptyContext",
"\n",
"s",
".",
"operationName",
"=",
"\"",
"\"",
"\n",
"s",
".",
"tracer",
"=",
"nil",
"\n",
"s... | // reset span state and release unused data | [
"reset",
"span",
"state",
"and",
"release",
"unused",
"data"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L251-L265 | train |
jaegertracing/jaeger-client-go | span.go | setSamplingPriority | func setSamplingPriority(s *Span, value interface{}) bool {
val, ok := value.(uint16)
if !ok {
return false
}
s.Lock()
defer s.Unlock()
if val == 0 {
s.context.flags = s.context.flags & (^flagSampled)
return true
}
if s.tracer.isDebugAllowed(s.operationName) {
s.context.flags = s.context.flags | flagDeb... | go | func setSamplingPriority(s *Span, value interface{}) bool {
val, ok := value.(uint16)
if !ok {
return false
}
s.Lock()
defer s.Unlock()
if val == 0 {
s.context.flags = s.context.flags & (^flagSampled)
return true
}
if s.tracer.isDebugAllowed(s.operationName) {
s.context.flags = s.context.flags | flagDeb... | [
"func",
"setSamplingPriority",
"(",
"s",
"*",
"Span",
",",
"value",
"interface",
"{",
"}",
")",
"bool",
"{",
"val",
",",
"ok",
":=",
"value",
".",
"(",
"uint16",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"s",
".",
"Lock... | // setSamplingPriority returns true if the flag was updated successfully, false otherwise. | [
"setSamplingPriority",
"returns",
"true",
"if",
"the",
"flag",
"was",
"updated",
"successfully",
"false",
"otherwise",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/span.go#L272-L288 | train |
jaegertracing/jaeger-client-go | jaeger_thrift_span.go | BuildJaegerThrift | func BuildJaegerThrift(span *Span) *j.Span {
span.Lock()
defer span.Unlock()
startTime := utils.TimeToMicrosecondsSinceEpochInt64(span.startTime)
duration := span.duration.Nanoseconds() / int64(time.Microsecond)
jaegerSpan := &j.Span{
TraceIdLow: int64(span.context.traceID.Low),
TraceIdHigh: int64(span.co... | go | func BuildJaegerThrift(span *Span) *j.Span {
span.Lock()
defer span.Unlock()
startTime := utils.TimeToMicrosecondsSinceEpochInt64(span.startTime)
duration := span.duration.Nanoseconds() / int64(time.Microsecond)
jaegerSpan := &j.Span{
TraceIdLow: int64(span.context.traceID.Low),
TraceIdHigh: int64(span.co... | [
"func",
"BuildJaegerThrift",
"(",
"span",
"*",
"Span",
")",
"*",
"j",
".",
"Span",
"{",
"span",
".",
"Lock",
"(",
")",
"\n",
"defer",
"span",
".",
"Unlock",
"(",
")",
"\n",
"startTime",
":=",
"utils",
".",
"TimeToMicrosecondsSinceEpochInt64",
"(",
"span"... | // BuildJaegerThrift builds jaeger span based on internal span. | [
"BuildJaegerThrift",
"builds",
"jaeger",
"span",
"based",
"on",
"internal",
"span",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/jaeger_thrift_span.go#L27-L46 | train |
jaegertracing/jaeger-client-go | jaeger_thrift_span.go | BuildJaegerProcessThrift | func BuildJaegerProcessThrift(span *Span) *j.Process {
span.Lock()
defer span.Unlock()
return buildJaegerProcessThrift(span.tracer)
} | go | func BuildJaegerProcessThrift(span *Span) *j.Process {
span.Lock()
defer span.Unlock()
return buildJaegerProcessThrift(span.tracer)
} | [
"func",
"BuildJaegerProcessThrift",
"(",
"span",
"*",
"Span",
")",
"*",
"j",
".",
"Process",
"{",
"span",
".",
"Lock",
"(",
")",
"\n",
"defer",
"span",
".",
"Unlock",
"(",
")",
"\n",
"return",
"buildJaegerProcessThrift",
"(",
"span",
".",
"tracer",
")",
... | // BuildJaegerProcessThrift creates a thrift Process type. | [
"BuildJaegerProcessThrift",
"creates",
"a",
"thrift",
"Process",
"type",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/jaeger_thrift_span.go#L49-L53 | train |
jaegertracing/jaeger-client-go | zipkin/propagation.go | NewZipkinB3HTTPHeaderPropagator | func NewZipkinB3HTTPHeaderPropagator(opts ...Option) Propagator {
p := Propagator{baggagePrefix: "baggage-"}
for _, opt := range opts {
opt(&p)
}
return p
} | go | func NewZipkinB3HTTPHeaderPropagator(opts ...Option) Propagator {
p := Propagator{baggagePrefix: "baggage-"}
for _, opt := range opts {
opt(&p)
}
return p
} | [
"func",
"NewZipkinB3HTTPHeaderPropagator",
"(",
"opts",
"...",
"Option",
")",
"Propagator",
"{",
"p",
":=",
"Propagator",
"{",
"baggagePrefix",
":",
"\"",
"\"",
"}",
"\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
"(",
"&",
"p",
")",
"... | // NewZipkinB3HTTPHeaderPropagator creates a Propagator for extracting and injecting
// Zipkin HTTP B3 headers into SpanContexts. Baggage is by default enabled and uses prefix
// 'baggage-'. | [
"NewZipkinB3HTTPHeaderPropagator",
"creates",
"a",
"Propagator",
"for",
"extracting",
"and",
"injecting",
"Zipkin",
"HTTP",
"B3",
"headers",
"into",
"SpanContexts",
".",
"Baggage",
"is",
"by",
"default",
"enabled",
"and",
"uses",
"prefix",
"baggage",
"-",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/zipkin/propagation.go#L44-L50 | train |
jaegertracing/jaeger-client-go | zipkin/propagation.go | Inject | func (p Propagator) Inject(
sc jaeger.SpanContext,
abstractCarrier interface{},
) error {
textMapWriter, ok := abstractCarrier.(opentracing.TextMapWriter)
if !ok {
return opentracing.ErrInvalidCarrier
}
textMapWriter.Set("x-b3-traceid", sc.TraceID().String())
if sc.ParentID() != 0 {
textMapWriter.Set("x-b3-... | go | func (p Propagator) Inject(
sc jaeger.SpanContext,
abstractCarrier interface{},
) error {
textMapWriter, ok := abstractCarrier.(opentracing.TextMapWriter)
if !ok {
return opentracing.ErrInvalidCarrier
}
textMapWriter.Set("x-b3-traceid", sc.TraceID().String())
if sc.ParentID() != 0 {
textMapWriter.Set("x-b3-... | [
"func",
"(",
"p",
"Propagator",
")",
"Inject",
"(",
"sc",
"jaeger",
".",
"SpanContext",
",",
"abstractCarrier",
"interface",
"{",
"}",
",",
")",
"error",
"{",
"textMapWriter",
",",
"ok",
":=",
"abstractCarrier",
".",
"(",
"opentracing",
".",
"TextMapWriter",... | // Inject conforms to the Injector interface for decoding Zipkin HTTP B3 headers | [
"Inject",
"conforms",
"to",
"the",
"Injector",
"interface",
"for",
"decoding",
"Zipkin",
"HTTP",
"B3",
"headers"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/zipkin/propagation.go#L53-L77 | train |
jaegertracing/jaeger-client-go | zipkin/propagation.go | Extract | func (p Propagator) Extract(abstractCarrier interface{}) (jaeger.SpanContext, error) {
textMapReader, ok := abstractCarrier.(opentracing.TextMapReader)
if !ok {
return jaeger.SpanContext{}, opentracing.ErrInvalidCarrier
}
var traceID jaeger.TraceID
var spanID uint64
var parentID uint64
sampled := false
var ba... | go | func (p Propagator) Extract(abstractCarrier interface{}) (jaeger.SpanContext, error) {
textMapReader, ok := abstractCarrier.(opentracing.TextMapReader)
if !ok {
return jaeger.SpanContext{}, opentracing.ErrInvalidCarrier
}
var traceID jaeger.TraceID
var spanID uint64
var parentID uint64
sampled := false
var ba... | [
"func",
"(",
"p",
"Propagator",
")",
"Extract",
"(",
"abstractCarrier",
"interface",
"{",
"}",
")",
"(",
"jaeger",
".",
"SpanContext",
",",
"error",
")",
"{",
"textMapReader",
",",
"ok",
":=",
"abstractCarrier",
".",
"(",
"opentracing",
".",
"TextMapReader",... | // Extract conforms to the Extractor interface for encoding Zipkin HTTP B3 headers | [
"Extract",
"conforms",
"to",
"the",
"Extractor",
"interface",
"for",
"encoding",
"Zipkin",
"HTTP",
"B3",
"headers"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/zipkin/propagation.go#L80-L121 | train |
jaegertracing/jaeger-client-go | log/zap/field.go | Trace | func Trace(ctx context.Context) zapcore.Field {
if ctx == nil {
return zap.Skip()
}
return zap.Object("trace", trace{ctx})
} | go | func Trace(ctx context.Context) zapcore.Field {
if ctx == nil {
return zap.Skip()
}
return zap.Object("trace", trace{ctx})
} | [
"func",
"Trace",
"(",
"ctx",
"context",
".",
"Context",
")",
"zapcore",
".",
"Field",
"{",
"if",
"ctx",
"==",
"nil",
"{",
"return",
"zap",
".",
"Skip",
"(",
")",
"\n",
"}",
"\n",
"return",
"zap",
".",
"Object",
"(",
"\"",
"\"",
",",
"trace",
"{",... | // Trace creates a field that extracts tracing information from a context and
// includes it under the "trace" key.
//
// Because the opentracing APIs don't expose this information, the returned
// zap.Field is a no-op for contexts that don't contain a span or contain a
// non-Jaeger span. | [
"Trace",
"creates",
"a",
"field",
"that",
"extracts",
"tracing",
"information",
"from",
"a",
"context",
"and",
"includes",
"it",
"under",
"the",
"trace",
"key",
".",
"Because",
"the",
"opentracing",
"APIs",
"don",
"t",
"expose",
"this",
"information",
"the",
... | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/log/zap/field.go#L34-L39 | train |
jaegertracing/jaeger-client-go | tracer_options.go | Metrics | func (tracerOptions) Metrics(m *Metrics) TracerOption {
return func(tracer *Tracer) {
tracer.metrics = *m
}
} | go | func (tracerOptions) Metrics(m *Metrics) TracerOption {
return func(tracer *Tracer) {
tracer.metrics = *m
}
} | [
"func",
"(",
"tracerOptions",
")",
"Metrics",
"(",
"m",
"*",
"Metrics",
")",
"TracerOption",
"{",
"return",
"func",
"(",
"tracer",
"*",
"Tracer",
")",
"{",
"tracer",
".",
"metrics",
"=",
"*",
"m",
"\n",
"}",
"\n",
"}"
] | // Metrics creates a TracerOption that initializes Metrics on the tracer,
// which is used to emit statistics. | [
"Metrics",
"creates",
"a",
"TracerOption",
"that",
"initializes",
"Metrics",
"on",
"the",
"tracer",
"which",
"is",
"used",
"to",
"emit",
"statistics",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/tracer_options.go#L36-L40 | train |
jaegertracing/jaeger-client-go | tracer_options.go | Logger | func (tracerOptions) Logger(logger Logger) TracerOption {
return func(tracer *Tracer) {
tracer.logger = logger
}
} | go | func (tracerOptions) Logger(logger Logger) TracerOption {
return func(tracer *Tracer) {
tracer.logger = logger
}
} | [
"func",
"(",
"tracerOptions",
")",
"Logger",
"(",
"logger",
"Logger",
")",
"TracerOption",
"{",
"return",
"func",
"(",
"tracer",
"*",
"Tracer",
")",
"{",
"tracer",
".",
"logger",
"=",
"logger",
"\n",
"}",
"\n",
"}"
] | // Logger creates a TracerOption that gives the tracer a Logger. | [
"Logger",
"creates",
"a",
"TracerOption",
"that",
"gives",
"the",
"tracer",
"a",
"Logger",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/tracer_options.go#L43-L47 | train |
jaegertracing/jaeger-client-go | tracer_options.go | TimeNow | func (tracerOptions) TimeNow(timeNow func() time.Time) TracerOption {
return func(tracer *Tracer) {
tracer.timeNow = timeNow
}
} | go | func (tracerOptions) TimeNow(timeNow func() time.Time) TracerOption {
return func(tracer *Tracer) {
tracer.timeNow = timeNow
}
} | [
"func",
"(",
"tracerOptions",
")",
"TimeNow",
"(",
"timeNow",
"func",
"(",
")",
"time",
".",
"Time",
")",
"TracerOption",
"{",
"return",
"func",
"(",
"tracer",
"*",
"Tracer",
")",
"{",
"tracer",
".",
"timeNow",
"=",
"timeNow",
"\n",
"}",
"\n",
"}"
] | // TimeNow creates a TracerOption that gives the tracer a function
// used to generate timestamps for spans. | [
"TimeNow",
"creates",
"a",
"TracerOption",
"that",
"gives",
"the",
"tracer",
"a",
"function",
"used",
"to",
"generate",
"timestamps",
"for",
"spans",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/tracer_options.go#L64-L68 | train |
jaegertracing/jaeger-client-go | tracer_options.go | RandomNumber | func (tracerOptions) RandomNumber(randomNumber func() uint64) TracerOption {
return func(tracer *Tracer) {
tracer.randomNumber = randomNumber
}
} | go | func (tracerOptions) RandomNumber(randomNumber func() uint64) TracerOption {
return func(tracer *Tracer) {
tracer.randomNumber = randomNumber
}
} | [
"func",
"(",
"tracerOptions",
")",
"RandomNumber",
"(",
"randomNumber",
"func",
"(",
")",
"uint64",
")",
"TracerOption",
"{",
"return",
"func",
"(",
"tracer",
"*",
"Tracer",
")",
"{",
"tracer",
".",
"randomNumber",
"=",
"randomNumber",
"\n",
"}",
"\n",
"}"... | // RandomNumber creates a TracerOption that gives the tracer
// a thread-safe random number generator function for generating trace IDs. | [
"RandomNumber",
"creates",
"a",
"TracerOption",
"that",
"gives",
"the",
"tracer",
"a",
"thread",
"-",
"safe",
"random",
"number",
"generator",
"function",
"for",
"generating",
"trace",
"IDs",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/tracer_options.go#L72-L76 | train |
jaegertracing/jaeger-client-go | tracer_options.go | PoolSpans | func (tracerOptions) PoolSpans(poolSpans bool) TracerOption {
return func(tracer *Tracer) {
if poolSpans {
tracer.spanAllocator = newSyncPollSpanAllocator()
} else {
tracer.spanAllocator = simpleSpanAllocator{}
}
}
} | go | func (tracerOptions) PoolSpans(poolSpans bool) TracerOption {
return func(tracer *Tracer) {
if poolSpans {
tracer.spanAllocator = newSyncPollSpanAllocator()
} else {
tracer.spanAllocator = simpleSpanAllocator{}
}
}
} | [
"func",
"(",
"tracerOptions",
")",
"PoolSpans",
"(",
"poolSpans",
"bool",
")",
"TracerOption",
"{",
"return",
"func",
"(",
"tracer",
"*",
"Tracer",
")",
"{",
"if",
"poolSpans",
"{",
"tracer",
".",
"spanAllocator",
"=",
"newSyncPollSpanAllocator",
"(",
")",
"... | // PoolSpans creates a TracerOption that tells the tracer whether it should use
// an object pool to minimize span allocations.
// This should be used with care, only if the service is not running any async tasks
// that can access parent spans after those spans have been finished. | [
"PoolSpans",
"creates",
"a",
"TracerOption",
"that",
"tells",
"the",
"tracer",
"whether",
"it",
"should",
"use",
"an",
"object",
"pool",
"to",
"minimize",
"span",
"allocations",
".",
"This",
"should",
"be",
"used",
"with",
"care",
"only",
"if",
"the",
"servi... | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/tracer_options.go#L82-L90 | train |
jaegertracing/jaeger-client-go | crossdock/endtoend/handler.go | NewHandler | func NewHandler(agentHostPort string, samplingServerURL string) *Handler {
return &Handler{
agentHostPort: agentHostPort,
samplingServerURL: samplingServerURL,
tracers: make(map[string]opentracing.Tracer),
}
} | go | func NewHandler(agentHostPort string, samplingServerURL string) *Handler {
return &Handler{
agentHostPort: agentHostPort,
samplingServerURL: samplingServerURL,
tracers: make(map[string]opentracing.Tracer),
}
} | [
"func",
"NewHandler",
"(",
"agentHostPort",
"string",
",",
"samplingServerURL",
"string",
")",
"*",
"Handler",
"{",
"return",
"&",
"Handler",
"{",
"agentHostPort",
":",
"agentHostPort",
",",
"samplingServerURL",
":",
"samplingServerURL",
",",
"tracers",
":",
"make... | // NewHandler returns a Handler. | [
"NewHandler",
"returns",
"a",
"Handler",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/crossdock/endtoend/handler.go#L86-L92 | train |
jaegertracing/jaeger-client-go | crossdock/endtoend/handler.go | init | func (h *Handler) init(cfg config.Configuration) error {
if cfg.Sampler != nil && cfg.Sampler.SamplingServerURL == "" {
cfg.Sampler.SamplingServerURL = h.samplingServerURL
}
if cfg.Reporter != nil && cfg.Reporter.LocalAgentHostPort == "" {
cfg.Reporter.LocalAgentHostPort = h.agentHostPort
}
tracer, _, err := c... | go | func (h *Handler) init(cfg config.Configuration) error {
if cfg.Sampler != nil && cfg.Sampler.SamplingServerURL == "" {
cfg.Sampler.SamplingServerURL = h.samplingServerURL
}
if cfg.Reporter != nil && cfg.Reporter.LocalAgentHostPort == "" {
cfg.Reporter.LocalAgentHostPort = h.agentHostPort
}
tracer, _, err := c... | [
"func",
"(",
"h",
"*",
"Handler",
")",
"init",
"(",
"cfg",
"config",
".",
"Configuration",
")",
"error",
"{",
"if",
"cfg",
".",
"Sampler",
"!=",
"nil",
"&&",
"cfg",
".",
"Sampler",
".",
"SamplingServerURL",
"==",
"\"",
"\"",
"{",
"cfg",
".",
"Sampler... | // init initializes the handler with a tracer | [
"init",
"initializes",
"the",
"handler",
"with",
"a",
"tracer"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/crossdock/endtoend/handler.go#L95-L108 | train |
jaegertracing/jaeger-client-go | crossdock/endtoend/handler.go | GenerateTraces | func (h *Handler) GenerateTraces(w http.ResponseWriter, r *http.Request) {
decoder := json.NewDecoder(r.Body)
var req traceRequest
if err := decoder.Decode(&req); err != nil {
http.Error(w, fmt.Sprintf("JSON payload is invalid: %s", err.Error()), http.StatusBadRequest)
return
}
tracer := h.getTracer(req.Type)
... | go | func (h *Handler) GenerateTraces(w http.ResponseWriter, r *http.Request) {
decoder := json.NewDecoder(r.Body)
var req traceRequest
if err := decoder.Decode(&req); err != nil {
http.Error(w, fmt.Sprintf("JSON payload is invalid: %s", err.Error()), http.StatusBadRequest)
return
}
tracer := h.getTracer(req.Type)
... | [
"func",
"(",
"h",
"*",
"Handler",
")",
"GenerateTraces",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"decoder",
":=",
"json",
".",
"NewDecoder",
"(",
"r",
".",
"Body",
")",
"\n",
"var",
"req",
"traceReque... | // GenerateTraces creates traces given the parameters in the request. | [
"GenerateTraces",
"creates",
"traces",
"given",
"the",
"parameters",
"in",
"the",
"request",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/crossdock/endtoend/handler.go#L129-L142 | train |
jaegertracing/jaeger-client-go | utils/http_json.go | GetJSON | func GetJSON(url string, out interface{}) error {
resp, err := http.Get(url)
if err != nil {
return err
}
return ReadJSON(resp, out)
} | go | func GetJSON(url string, out interface{}) error {
resp, err := http.Get(url)
if err != nil {
return err
}
return ReadJSON(resp, out)
} | [
"func",
"GetJSON",
"(",
"url",
"string",
",",
"out",
"interface",
"{",
"}",
")",
"error",
"{",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"url",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"ReadJS... | // GetJSON makes an HTTP call to the specified URL and parses the returned JSON into `out`. | [
"GetJSON",
"makes",
"an",
"HTTP",
"call",
"to",
"the",
"specified",
"URL",
"and",
"parses",
"the",
"returned",
"JSON",
"into",
"out",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/utils/http_json.go#L26-L32 | train |
jaegertracing/jaeger-client-go | utils/http_json.go | ReadJSON | func ReadJSON(resp *http.Response, out interface{}) error {
defer resp.Body.Close()
if resp.StatusCode >= 400 {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
return fmt.Errorf("StatusCode: %d, Body: %s", resp.StatusCode, body)
}
if out == nil {
io.Copy(ioutil.Discard, resp.Body... | go | func ReadJSON(resp *http.Response, out interface{}) error {
defer resp.Body.Close()
if resp.StatusCode >= 400 {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
return fmt.Errorf("StatusCode: %d, Body: %s", resp.StatusCode, body)
}
if out == nil {
io.Copy(ioutil.Discard, resp.Body... | [
"func",
"ReadJSON",
"(",
"resp",
"*",
"http",
".",
"Response",
",",
"out",
"interface",
"{",
"}",
")",
"error",
"{",
"defer",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"if",
"resp",
".",
"StatusCode",
">=",
"400",
"{",
"body",
",",
"err"... | // ReadJSON reads JSON from http.Response and parses it into `out` | [
"ReadJSON",
"reads",
"JSON",
"from",
"http",
".",
"Response",
"and",
"parses",
"it",
"into",
"out"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/utils/http_json.go#L35-L54 | train |
jaegertracing/jaeger-client-go | rpcmetrics/endpoints.go | normalize | func (n *normalizedEndpoints) normalize(name string) string {
n.mux.RLock()
norm, ok := n.names[name]
l := len(n.names)
n.mux.RUnlock()
if ok {
return norm
}
if l >= n.maxSize {
return ""
}
return n.normalizeWithLock(name)
} | go | func (n *normalizedEndpoints) normalize(name string) string {
n.mux.RLock()
norm, ok := n.names[name]
l := len(n.names)
n.mux.RUnlock()
if ok {
return norm
}
if l >= n.maxSize {
return ""
}
return n.normalizeWithLock(name)
} | [
"func",
"(",
"n",
"*",
"normalizedEndpoints",
")",
"normalize",
"(",
"name",
"string",
")",
"string",
"{",
"n",
".",
"mux",
".",
"RLock",
"(",
")",
"\n",
"norm",
",",
"ok",
":=",
"n",
".",
"names",
"[",
"name",
"]",
"\n",
"l",
":=",
"len",
"(",
... | // normalize looks up the name in the cache, if not found it uses normalizer
// to convert the name to a safe name. If called with more than maxSize unique
// names it returns "" for all other names beyond those already cached. | [
"normalize",
"looks",
"up",
"the",
"name",
"in",
"the",
"cache",
"if",
"not",
"found",
"it",
"uses",
"normalizer",
"to",
"convert",
"the",
"name",
"to",
"a",
"safe",
"name",
".",
"If",
"called",
"with",
"more",
"than",
"maxSize",
"unique",
"names",
"it",... | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/endpoints.go#L39-L51 | train |
jaegertracing/jaeger-client-go | reporter_options.go | QueueSize | func (reporterOptions) QueueSize(queueSize int) ReporterOption {
return func(r *reporterOptions) {
r.queueSize = queueSize
}
} | go | func (reporterOptions) QueueSize(queueSize int) ReporterOption {
return func(r *reporterOptions) {
r.queueSize = queueSize
}
} | [
"func",
"(",
"reporterOptions",
")",
"QueueSize",
"(",
"queueSize",
"int",
")",
"ReporterOption",
"{",
"return",
"func",
"(",
"r",
"*",
"reporterOptions",
")",
"{",
"r",
".",
"queueSize",
"=",
"queueSize",
"\n",
"}",
"\n",
"}"
] | // QueueSize creates a ReporterOption that sets the size of the internal queue where
// spans are stored before they are processed. | [
"QueueSize",
"creates",
"a",
"ReporterOption",
"that",
"sets",
"the",
"size",
"of",
"the",
"internal",
"queue",
"where",
"spans",
"are",
"stored",
"before",
"they",
"are",
"processed",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/reporter_options.go#L41-L45 | train |
jaegertracing/jaeger-client-go | reporter_options.go | Metrics | func (reporterOptions) Metrics(metrics *Metrics) ReporterOption {
return func(r *reporterOptions) {
r.metrics = metrics
}
} | go | func (reporterOptions) Metrics(metrics *Metrics) ReporterOption {
return func(r *reporterOptions) {
r.metrics = metrics
}
} | [
"func",
"(",
"reporterOptions",
")",
"Metrics",
"(",
"metrics",
"*",
"Metrics",
")",
"ReporterOption",
"{",
"return",
"func",
"(",
"r",
"*",
"reporterOptions",
")",
"{",
"r",
".",
"metrics",
"=",
"metrics",
"\n",
"}",
"\n",
"}"
] | // Metrics creates a ReporterOption that initializes Metrics in the reporter,
// which is used to record runtime statistics. | [
"Metrics",
"creates",
"a",
"ReporterOption",
"that",
"initializes",
"Metrics",
"in",
"the",
"reporter",
"which",
"is",
"used",
"to",
"record",
"runtime",
"statistics",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/reporter_options.go#L49-L53 | train |
jaegertracing/jaeger-client-go | reporter_options.go | BufferFlushInterval | func (reporterOptions) BufferFlushInterval(bufferFlushInterval time.Duration) ReporterOption {
return func(r *reporterOptions) {
r.bufferFlushInterval = bufferFlushInterval
}
} | go | func (reporterOptions) BufferFlushInterval(bufferFlushInterval time.Duration) ReporterOption {
return func(r *reporterOptions) {
r.bufferFlushInterval = bufferFlushInterval
}
} | [
"func",
"(",
"reporterOptions",
")",
"BufferFlushInterval",
"(",
"bufferFlushInterval",
"time",
".",
"Duration",
")",
"ReporterOption",
"{",
"return",
"func",
"(",
"r",
"*",
"reporterOptions",
")",
"{",
"r",
".",
"bufferFlushInterval",
"=",
"bufferFlushInterval",
... | // BufferFlushInterval creates a ReporterOption that sets how often the queue
// is force-flushed. | [
"BufferFlushInterval",
"creates",
"a",
"ReporterOption",
"that",
"sets",
"how",
"often",
"the",
"queue",
"is",
"force",
"-",
"flushed",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/reporter_options.go#L57-L61 | train |
jaegertracing/jaeger-client-go | reporter_options.go | Logger | func (reporterOptions) Logger(logger Logger) ReporterOption {
return func(r *reporterOptions) {
r.logger = logger
}
} | go | func (reporterOptions) Logger(logger Logger) ReporterOption {
return func(r *reporterOptions) {
r.logger = logger
}
} | [
"func",
"(",
"reporterOptions",
")",
"Logger",
"(",
"logger",
"Logger",
")",
"ReporterOption",
"{",
"return",
"func",
"(",
"r",
"*",
"reporterOptions",
")",
"{",
"r",
".",
"logger",
"=",
"logger",
"\n",
"}",
"\n",
"}"
] | // Logger creates a ReporterOption that initializes the logger used to log
// errors of span submissions. | [
"Logger",
"creates",
"a",
"ReporterOption",
"that",
"initializes",
"the",
"logger",
"used",
"to",
"log",
"errors",
"of",
"span",
"submissions",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/reporter_options.go#L65-L69 | train |
jaegertracing/jaeger-client-go | crossdock/server/server.go | Start | func (s *Server) Start() error {
if s.HostPortHTTP == "" {
s.HostPortHTTP = ":" + common.DefaultServerPortHTTP
}
s.eHandler = endtoend.NewHandler(s.AgentHostPort, s.SamplingServerURL)
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { return }) // health check
mux.Han... | go | func (s *Server) Start() error {
if s.HostPortHTTP == "" {
s.HostPortHTTP = ":" + common.DefaultServerPortHTTP
}
s.eHandler = endtoend.NewHandler(s.AgentHostPort, s.SamplingServerURL)
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { return }) // health check
mux.Han... | [
"func",
"(",
"s",
"*",
"Server",
")",
"Start",
"(",
")",
"error",
"{",
"if",
"s",
".",
"HostPortHTTP",
"==",
"\"",
"\"",
"{",
"s",
".",
"HostPortHTTP",
"=",
"\"",
"\"",
"+",
"common",
".",
"DefaultServerPortHTTP",
"\n",
"}",
"\n\n",
"s",
".",
"eHan... | // Start starts the test server called by the Client and other upstream servers. | [
"Start",
"starts",
"the",
"test",
"server",
"called",
"by",
"the",
"Client",
"and",
"other",
"upstream",
"servers",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/crossdock/server/server.go#L47-L88 | train |
jaegertracing/jaeger-client-go | crossdock/server/server.go | GetPortHTTP | func (s *Server) GetPortHTTP() string {
hostPort := s.HostPortHTTP
hostPortSplit := strings.Split(hostPort, ":")
port := hostPortSplit[len(hostPortSplit)-1]
return port
} | go | func (s *Server) GetPortHTTP() string {
hostPort := s.HostPortHTTP
hostPortSplit := strings.Split(hostPort, ":")
port := hostPortSplit[len(hostPortSplit)-1]
return port
} | [
"func",
"(",
"s",
"*",
"Server",
")",
"GetPortHTTP",
"(",
")",
"string",
"{",
"hostPort",
":=",
"s",
".",
"HostPortHTTP",
"\n",
"hostPortSplit",
":=",
"strings",
".",
"Split",
"(",
"hostPort",
",",
"\"",
"\"",
")",
"\n",
"port",
":=",
"hostPortSplit",
... | // GetPortHTTP returns the network port the server listens to. | [
"GetPortHTTP",
"returns",
"the",
"network",
"port",
"the",
"server",
"listens",
"to",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/crossdock/server/server.go#L101-L106 | train |
jaegertracing/jaeger-client-go | rpcmetrics/normalizer.go | IsSafe | func (r *Range) IsSafe(c byte) bool {
return c >= r.From && c <= r.To
} | go | func (r *Range) IsSafe(c byte) bool {
return c >= r.From && c <= r.To
} | [
"func",
"(",
"r",
"*",
"Range",
")",
"IsSafe",
"(",
"c",
"byte",
")",
"bool",
"{",
"return",
"c",
">=",
"r",
".",
"From",
"&&",
"c",
"<=",
"r",
".",
"To",
"\n",
"}"
] | // IsSafe implements SafeCharacterSet | [
"IsSafe",
"implements",
"SafeCharacterSet"
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/normalizer.go#L55-L57 | train |
jaegertracing/jaeger-client-go | rpcmetrics/normalizer.go | Normalize | func (n *SimpleNameNormalizer) Normalize(name string) string {
var retMe []byte
nameBytes := []byte(name)
for i, b := range nameBytes {
if n.safeByte(b) {
if retMe != nil {
retMe[i] = b
}
} else {
if retMe == nil {
retMe = make([]byte, len(nameBytes))
copy(retMe[0:i], nameBytes[0:i])
}
... | go | func (n *SimpleNameNormalizer) Normalize(name string) string {
var retMe []byte
nameBytes := []byte(name)
for i, b := range nameBytes {
if n.safeByte(b) {
if retMe != nil {
retMe[i] = b
}
} else {
if retMe == nil {
retMe = make([]byte, len(nameBytes))
copy(retMe[0:i], nameBytes[0:i])
}
... | [
"func",
"(",
"n",
"*",
"SimpleNameNormalizer",
")",
"Normalize",
"(",
"name",
"string",
")",
"string",
"{",
"var",
"retMe",
"[",
"]",
"byte",
"\n",
"nameBytes",
":=",
"[",
"]",
"byte",
"(",
"name",
")",
"\n",
"for",
"i",
",",
"b",
":=",
"range",
"n... | // Normalize checks each character in the string against SafeSets,
// and if it's not safe substitutes it with Replacement. | [
"Normalize",
"checks",
"each",
"character",
"in",
"the",
"string",
"against",
"SafeSets",
"and",
"if",
"it",
"s",
"not",
"safe",
"substitutes",
"it",
"with",
"Replacement",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/normalizer.go#L71-L91 | train |
jaegertracing/jaeger-client-go | rpcmetrics/normalizer.go | safeByte | func (n *SimpleNameNormalizer) safeByte(b byte) bool {
for i := range n.SafeSets {
if n.SafeSets[i].IsSafe(b) {
return true
}
}
return false
} | go | func (n *SimpleNameNormalizer) safeByte(b byte) bool {
for i := range n.SafeSets {
if n.SafeSets[i].IsSafe(b) {
return true
}
}
return false
} | [
"func",
"(",
"n",
"*",
"SimpleNameNormalizer",
")",
"safeByte",
"(",
"b",
"byte",
")",
"bool",
"{",
"for",
"i",
":=",
"range",
"n",
".",
"SafeSets",
"{",
"if",
"n",
".",
"SafeSets",
"[",
"i",
"]",
".",
"IsSafe",
"(",
"b",
")",
"{",
"return",
"tru... | // safeByte checks if b against all safe charsets. | [
"safeByte",
"checks",
"if",
"b",
"against",
"all",
"safe",
"charsets",
"."
] | 896f2abd37e099bae3eae942250d1a37e4bdce0b | https://github.com/jaegertracing/jaeger-client-go/blob/896f2abd37e099bae3eae942250d1a37e4bdce0b/rpcmetrics/normalizer.go#L94-L101 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.