Skip to content
New issue

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

Include Tags.COMPONENT ("jaxrs") and Tags.SPAN_KIND ("client") for Span creation in ClientTracingFilter.createSpan() #1942

Closed
vasanth-bhat opened this issue Jun 8, 2020 · 1 comment
Assignees
Labels
2.x Issues for 2.x version branch enhancement New feature or request P4
Projects
Milestone

Comments

@vasanth-bhat
Copy link

Environment Details

  • Helidon Version: 1.4.4

  • Helidon SE & Helidon MP

  • JDK version: 8 u251

  • OS: Linux x64

  • Helidon Version: 2.0.0.-RC1

  • Helidon SE & Helidon MP

  • JDK version: 11

  • OS: Linux x64

Problem Description


the implementation of ClientTracingFilter.createSpan() is currently setting the associated tags like "SPAN_KIND" and the "COMPONENT" after the span is started .

private Span createSpan(ClientRequestContext requestContext,
Tracer tracer,
Optional parentSpan,
String spanName) {

    Tracer.SpanBuilder spanBuilder = tracer.buildSpan(spanName);
    parentSpan.ifPresent(spanBuilder::asChildOf);
    Span span = spanBuilder.start();
    **Tags.COMPONENT.set(span, "jaxrs");**
    **Tags.HTTP_METHOD.set(span, requestContext.getMethod());**
    **Tags.HTTP_URL.set(span, url(requestContext.getUri()));**
    **Tags.SPAN_KIND.set(span, Tags.SPAN_KIND_CLIENT);**
    return span;
}

Downstream processors such as java-span-reporter reporter implementations , get a call back for Span operations such as start() and finish().

With the above implementation, the details such as SPAN_KIND, COMPONENT are not available when they get invoked as part of span start() . Having the details of Component & Sapn Type at start would really help for some use cases where this info is used for taking specific actions, for example emitting specific event type for JAX-RS service calls into JFR,

if the implementation in ClientTracingFilter.createSpan() could be changed, to something like below to provide COMPONENT and SPAN_KIND and other details as part of Span start() , it would really help for such use cases.

Tracer.SpanBuilder spanBuilder = tracer.buildSpan(spanName)
.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT)
.withTag(Tags.HTTP_METHOD.getKey(), requestContext.getMethod())
.withTag(Tags.HTTP_URL.getKey(), url(requestContext.getUri()))
.withTag(Tags.COMPONENT.getKey(), "jaxrs");

This approach is also used in
https://github.com/oracle/helidon/blob/master/tracing/jersey/src/main/java/io/helidon/tracing/jersey/AbstractTracingFilter.java#L78

to create spans for jax-rs execution on Server Side.

The ask here is that the implemenation of span creation in ClientTracingFilter, can be modified to use this approach where withTag() method is used to provide the span details as apr tof Span creation itself, instead of setting them after the creation.

@barchetta barchetta added this to Needs triage in Backlog via automation Jun 11, 2020
@m0mus m0mus added enhancement New feature or request 2.x Issues for 2.x version branch P4 labels Jun 18, 2020
@m0mus m0mus moved this from Needs triage to Normal priority in Backlog Jun 18, 2020
@paulparkinson paulparkinson self-assigned this Nov 3, 2020
@paulparkinson paulparkinson added this to the 2.1.1 milestone Nov 9, 2020
@m0mus m0mus modified the milestones: 2.1.1, 2.2.0 Nov 12, 2020
@paulparkinson
Copy link
Contributor

fix merged 0e7d431

Backlog automation moved this from Normal priority to Closed Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Issues for 2.x version branch enhancement New feature or request P4
Projects
Backlog
  
Closed
Development

No branches or pull requests

3 participants