Parent.id is set to a non-Elastic APM Span/Transaction
See original GitHub issueFound in Opbeans and also here.
One example of such an id: |eb88cbba-4040e4007bc3c335.
.
My quick slack analysis:
that id looks like an id coming from Activity https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.activity?view=netcore-3.1
Activity is a “tracing library” build into .NET (fun fact the C# OpenTelemetry SIG decided to take this API and turn it into an OpenTelemetry compatible API - so think it’s like a span) - anyways, so what we do in the agent is that we try to keep our trace id in sync with the traceid on Activity (that way if users look at Activity.Current.TraceId then it’ll be the same as our trace id in elastic). Problem is Activity pre-dates W3C TraceContext and - originally it had a hierarchical id format (that’s what you pasted), but now it also supports w3c format. We only keep the id in sync when it’s w3c format: https://github.com/elastic/apm-agent-dotnet/blob/master/src/Elastic.Apm/Model/Transaction.cs#L85
At least that’s my intention. I can see 2 options here: Either I messed up and somewhere a check is missing or it’s in W3C format, but it’s parent is not, so the check is ok, but still we set the parent id which is in the old format - not sure it’s possible.
I’ll dig deeper - I still just start my day here. But thanks for mentioning this! that id looks like an id coming from Activity https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.activity?view=netcore-3.1
Activity is a “tracing library” build into .NET (fun fact the C# OpenTelemetry SIG decided to take this API and turn it into an OpenTelemetry compatible API - so think it’s like a span) - anyways, so what we do in the agent is that we try to keep our trace id in sync with the traceid on Activity (that way if users look at Activity.Current.TraceId then it’ll be the same as our trace id in elastic). Problem is Activity pre-dates W3C TraceContext and - originally it had a hierarchical id format (that’s what you pasted), but now it also supports w3c format. We only keep the id in sync when it’s w3c format: https://github.com/elastic/apm-agent-dotnet/blob/master/src/Elastic.Apm/Model/Transaction.cs#L85
At least that’s my intention. I can see 2 options here: Either I messed up and somewhere a check is missing or it’s in W3C format, but it’s parent is not, so the check is ok, but still we set the parent id which is in the old format - not sure it’s possible.
I’ll dig deeper - I still just start my day here. But thanks for mentioning this! ```
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Spans | APM User Guide [8.9]
A parent.id attribute that refers to its parent span or transaction. Its start time and duration. A name , type , subtype ,...
Read more >Transaction - co.elastic.apm apm-agent-api - javadoc.io
A transaction is the data captured by an agent representing an event occurring in a monitored service and groups multiple spans in a...
Read more >Is there an ID that will uniquely group all the logs - APM ...
Transactions can be considered the root span for a trace, where a sampled transaction might have a collection of spans associated with it....
Read more >apm
ParentID returns the ID of the span's parent span or transaction. func (*Span) SetStacktrace ¶. func (s *Span) SetStacktrace(skip int).
Read more >Distributed tracing with Elastic APM in Go — part 1
Trace consists of multiple transactions or spans. ... and parent-id , which is used to identify the parent of the current span on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @arindamdat, yes it is. It was released in version
1.6.0
.Thanks @arindamdat! That scenario is also reproducible - in that case, already in ServiceA we have an issue, which is that we set the
ParentId
of the transaction in ServiceA to the activity parent id which was created by ASP.NET Core - and that is why there won’t by any transaction there where theParentId
isnull
. And a trace must begin with a transaction where theParentId
is null, so that is why you don’t see traces.The PR I just opened also covers that issue.