open-telemetry / open-telemetry/opentelemetry-java-instrumentation

Context/Span is lost/reset after a vertx Grpc/HttpClient2 call

Open
#11,860 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs triage repro provided
Dominant language
Java
Stars
2.6k
Forks
1.2k
Avg merge
2d 18h
Merged PRs (30d)
228

Description

Describe the bug

starter.zip

Hi team,

We are facing a issue where the Context/Span is lost/reset after a Grpc/HttpClient2 call. However, VertxContextStorage still has the context/span.

Steps to reproduce
  1. download the attached zip
  2. export JAVA_TOOL_OPTIONS=-javaagent:./opentelemetry-javaagent.jar
  3. ./mvnw clean compile exec:java
  4. curl --location --request GET 'http://localhost:8080/test'
Expected behavior

The context/span should be same as the first log that shows the context/span after the grpc call.

Actual behavior
2024-07-18 23:14:24.629 [f3448bd0254e74f195412d670930154a] INFO  - [x-eventloop-thread-1]         com.example.starter.MainVerticle:61   first handler spanApplicationSpan{agentSpan=SdkSpan{traceId=f3448bd0254e74f195412d670930154a, spanId=8b4cfa09ecfe4754, parentSpanContext=ImmutableSpanContext{traceId=00000000000000000000000000000000, spanId=0000000000000000, traceFlags=00, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=false}, name=GET, kind=SERVER, attributes=AttributesMap{data={thread.name=vert.x-eventloop-thread-1, http.method=GET, thread.id=27, http.scheme=http, net.sock.family=inet6, net.host.port=8080, http.target=/test, net.host.name=localhost, user_agent.original=PostmanRuntime/7.29.2, net.transport=ip_tcp}, capacity=128, totalAddedValues=10}, status=ImmutableStatusData{statusCode=UNSET, description=}, totalRecordedEvents=0, totalRecordedLinks=0, startEpochNanos=1721358864587649000, endEpochNanos=0}}
2024-07-18 23:14:24.753 [] INFO  - [x-eventloop-thread-1]         com.example.starter.MainVerticle:77   success 1 PropagatedSpan{ImmutableSpanContext{traceId=00000000000000000000000000000000, spanId=0000000000000000, traceFlags=00, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=false}}
2024-07-18 23:14:24.753 [] INFO  - [x-eventloop-thread-1]         com.example.starter.MainVerticle:87   request /test PropagatedSpan{ImmutableSpanContext{traceId=00000000000000000000000000000000, spanId=0000000000000000, traceFlags=00, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=false}}
Javaagent or library instrumentation version

latest

Environment

JDK:
OS:

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Download the attached starter.zip and reproduce the issue with the supplied JAVA_TOOL_OPTIONS, Maven command, and curl request. Compare the context/span values in the first handler and subsequent logs around the Grpc/HttpClient2 call. Done means the context/span remains the same after the call and in the /test request log.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.