grafana / tempo

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.
https://grafana.com/oss/tempo/
GNU Affero General Public License v3.0
3.93k stars 509 forks source link

trace root span incorrectly identified due to instrumentation #3634

Open ie-pham opened 5 months ago

ie-pham commented 5 months ago

Consider the following trace:

[
    Span{
        traceId: "39343434",
        spanId: "aaa"
        parentSpanId: "",
        links: [
            link{
                traceId: "39343434"
                spanId: "bbb"
                atributes: {
                    "opentracing.ref_type": "child_of"
                }
            }
        ]
    },
    Span{
        traceId: "39343434",
        spanId: "bbb"
        parentSpanId: "",
        links: []
    },
    Span{
        traceId: "39343434",
       spanId: "ccc"
        parentSpanId: "",
        links: [
            link{
                traceId: "39343434"
                spanId: "aaa"
                atributes: {
                    "opentracing.ref_type": "child_of"
                }
            }
        ]
    }

 ]

Currently, Tempo labels any spans with an empty parentSpanId field as the root span. In the above situation, Tempo would label whichever of the three spans is ingested last. Tempo should also check whether there is a link with attribute child of before labeling the span as the root span. The correct root span is bbb as it has no child of links.

ishanjain28 commented 4 months ago

hi @ie-pham I would like to work on this. Do you have any suggestions on where to start ?