MCPcopy
hub / github.com/grafana/dskit / LogFields

Method LogFields

spanlogger/spanlogger.go:270–283  ·  view source on GitHub ↗

LogFields will log the provided fields in the span, this is more performant that LogKV when using opentracing library.

(kvps ...otlog.Field)

Source from the content-addressed store, hash-verified

268
269// LogFields will log the provided fields in the span, this is more performant that LogKV when using opentracing library.
270func (s *SpanLogger) LogFields(kvps ...otlog.Field) {
271 if !s.sampled {
272 return
273 }
274
275 if s.otelSpan != nil {
276 attrs := opentracingFieldsToAttributes(kvps...)
277 s.otelSpan.AddEvent("log", trace.WithAttributes(attrs...))
278 return
279 }
280
281 // Clone kvps to prevent it from escaping to heap even when it's not sampled.
282 s.opentracingSpan.LogFields(slices.Clone(kvps)...)
283}
284
285// LogKV will log the provided key/value pairs in the span, this is less performant than LogFields when using opentracing library.
286func (s *SpanLogger) LogKV(kvps ...interface{}) {

Callers 3

spanLogMethod · 0.95
ErrorMethod · 0.95
LogErrorMethod · 0.80

Calls 2

CloneMethod · 0.65

Tested by

no test coverage detected