-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[receiver/datadog] add datadog span and trace id #23058
Conversation
0f1791d
to
3d4379e
Compare
3d4379e
to
bd9771d
Compare
@@ -88,7 +89,8 @@ func toTraces(payload *pb.TracerPayload, req *http.Request) ptrace.Traces { | |||
if span.Error > 0 { | |||
newSpan.Status().SetCode(ptrace.StatusCodeError) | |||
} | |||
|
|||
newSpan.Attributes().PutStr("datadog.span.id", strconv.FormatUint(span.SpanID, 10)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be nice to have these strings in an enum like semconv. Better yet, making a proposal to get them in semconv. The actual spec shouldn't have DD specific stuff, but I don't think it would be a problem to add in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some enums -> https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/23058/files#diff-da29a5fa6d38a3d168aff52f1f706fa53830e898975a082dfa6f3b5dccb88218R26-R37
What do you think? :)
Can I ask what are you trying to visualise this data in? Is there any reason why you can't use the trace ID and span ID that is already sent? I don't believe adding span field to an attribute is a good idea, it is wasteful since it is duplicating data. |
@MovieStoreGuy thanks for the review! I sort of agree, but I see this is a temporary way of correlating logs and traces: Since datadog library give log in this format:
And atm I'm not sure how to parse this trace id and span id to use for correlation in opentelemetry? I know otlp logs have dedicated field for SpanId and TraceID. Should we instead use some processor to transform logs in this format? But I'm not sure where the best place to contribute parsing from datadog trace id to otel trace id would be? |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Aren't those trace IDs and span IDs the same as already set a few lines above? |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
ping @povilasv |
Hey @jpkrohling .Ah sorry forgot to reply, so coming back to the problem. Datadog instrumentation gives trace ids in this format:
This receiver encodes DD TraceID's using:
Basically binary encoding. So question - how do we correlate the binray encoded trace ID with raw DD trace id from the log? I don't think in log storage systems it's common to have such decoding functions. But I might be wrong here. So it would be ideal we would have same exact representation, so we can easily switch from log's trace id to span. |
Understood, and it makes sense to me then! |
@boostchicken , @MovieStoreGuy , can you take another look at this one? |
Sure thing |
8b31e91
to
1260880
Compare
1260880
to
b9db856
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why this is needed but ideally I would like to see this work be done by a connector in a more generic sense
Hey @boostchicken, would appreciate another look :) |
I'm merging this as it's only about adding two new attributes. If @boostchicken has concerns, we can revert or work on this on a follow-up PR. |
No major concerns fine as is, my feedback was more a matter of opinion than best practice :) |
I recognize I'm late to the party, but what was the goal of this change? It makes sense to add the |
Description:
Add datadog trace id and span id so we cancorrelate traces received by datadogreceiver with logs.
Datadog libraries automatically provide datadog span ids and trace ids with the logs for various languages:
-https://docs.datadoghq.com/tracing/other_telemetry/connect_logs_and_traces/java?tab=log4j2
Example log for python:
Link to tracking Issue: #23057
Testing:
Documentation: