Skip to content

Conversation

STRUDSO
Copy link

@STRUDSO STRUDSO commented Feb 11, 2025

  • CorrelationListener
  • Events listener

- CorrelationListener
- Events listener
Søren Trudsø Mahon added 2 commits February 12, 2025 11:26
- Use TraceId as i think this more closely aligns with terminology in otel trace_id. I think rootid is based on the old Activity pre w3cformat and is in my understanding equal to traceid given the idformat is ActivityIdFormat.W3C (which is default since .net 5)
- Not sure I understand why we would take the id ie, traceparent of the parent span instead of the id (traceparent) of the current activity? If i were to start a trace based of what i loaded from the db, I would use activitycontext.parse(doc.CausationId)  and in that case i don't see why it would be 1 level up.
@jeremydmiller
Copy link
Member

@STRUDSO Can you start by explaining why all of Marten's existing Otel support doesn't cover whatever you want here?
https://martendb.io/otel.html#open-telemetry-and-metrics

@STRUDSO
Copy link
Author

STRUDSO commented Feb 12, 2025

Let me spend a little more time with this, and yes some of it probably belongs in Samples.

At first i didn't realize the work in:

documentSession.CorrelationId = Activity.Current?.RootId;

Spent some time on understanding traceparent, trace_id and parent_id in the context of this:
https://www.w3.org/TR/trace-context/#version-format
And how it manifests itself in dotnet's activity class.

In SessionFactoryBase it has:

        documentSession.CorrelationId = Activity.Current?.RootId;

RootId = TraceId in my understanding, so all good, don't know anything about tracing pre opentelemetry, so maybe this is how it should be. But seems like opentelemetry calls it traceid. i guess this is what you would use to find "all" of the spans in jaeger eg.

        documentSession.CausationId = Activity.Current?.ParentId;

ParentId i don't fully understand, my understanding is:

using var activity1 = source.Start
using var activity2 = source.Start
// activity2.ParentId == activity.Id
using var session = store.OpenSession()
session.Store(doc)

then doc.CausationId would point to the Id of activity1.
Shouldn't this be activity2.Id?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants