Skip to content

Conversation

@zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Dec 17, 2025

@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.09%. Comparing base (22d90b6) to head (576f287).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7927      +/-   ##
============================================
- Coverage     90.10%   90.09%   -0.02%     
- Complexity     7370     7438      +68     
============================================
  Files           828      834       +6     
  Lines         22254    22541     +287     
  Branches       2192     2238      +46     
============================================
+ Hits          20053    20309     +256     
- Misses         1515     1532      +17     
- Partials        686      700      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

* @param name the name of the instrumentation
* @return the {@link DeclarativeConfigProperties} for the given instrumentation name
*/
default DeclarativeConfigProperties getJavaInstrumentationConfig(String name) {
Copy link
Member

Choose a reason for hiding this comment

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

In the java SIG today we discussed adding an additional helper DeclarativeConfigProperties getGeneralInstrumentationConfig() which would operate the same but access the .instrumentation/development.general node.

Your call whether we do that in a separate PR or this one.

Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to also have a getDistributionConfig() to access the .distribution node (without null worries)

Copy link
Member

Choose a reason for hiding this comment

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

That's a different story. Right now the scope of what ConfigProvider knows about is limited to the .instrumentation/development node. Would need to have something like open-telemetry/opentelemetry-specification#4800 to expand the scope.

Note its still possible for distributions to access .distribution without PR#4800 with a pattern like:

OpenTelemetryConfigurationModel model = parse(new File(System.getEnv("OTEL_EXPERIMENTAL_CONFIG_FILE")));
DistributionModel distribution = model.getDistribution();
ExtendedOpenTelemetrySdk sdk = create(model);

Copy link
Member Author

Choose a reason for hiding this comment

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

that pattern is brittle, e.g. doesn't work with the spring starter

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, that would work for spring applications.

  • AgentListener passes AutoConfiguredOpenTelemetrySdk - and that gives you access to ConfigProvider only - but Jacks suggestion would work
  • if the user also checks for the corresponding system property

@zeitlinger
Copy link
Member Author

@jack-berg added the second method for "general" and improved test coverage

* @return the {@link DeclarativeConfigProperties} for the given general instrumentation config
* name
*/
default DeclarativeConfigProperties getGeneralInstrumentationConfig(String name) {
Copy link
Member

Choose a reason for hiding this comment

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

This works because for now there are no top level properties under .instrumentation/development.general. But if there were, callers would be unable to access them. I think we should omit the String name parameter for now and just return the .instrumentation/development.general node.

Copy link
Member

Choose a reason for hiding this comment

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

oh good point, can .instrumentation/development.java. have top-level properties?

I really don't mind getJavaInstrumentationConfig().get(name)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is only a shortcut method - so I think we're allowed to nudge towards what we think is best practice.
I think that is the currently implemented solution, but I can live with either.

Copy link
Member

Choose a reason for hiding this comment

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

oh good point, can .instrumentation/development.java. have top-level properties?

No - its properties are limited to objects: https://github.com/open-telemetry/opentelemetry-configuration/blob/main/schema-docs.md#experimentallanguagespecificinstrumentation-

In contrast, .general has explicit properties of http and peer which are objects, but nothing stating all properties are objects: https://github.com/open-telemetry/opentelemetry-configuration/blob/main/schema-docs.md#experimentalgeneralinstrumentation-

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, I'll adapt "general" then

Copy link
Member Author

Choose a reason for hiding this comment

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

done

*
* @return the {@link DeclarativeConfigProperties} for the general instrumentation configuration
*/
default DeclarativeConfigProperties getGeneralInstrumentationConfig() {
Copy link
Member

Choose a reason for hiding this comment

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

would we be comfortable with something shorter, e.g.

  • getInstrumentationGeneral()
  • getInstrumentationJava(name)

Copy link
Member Author

Choose a reason for hiding this comment

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

What about "getGeneralInstrumentation"?

Copy link
Member

Choose a reason for hiding this comment

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

What about "getGeneralInstrumentation"?

I like this for general, but symmetric naming yields getJavaInstrumentation(name), which makes it sound like its accessing the instrumentation rather than the config for the instrumentation.

Not that getInstrumentationJava(name) is especially obvious either, but at least the method name reflects the path to the YAML node being accessed.

Copy link
Member

Choose a reason for hiding this comment

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

maybe

  • getInstrumentation(name)
  • getGeneralInstrumentation()

with the idea that the "Java" is redundant for the Java SDK

Copy link
Member

Choose a reason for hiding this comment

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

Is getInstrumentation(name) too close to getInstrumentationConfig() given the difference in function?

Copy link
Member

Choose a reason for hiding this comment

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

is there a way we could remove getInstrumentationConfig()?

what if we added something like .exists() to DeclarativeConfigurationProperties for the few people who may care about the difference between intermediate nodes being present or not

Copy link
Member

Choose a reason for hiding this comment

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

I'm not particularly attached to it, but there's the bit about it being part of the spec. Of course the spec can be changed. But the path of least resistance for the short term is to find method names that jive with the current spec and which can be characterized as syntactic sugar. The spec doesn't prohibit syntactic sugar so it's the sweet spot where we can improve usability quickly.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not particularly attached to it, but there's the bit about it being part of the spec. Of course the spec can be changed. But the path of least resistance for the short term is to find method names that jive with the current spec and which can be characterized as syntactic sugar. The spec doesn't prohibit syntactic sugar so it's the sweet spot where we can improve usability quickly.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not particularly attached to it, but there's the bit about it being part of the spec. Of course the spec can be changed. But the path of least resistance for the short term is to find method names that jive with the current spec and which can be characterized as syntactic sugar. The spec doesn't prohibit syntactic sugar so it's the sweet spot where we can improve usability quickly.

Copy link
Member Author

Choose a reason for hiding this comment

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

I went for

  • getInstrumentationConfig
  • getGeneralInstrumentationConfig

now based on the feedback. Let me know what you think.

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants