question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parent.id is set to a non-Elastic APM Span/Transaction

See original GitHub issue

Found 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:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
gregkalaposcommented, Aug 28, 2020

Hi @arindamdat, yes it is. It was released in version 1.6.0.

1reaction
gregkalaposcommented, Jun 26, 2020

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 the ParentId is null. And a trace must begin with a transaction where the ParentId is null, so that is why you don’t see traces.

The PR I just opened also covers that issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found