LogFields will log the provided fields in the span, this is more performant that LogKV when using opentracing library.
(kvps ...otlog.Field)
| 268 | |
| 269 | // LogFields will log the provided fields in the span, this is more performant that LogKV when using opentracing library. |
| 270 | func (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. |
| 286 | func (s *SpanLogger) LogKV(kvps ...interface{}) { |
no test coverage detected