Skip to content

uber-trace-id from incoming request overwrites client span in spring cloud gateway tracing #340

@rafis

Description

@rafis

Client span is generated here:

Span span = this.tracer.buildSpan(path(builder))
.asChildOf(tracer.activeSpan())
.withTag(Tags.COMPONENT.getKey(), COMPONENT)
.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
.withTag(ROUTE_ID, getRouteId(exchange))
.start();

Next we try to inject this span into Http Headers of inner request:

this.tracer.inject(span.context(), Format.Builtin.HTTP_HEADERS, new HttpHeadersCarrier(headersWithInput));
} catch (Exception ignore) {
log.error("TraceRequestHttpHeadersFilter error", ignore);
}
headersWithInput.addAll(input);
addHeadersWithInput(builder, headersWithInput);

But if the incoming request to Spring Cloud Gateway had it own uber-trace-id header this will overwrite what we just tried to do. Is it a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions