MCPcopy
hub / github.com/grafana/tempo / WithContext

Function WithContext

pkg/util/log/wrappers.go:32–44  ·  view source on GitHub ↗

WithContext returns a Logger that has information about the current user in its details. e.g. log := util.WithContext(ctx) log.Errorf("Could not chunk chunks: %v", err)

(ctx context.Context, l kitlog.Logger)

Source from the content-addressed store, hash-verified

30// log := util.WithContext(ctx)
31// log.Errorf("Could not chunk chunks: %v", err)
32func WithContext(ctx context.Context, l kitlog.Logger) kitlog.Logger {
33 userID, err := tenant.TenantID(ctx)
34 if err == nil {
35 l = WithUserID(userID, l)
36 }
37
38 traceID, ok := tracing.ExtractSampledTraceID(ctx)
39 if !ok {
40 return l
41 }
42
43 return WithTraceID(traceID, l)
44}
45
46// WithSourceIPs returns a Logger that has information about the source IPs in
47// its details.

Callers 1

FindMethod · 0.92

Calls 3

WithUserIDFunction · 0.85
WithTraceIDFunction · 0.85
TenantIDMethod · 0.80

Tested by

no test coverage detected