Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Aleksandrov <[email protected]>
  • Loading branch information
dalexandrov committed Nov 8, 2023
1 parent 62073cd commit 6060272
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 34 deletions.
28 changes: 16 additions & 12 deletions docs/se/guides/tracing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,12 @@ private void getDefaultMessageHandler(ServerRequest request,
}
}
----
<1> Create a new `Span` using Global Tracer.
<2> Set Parent Span, if available in the `Request`.
<1> Create a new `Span` using the global tracer.
<2> Set the parent of the new span to the span from the `Request` if available.
<3> Start the span.
<4> End the span when the response is sent.
<5> Record an exception in the span if happened.
<4> End the span normally after the response is sent.
<5> End the span with an exception if one was thrown.
[source,bash]
.Build the application, skipping unit tests, then run it:
Expand Down Expand Up @@ -250,11 +251,11 @@ image::guides/12_tracing_span_detail.png[Span Details]
=== Tracing Across Services
Helidon automatically traces across services if the services use the same tracer, for example, the same instance of Jaeger.
This means a single trace can include spans from multiple services and hosts. Helidon uses a `Span.context()` to
This means a single trace can include spans from multiple services and hosts. Helidon uses a `SpanContext` to
propagate tracing information across process boundaries. When you make client API calls, Helidon will
internally call OpenTelemetry APIs to propagate the Span Context. There is nothing you need to do in your application to make this work.
internally call OpenTelemetry APIs or OpenTracing APIs to propagate the Span Context. There is nothing you need to do in your application to make this work.
To demonstrate distributed tracing, you will need to create a second project, where the server listens on port 8081.
To demonstrate distributed tracing, you will need to create a second project, where the server listens to on port 8081.
Create a new root directory to hold this new project, then do the following steps, similar to
what you did at the start of this guide:
Expand Down Expand Up @@ -294,7 +295,7 @@ cd helidon-quickstart-se-2
<artifactId>helidon-tracing-providers-jaeger</artifactId> <3>
</dependency>
----
<1> Helidon Tracing dependencies.
<1> Helidon Tracing API dependencies.
<2> Observability features for tracing.
<3> Jaeger tracing provider.
Expand Down Expand Up @@ -322,6 +323,8 @@ server:
host: 0.0.0.0
----
NOTE: The settings above are for development and experimental purposes only. For production environment, please see the link:../tracing.adoc[Tracing documentation].
[source,java]
.Update the `Main` class; Add Tracer to the WebServer builder
----
Expand Down Expand Up @@ -352,8 +355,8 @@ private void getDefaultMessageHandler(ServerRequest request,
try {
sendResponse(response, "World");
} finally {
span.finish();
} catch (Throwable t) {
span.end(t);
}
}
----
Expand Down Expand Up @@ -474,8 +477,8 @@ public class GreetService implements HttpService {
String result = requestBuilder // <4>
.get(String.class);
response.send(result);
} finally {
span.end(); // <5>
} catch (Throwandle t) {
span.end(t); // <5>
}
}
Expand Down Expand Up @@ -684,5 +687,6 @@ Refer to the following references for additional information:
- link:{microprofile-tracing-spec-url}[MicroProfile OpenTracing specification]
- link:{microprofile-tracing-javadoc-url}[MicroProfile OpenTracing Javadoc]
* link:https://opentelemetry.io/docs/instrumentation/js/api/tracing/[OpenTelemetry API]
- link:{javadoc-base-url}/index.html?overview-summary.html[Helidon Javadoc]
34 changes: 12 additions & 22 deletions docs/se/tracing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ For OpenTelemetry:
----
<dependency>
<groupId>io.helidon.tracing.providers</groupId>
<artifactId>helidon-tracing-providers-jaeger</artifactId>
<artifactId>helidon-tracing-providers-opentelemetry</artifactId>
</dependency>
----
Expand All @@ -96,7 +96,7 @@ For OpenTracing:
----
<dependency>
<groupId>io.helidon.tracing.providers</groupId>
<artifactId>helidon-tracing-providers-jaeger</artifactId>
<artifactId>helidon-tracing-providers-opentracing</artifactId>
</dependency>
----
// end::tracing-dependency[]
Expand Down Expand Up @@ -155,8 +155,8 @@ Span span = tracer.spanBuilder("name") <1>
try (...){ <2>
//do some work
span.end();
} catch (Exception e) { <3>
span.end(e);
} catch (Throwable t) { <3>
span.end(t);
}
----
<1> Create span from tracer.
Expand Down Expand Up @@ -224,12 +224,14 @@ tracing:
[source,java]
.Use the configuration in web server
----
Tracer tracer = TracerBuilder.create(config.get("tracing")).build();
Tracer tracer = TracerBuilder.create(config.get("tracing")).build(); <1>
server.addFeature(ObserveFeature.builder()
.addObserver(TracingObserver.create(tracer))
.addObserver(TracingObserver.create(tracer)) <2>
.build())
----
<1> Create `Tracer` using `TracerBuilder` from configuration.
<2> Add the `Tracer` as an observability feature.
==== Path-based Configuration in Helidon WebServer
Expand Down Expand Up @@ -264,26 +266,14 @@ tracing:
[source,java]
.Configuration with Web Server
----
Tracer tracer = TracerBuilder.create(config.get("tracing")).build();
Tracer tracer = TracerBuilder.create(config.get("tracing")).build(); <1>
server.addFeature(ObserveFeature.builder()
.addObserver(TracingObserver.create(tracer))
.build())
----
[source,java]
.Configuration with Web Server using a builder
----
Tracer tracer = WebTracingConfig.builder()
.addPathConfig(PathTracingConfig.builder()
.path("/metrics")
.tracingConfig(TracingConfig.DISABLED)
.build();
server.addFeature(ObserveFeature.builder()
.addObserver(TracingObserver.create(tracer))
.addObserver(TracingObserver.create(tracer)) <2>
.build())
----
<1> Create `Tracer` using `TracerBuilder` from configuration.
<2> Add the `Tracer` as an observability feature.
==== Renaming top level span using request properties
Expand Down

0 comments on commit 6060272

Please sign in to comment.