feat: optionally create new traces at the server#890
Merged
csmarchbanks merged 1 commit intomainfrom Feb 5, 2026
Merged
Conversation
When using a server to serve public facing routes it can be desired to create a new trace id instead of trusting the trace id attached to a public request. Otherwise very large traces can be created which will then be rejected by Tempo. The parent trace will be referenced using a span link to see the overall context of the request/other services using the public endpoint.
4444b30 to
9212984
Compare
This comment was marked as outdated.
This comment was marked as outdated.
Logiraptor
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using a server to serve public facing routes it can be desired to create a new trace id instead of trusting the trace id attached to a public request. Otherwise very large traces can be created which will then be rejected by Tempo.
The parent trace will be referenced using a span link to see the overall context of the request/other services using the public endpoint.
Here is an example of what this will look like in Tempo:

Even if the parent trace is not sampled it is possible to find all sampled traces linked to that trace using
{link:traceID = "<trace-id>"}.Note
Medium Risk
Changes HTTP tracing propagation behavior when enabled, which can alter trace continuity and observability expectations for public-facing routes. Risk is limited to OpenTelemetry users and is opt-in via
server.create-new-traces/PublicEndpointFn.Overview
Adds support for treating certain HTTP routes as public endpoints for OpenTelemetry: when configured, the server starts a new trace for matching requests instead of continuing any incoming trace context, and links to the original trace.
This is wired by extending
middleware.NewTracerto accept an optionalpublicEndpointFn(passed through tootelhttp.WithPublicEndpointFn), and by addingserver.create-new-tracesplusConfig.PublicEndpointFnto control the behavior when building the default HTTP middleware.Written by Cursor Bugbot for commit 9212984. This will update automatically on new commits. Configure here.