Skip to content

Add traceStateValue parameter to DistributedTracingData.TryDeserializ…#2607

Merged
stevejgordon merged 2 commits into
elastic:mainfrom
otemnov:tracestate
Aug 16, 2025
Merged

Add traceStateValue parameter to DistributedTracingData.TryDeserializ…#2607
stevejgordon merged 2 commits into
elastic:mainfrom
otemnov:tracestate

Conversation

@otemnov
Copy link
Copy Markdown
Contributor

@otemnov otemnov commented Jun 4, 2025

We pass the 'traceparent' value in our asynchronous message communication.
We follow the instructions at https://www.elastic.co/guide/en/apm/get-started/7.10/distributed-tracing.html#_manual_distributed_tracing.
However, it is not possible to restore the 'tracestate' as it is for the Go agent implementation.

In pair 'restart_external' TraceContinuationStrategy, it is not possible to search the logs across services using the original traceid, as each message handling generates anew traceid due to the absence of a tracestate.

The PR suggests a possible solution.

@cla-checker-service
Copy link
Copy Markdown

cla-checker-service Bot commented Jun 4, 2025

💚 CLA has been signed

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2025

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2025

👋 @otemnov Thanks a lot for your contribution!

It may take some time before we review a PR, so even if you don’t see activity for some time, it does not mean that we have forgotten about it.

Every once in a while we go through a process of prioritization, after which we are focussing on the tasks that were planned for the upcoming milestone. The prioritization status is typically reflected through the PR labels. It could be pending triage, a candidate for a future milestone, or have a target milestone set to it.

@otemnov
Copy link
Copy Markdown
Contributor Author

otemnov commented Jun 4, 2025

❌ Author of the following commits did not sign a Contributor Agreement: 6ca0563

Please, read and sign the above mentioned agreement if you want to contribute to this project

Signed

@stevejgordon
Copy link
Copy Markdown
Contributor

Thanks, @otemnov. This looks reasonable, and we should add this. I'd prefer to add a new method rather than amend the existing one. The existing methods are badly named, so I think we could opt to add a better-named factory method for this scenario. Would you mind tweaking the PR to add a method with this signature? We'll leave the original method for backwards compatibility of the existing functionality.

public static DistributedTracingData Create(string traceParent, string traceState)

@otemnov
Copy link
Copy Markdown
Contributor Author

otemnov commented Jun 11, 2025

@stevejgordon thanks!
I've added the Create method, but I've also realised that there is no way to retrieve the tracestate string.
Therefore, I need to add a new method. The name is odd, but it follows the existing convention of SerializeToString()

public string SerializeTraceStateToString() => TraceState?.ToTextHeader();

Copy link
Copy Markdown
Contributor

@stevejgordon stevejgordon left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@stevejgordon
Copy link
Copy Markdown
Contributor

run docs-build

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants