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

Fix 'rpc error: code = InvalidArgument desc = Invalid parent id!' errors #27

Merged
merged 1 commit into from May 29, 2020

Conversation

charleskorn
Copy link
Contributor

The parent span ID was being formatted incorrectly, which meant all spans except the root span were rejected by the GCP tracing API.

If clients did not have error logging hooked up to WithOnError(), this would cause child spans to be silently dropped.

The API documentation says the span ID should be formatted as a 64-bit integer encoded as a string, but appears to accept a span ID or parent span ID in the hexadecimal format returned by SpanID.String().

I couldn't see any tests for this functionality, so I haven't added any - happy to add some.

…ors.

The parent span ID was being formatted incorrectly, which meant all
spans except the root span were rejected by the GCP tracing API.

If clients did not have error logging hooked up to WithOnError, this
would cause child spans to be silently dropped.

The documentation says the parent span ID should be formatted as a
64-bit integer encoded as a string, but appears to accept the
hexadecimal format returned by SpanID.String().
charleskorn added a commit to batect/abacus that referenced this pull request May 17, 2020
This also temporarily replaces the GCP-provided tracing exporter with
my fork until
GoogleCloudPlatform/opentelemetry-operations-go#27
is merged.
@@ -84,7 +84,7 @@ func protoFromSpanData(s *export.SpanData, projectID string) *tracepb.Span {
SameProcessAsParentSpan: &wrapperspb.BoolValue{Value: !s.HasRemoteParent},
}
if s.ParentSpanID != s.SpanContext.SpanID && s.ParentSpanID.IsValid() {
sp.ParentSpanId = fmt.Sprintf("%.16x", s.ParentSpanID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was originally introduced in open-telemetry/opentelemetry-go#160 and then was moved to this repo.

@ymotongpoo was this line imported from OpenCensus? Do OpenCensus and OpenTelemetry have different string representation of SpanIDs?

@rghetia rghetia merged commit 088b504 into GoogleCloudPlatform:master May 29, 2020
charleskorn added a commit to batect/abacus that referenced this pull request May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants