Skip to content

Commit

Permalink
Clean up ExtendedSpanBuilder call chain in HTTP Server Example (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
illenko authored Dec 7, 2024
1 parent 9e1d118 commit 428add1
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions http/src/main/java/io/opentelemetry/example/http/HttpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,12 @@ private static class HelloHandler implements HttpHandler {

@Override
public void handle(HttpExchange exchange) throws IOException {
// TODO (trask) clean up chaining after
// https://github.com/open-telemetry/opentelemetry-java/pull/6514
((ExtendedSpanBuilder)
((ExtendedSpanBuilder) tracer.spanBuilder("GET /"))
.setParentFrom(
openTelemetry.getPropagators(),
exchange.getRequestHeaders().entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().get(0))))
.setSpanKind(SpanKind.SERVER))
((ExtendedSpanBuilder) tracer.spanBuilder("GET /"))
.setParentFrom(
openTelemetry.getPropagators(),
exchange.getRequestHeaders().entrySet().stream()
.collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().get(0))))
.setSpanKind(SpanKind.SERVER)
.startAndRun(
() -> {
// Set the Semantic Convention
Expand Down

0 comments on commit 428add1

Please sign in to comment.