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

Trace Exporter sets invalid parent span IDs for root spans #295

Closed
WadeGulbrandsen opened this issue Feb 9, 2024 · 1 comment · Fixed by #296
Closed

Trace Exporter sets invalid parent span IDs for root spans #295

WadeGulbrandsen opened this issue Feb 9, 2024 · 1 comment · Fixed by #296
Labels
bug Something isn't working priority: p1

Comments

@WadeGulbrandsen
Copy link
Contributor

Root spans should have the parent span ID left empty but Trace Exporter is setting them to 0000000000000000 which is not a valid span ID and shows up in Cloud Trace as (Missing span ID 0000000000000000).

image

I believe the issue is in exporters/trace/src/main/java/com/google/cloud/opentelemetry/trace/TraceTranslator.java

if (spanData.getParentSpanId() != null) {
  spanBuilder.setParentSpanId(spanData.getParentSpanId());
}

Instead of checking to see if the parent span ID is not null the check should be for if the parent context is valid:

if (spanData.getParentSpanContext().isValid()) {
  spanBuilder.setParentSpanId(spanData.getParentSpanId());
}

After making that change to a local copy of the TraceTranslator.java I no longer see the (Missing span ID 0000000000000000) spans and the root span has the parent span ID empty.

image

@aabmass
Copy link
Contributor

aabmass commented Feb 12, 2024

Thanks for the report and PR, we will take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants