Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TracingProperties exposes package-private PropagationType from public methods #39265

Conversation

vj-atlassian
Copy link
Contributor

PropagationType enum is non-public outside of TracingProperties class which makes it unusable. I would request you to make it accessible so that we can access it to make customisation in tracing needs within our services.

@pivotal-cla
Copy link

@vj-atlassian Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 22, 2024
@pivotal-cla
Copy link

@vj-atlassian Thank you for signing the Contributor License Agreement!

@wilkinsona
Copy link
Member

We don't really consider the Java API of the configuration properties classes to be public API. Can you please describe what you're doing with TracingProperties?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Jan 22, 2024
@vj-atlassian
Copy link
Contributor Author

vj-atlassian commented Jan 22, 2024

Sure. So we have our own customisation over Spring Boot provided tracing, where we support both W3C and B3 context propagation simultaneously. While Spring Boot doesn't support multiple tracing propagators but we do and have a code something like:

for (String propType : propagationTypes) {
    switch (propType.toUpperCase()) {
        case "W3C" -> propagators.add(...);
        case "B3" -> propagators.add(...);
        default -> {}
    }
}

where propogationTypes refers to the spring boot property - management.tracing.propagation.type. Now, since the API is not available/public, I had to hardcode strings (W3C, B3) unnecessarily or the other option is duplicate the enum in my code (which didn't make sense IMO).

As per the Java API, I see that almost every other class is accessible publicly in TracingProperties but just the TracingProperties.Propagation.PropagationType. Not sure if that was intentional though.

Let me know if that helps!

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jan 22, 2024
@philwebb
Copy link
Member

I think in this case it's an oversight that PropagationType isn't public. It's returned from the public Propagation.getEffectiveConsumedTypes() method so in my opinion either everything should be package-private or the enum should be public.

@philwebb philwebb added the for: team-attention An issue we'd like other members of the team to review label Jan 22, 2024
@philwebb
Copy link
Member

Flagging to see if others in the team agree.

@wilkinsona
Copy link
Member

Fine by me. The current part public, part package-private arrangement isn't ideal.

More broadly, I do wonder if we should change our policy about @ConfigurationProperties classes. While we document that they're not really public API they are, in Java terms, public API so it's almost inevitable that people will use them. We even encourage some usage ourselves.

@philwebb philwebb added type: bug A general bug and removed for: team-attention An issue we'd like other members of the team to review status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Jan 22, 2024
@philwebb philwebb added this to the 3.1.x milestone Jan 22, 2024
@philwebb philwebb changed the title Making propagation type public TracingProperties exposes package-private PropagationType from public methods Jan 22, 2024
@philwebb philwebb self-assigned this Jan 22, 2024
philwebb pushed a commit that referenced this pull request Jan 22, 2024
The PropagationType enum is returned from public methods so
should be public itself.

See gh-39265
philwebb added a commit that referenced this pull request Jan 22, 2024
@philwebb philwebb closed this in bc75751 Jan 22, 2024
@philwebb philwebb modified the milestones: 3.1.x, 3.1.9 Jan 22, 2024
@philwebb
Copy link
Member

Thanks very much @vj-atlassian, this has now been merged into 3.1.x and forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants