Segment Breakdown (like New Relic) / Accessing Parent Span Name in Child Span #39147
Unanswered
bhushan-amit
asked this question in
Q&A
Replies: 1 comment
-
+1, facing the same issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have set up auto-instrumentation for my Java application, sending trace data to the OpenTelemetry Collector. The traces are stored in Tempo, while internal OpenTelemetry Collector metrics and span metrics are exported to Prometheus via prometheusremotewrite. Both Tempo and Prometheus are then added as data sources in Grafana for visualization. Currently, we have APM, Collector, and JVM dashboards, which provide useful insights.
However, we need a segment breakdown similar to what is offered by New Relic. If anyone has implemented this for a specific route and can point me to relevant documentation, I would greatly appreciate it.
If no existing solution is available, I am considering implementing it myself. My approach would involve leveraging existing span metrics but grouping spans by their trace before aggregation. Initially, I attempted to include trace.id as a span attribute and use it as a dimension in spanmetrics, but this resulted in high cardinality, causing the machine to run out of memory.
To mitigate this, I plan to use the parent span's name (or a similar trace-level identifier) as a lower-cardinality dimension. However, child spans do not inherently have access to their parent span’s name—only the parent_span_id. My goal is to extract the span name from the root span (i.e, where parent_span_id == "0000000000000000") and propagate it to child spans as an attribute (TraceName).
The main challenge is that the transform processor operates on individual spans and lacks access to the full trace context, making cross-span lookups difficult. Even added the groupbytrace processor, but it did not resolve the issue. OpenTelemetry's OTTL lacks support for "baggage" propagation, and cross-signal interactions (between spans and span events) are also not supported. Just need to store an attribute for whole trace.
How can I achieve this? In summary, I need to propagate a trace-level identifier (such as the parent span name) to all child spans as an attribute. This would provide a low-cardinality dimension upon which I can aggregate trace metrics effectively.
Beta Was this translation helpful? Give feedback.
All reactions