Skip to content

feat: optionally create new traces at the server#890

Merged
csmarchbanks merged 1 commit intomainfrom
option-to-break-and-link-traces
Feb 5, 2026
Merged

feat: optionally create new traces at the server#890
csmarchbanks merged 1 commit intomainfrom
option-to-break-and-link-traces

Conversation

@csmarchbanks
Copy link
Copy Markdown
Contributor

@csmarchbanks csmarchbanks commented Jan 29, 2026

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:
image

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.NewTracer to accept an optional publicEndpointFn (passed through to otelhttp.WithPublicEndpointFn), and by adding server.create-new-traces plus Config.PublicEndpointFn to 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.

@csmarchbanks csmarchbanks changed the title Optionally create new traces at the server feat: Optionally create new traces at the server Jan 29, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issue.

Comment thread server/server.go Outdated
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.
@csmarchbanks csmarchbanks force-pushed the option-to-break-and-link-traces branch from 4444b30 to 9212984 Compare January 29, 2026 16:22
@csmarchbanks csmarchbanks changed the title feat: Optionally create new traces at the server feat: optionally create new traces at the server Jan 29, 2026
@cursor

This comment was marked as outdated.

@csmarchbanks csmarchbanks merged commit 703f10b into main Feb 5, 2026
13 of 15 checks passed
@csmarchbanks csmarchbanks deleted the option-to-break-and-link-traces branch February 5, 2026 15:23
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