Skip to content

Add Telemetry for Extension Finder SPIs#11298

Open
mhlidd wants to merge 1 commit intomhlidd/add_extensions_metricfrom
mhlidd/add_extension_finder_telemetry
Open

Add Telemetry for Extension Finder SPIs#11298
mhlidd wants to merge 1 commit intomhlidd/add_extensions_metricfrom
mhlidd/add_extension_finder_telemetry

Conversation

@mhlidd
Copy link
Copy Markdown
Contributor

@mhlidd mhlidd commented May 6, 2026

What Does This Do

This PR sends metrics for all OTel SPIs that are detected on the existing ExtensionFinder class. This effectively tracks any OTel SPI that is registered at any of the JAR files on the path listed by otel.javaagent.extensions or dd.trace.extensions.path.

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Note: Once your PR is ready to merge, add it to the merge queue by commenting /merge. /merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

@mhlidd mhlidd added type: enhancement Enhancements and improvements comp: telemetry Telemetry tag: ai generated Largely based on code generated by an AI or LLM labels May 6, 2026
@mhlidd mhlidd marked this pull request as ready for review May 6, 2026 23:28
@mhlidd mhlidd requested a review from a team as a code owner May 6, 2026 23:28
@mhlidd mhlidd requested review from amarziali and mcculls May 6, 2026 23:28
if (name.startsWith(SERVICES_PREFIX)) {
String fqn = name.substring(SERVICES_PREFIX.length());
if (fqn.startsWith(OTEL_NAMESPACE)) {
OtelSpiCollector.getInstance().recordSpiDetected(fqn, EXTENSIONS_PATH_SOURCE);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we exit here do avoid looping on entries if we already found?

Copy link
Copy Markdown
Contributor

@mcculls mcculls May 7, 2026

Choose a reason for hiding this comment

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

If the goal here is to report all service files under the OTel namespace then the best we could do is exit on the first entry that doesn't start with the services prefix. That's assuming that the service entries appear in a group, which they usually do. If assume that the service entries are ordered then we could exit on the next entry that doesn't start with the OTel namespace.

However I'd like to know about what we intend to gain from this telemetry since this will incur a non-trivial startup cost, albeit only when extensions are added to the tracer (which is uncommon.)

i.e. if the goal is to survey what SPIs are being added as extensions, even though we don't currently support them then I guess this is the only way to discover that (although it would be a good idea to short-circuit the searching when we get to jar entries that we know should appear after service entries - you can look at some example OTel extension jars to see if there's a pattern.)

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

Labels

comp: telemetry Telemetry tag: ai generated Largely based on code generated by an AI or LLM type: enhancement Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants