Skip to content

Conversation

@deejgregor
Copy link
Contributor

@deejgregor deejgregor commented Jan 8, 2026

What Does This Do

Adds long running traces to the flare report.

Also keeps track of how often we write around the pending trace buffer.

Motivation

While adding custom instrumentation to a complex, asynchronous application we found it was challenging to validate if all spans were end()ed during tests. dd.trace.debug=true and dd.trace.experimental.long-running.enabled=true could be used with some post-processing of debug logs, however this didn't work for our needs because the application breaks with that level of logging. When dd.trace.experimental.long-running.enabled=true is used, the long running traces are sent to Datadog's backend, however they are not searchable until they are finished, so we didn't have a good way to find them. This change adds the long running traces list to the flare report.

Additional Notes

This was originally part of #9874, which is being broken out into a few individual PRs.

Some highlights in the different commits:

This also limits the number of long running traces added to the flare report, like is already done for the pending trace buffer ( MAX_DUMPED_TRACES = 50).

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Synchronized accesses to traceArray in LongRunningTracesTracker
since the flare reporter can now access the array. This shouldn't
be a concern for blocking because addTrace and flushAndCompact are
the existing calls from PendingTraceBuffer's run() loop and
getTracesAsJson is called by the reporter thread and will complete
fairly quickly.
Adds a new tracer metric, pending.write_around
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tag: community Community contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants