Skip to content

Conversation

zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Jul 8, 2025

Fixes #7469

Adds a dedicated SPI to load a declarative config for a distro:

public interface DeclarativeConfigurationProvider {
  /**
   * Returns an OpenTelemetry configuration model to be used when configuring the SDK, or {@code
   * null} if no configuration is provided by this provider.
   */
  @Nullable
  OpenTelemetryConfigurationModel getConfigurationModel();
}

The added test illustrates how to use the SPI:

public class TestDeclarativeConfigurationProvider implements DeclarativeConfigurationProvider {
  @Override
  public OpenTelemetryConfigurationModel getConfigurationModel() {
    String yaml =
        "file_format: \"1.0-rc.1\"\n"
            + "resource:\n"
            + "  attributes:\n"
            + "    - name: service.name\n"
            + "      value: test\n"
            + "tracer_provider:\n"
            + "  processors:\n"
            + "    - simple:\n"
            + "        exporter:\n"
            + "          console: {}\n";

    return DeclarativeConfiguration.parse(
        new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8)));
  }
}

@zeitlinger zeitlinger requested a review from a team as a code owner July 8, 2025 14:17
@zeitlinger zeitlinger self-assigned this Jul 8, 2025
Copy link

codecov bot commented Jul 9, 2025

Codecov Report

❌ Patch coverage is 90.19608% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.99%. Comparing base (63d4617) to head (07c61ef).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...pentelemetry/sdk/autoconfigure/IncubatingUtil.java 88.88% 3 Missing and 1 partial ⚠️
...nfigure/AutoConfiguredOpenTelemetrySdkBuilder.java 93.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #7472   +/-   ##
=========================================
  Coverage     89.99%   89.99%           
- Complexity     7079     7086    +7     
=========================================
  Files           803      803           
  Lines         21412    21434   +22     
  Branches       2086     2090    +4     
=========================================
+ Hits          19269    19290   +21     
+ Misses         1479     1478    -1     
- Partials        664      666    +2     

☔ 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.

@zeitlinger
Copy link
Member Author

@jack-berg please have a look 😄

@zeitlinger zeitlinger force-pushed the declarative-config-order branch from 1fcf3a4 to 23e1c14 Compare July 23, 2025 09:58
@zeitlinger
Copy link
Member Author

@jkwatson please have a look

@jkwatson
Copy link
Contributor

jkwatson commented Sep 1, 2025

This seems ok to me, but I don't have the background on the issue, and it seemed like Jack had some hesitation on the original issue. I don't see that resolved in that discussion. Was there a resolution that wasn't communicated in the discussion there?

@zeitlinger
Copy link
Member Author

This seems ok to me, but I don't have the background on the issue, and it seemed like Jack had some hesitation on the original issue. I don't see that resolved in that discussion. Was there a resolution that wasn't communicated in the discussion there?

you're right - I missed that. I'll have to think about it again.

@zeitlinger zeitlinger marked this pull request as draft September 1, 2025 16:00
@zeitlinger zeitlinger force-pushed the declarative-config-order branch from 23e1c14 to 5b81ef8 Compare September 2, 2025 13:02
@zeitlinger zeitlinger marked this pull request as ready for review September 2, 2025 14:59
@zeitlinger
Copy link
Member Author

This seems ok to me, but I don't have the background on the issue, and it seemed like Jack had some hesitation on the original issue. I don't see that resolved in that discussion. Was there a resolution that wasn't communicated in the discussion there?

you're right - I missed that. I'll have to think about it again.

@jkwatson now I added a new interface to address the distro use case

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.

AutoConfiguredOpenTelemetrySdk should not invoke old callbacks in declarative config mode
3 participants