Skip to content

Commit

Permalink
Fix custom span in docs (helidon-io#7888)
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Aleksandrov <[email protected]>
  • Loading branch information
dalexandrov authored Oct 26, 2023
1 parent 8617b87 commit 34f67ef
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions docs/se/tracing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,23 @@ GrpcServerConfiguration serverConfig = GrpcServerConfiguration.builder().port(0)
=== Creating Custom Spans
To create a custom span that is a child of the WebServer request:
To create a custom span from tracer:
[source,java]
----
Span span = request.tracer()
.spanBuilder("my-operation")
.update(spanBuilder -> request.spanContext().ifPresent(spanBuilder::parent))
.start();
try {
// Do some work and send a normal response.
span.end();
} catch (Throwable t) {
// Send an error response.
span.end(t);
}
Span span = tracer.spanBuilder("name") <1>
.tag("key", "value")
.start();
try (...){ <2>
//do some work
span.end();
} catch (Exception e) { <3>
span.end(e);
}
----
<1> Create span from tracer.
<2> Do some work and end span.
<3> End span with exception.
== Helidon Spans
Expand Down

0 comments on commit 34f67ef

Please sign in to comment.