We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is your feature request related to a problem? Please describe.
Currently distributor does not write span names into logs when logging spans by enabling log_received_spans, even with include_all_attributes on.
log_received_spans
include_all_attributes
Describe the solution you'd like
Add span name into log context when logging span with all attributes.
For example:
// modules/distributor/distributor.go:581 func logSpanWithAllAttributes(s *v1.Span, logger log.Logger) { for _, a := range s.GetAttributes() { logger = log.With( logger, "span_"+strutil.SanitizeLabelName(a.GetKey()), tempo_util.StringifyAnyValue(a.GetValue())) } latencySeconds := float64(s.GetEndTimeUnixNano()-s.GetStartTimeUnixNano()) / float64(time.Second.Nanoseconds()) logger = log.With( logger, + "span_name", s.Name, "span_duration_seconds", latencySeconds, "span_kind", s.GetKind().String(), "span_status", s.GetStatus().GetCode().String()) level.Info(logger).Log("msg", "received", "spanid", hex.EncodeToString(s.SpanId), "traceid", hex.EncodeToString(s.TraceId)) }
Additional context We're using span logs with Loki as a workaround for search traces, so span names in logs could improve the search efficiency.
The text was updated successfully, but these errors were encountered:
+1 to this addition. please submit a PR if you can.
if you are unable to i can do it.
Sorry, something went wrong.
@joe-elliott PR opened :)
Successfully merging a pull request may close this issue.
Is your feature request related to a problem? Please describe.
Currently distributor does not write span names into logs when logging spans by enabling
log_received_spans
, even withinclude_all_attributes
on.Describe the solution you'd like
Add span name into log context when logging span with all attributes.
For example:
// modules/distributor/distributor.go:581 func logSpanWithAllAttributes(s *v1.Span, logger log.Logger) { for _, a := range s.GetAttributes() { logger = log.With( logger, "span_"+strutil.SanitizeLabelName(a.GetKey()), tempo_util.StringifyAnyValue(a.GetValue())) } latencySeconds := float64(s.GetEndTimeUnixNano()-s.GetStartTimeUnixNano()) / float64(time.Second.Nanoseconds()) logger = log.With( logger, + "span_name", s.Name, "span_duration_seconds", latencySeconds, "span_kind", s.GetKind().String(), "span_status", s.GetStatus().GetCode().String()) level.Info(logger).Log("msg", "received", "spanid", hex.EncodeToString(s.SpanId), "traceid", hex.EncodeToString(s.TraceId)) }
Additional context
We're using span logs with Loki as a workaround for search traces, so span names in logs could improve the search efficiency.
The text was updated successfully, but these errors were encountered: