Skip to content

Add SpringInfoContributor #38356

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

Closed

Conversation

jonatan-ivanov
Copy link
Member

@jonatan-ivanov jonatan-ivanov commented Nov 14, 2023

This InfoContributor exposes information related to Spring projects through actuator's info endpoint as part of the Enhanced Observability effort: #25476
When configured, it looks like this:

"spring": {
    "framework": {
        "version": "6.1.0"
    },
    "boot": {
        "version": "3.2.0"
    },
    "profiles": ["default"]
}

The feature can be enabled by setting: management.info.spring.enabled=true.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 14, 2023
@jonatan-ivanov jonatan-ivanov mentioned this pull request Nov 14, 2023
15 tasks
@wilkinsona
Copy link
Member

#22924 is related to this.

@mdeinum
Copy link
Contributor

mdeinum commented Nov 15, 2023

Would it make sense to detect other used frameworks that can supply information as well? Like Spring Security, Spring Integration? Or maybe even provide a VersionInfo interface (or whatever it is) and that implementations can be auto-detected?

@jonatan-ivanov
Copy link
Member Author

@mdeinum In some of the cases, yes. E.g.: Spring Security seems possible, it has a similar class that tells you the version of it. But in other cases, not really: e.g.: Spring Data projects are versioned separately and as far as I know, the release train version is not available. Also, in case of Spring Cloud, the dependency is the other way: Boot does not depend on Cloud but Cloud depends on Boot, so here we will not be able to add the Cloud version but Cloud needs to add it (a VersionInfo interface can solve this issue though).

This InfoContributor exposes information related to Spring projects.
@mhalbritter mhalbritter added the status: pending-design-work Needs design work before any code can be developed label Jan 10, 2024
@mhalbritter
Copy link
Contributor

I like the idea of the portfolio project versions as an InfoContributor, but right now, it only shows the framework and the boot version. We should make this list more complete. I've put a "pending design work" label on it.

@wilkinsona
Copy link
Member

My feeling is that we should probably close this one. I agree with @mhalbritter that we should make the list of versions more complete. SBOM's are becoming increasingly popular and I think they are the right way to achieve that. An SBOM could be generated at build time using one of the existing build plugins and then, if desired, packaged in the application and exposed through an actuator endpoint.

@philwebb philwebb closed this Jan 11, 2024
@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged status: pending-design-work Needs design work before any code can be developed labels Jan 11, 2024
@jonatan-ivanov
Copy link
Member Author

What do you think about providing information about the effective profiles?

"spring": {
    "profiles": ["default"]
}

@wilkinsona
Copy link
Member

The env endpoint already provides that information.

@jonatan-ivanov
Copy link
Member Author

Isn't activeProfiles under the env endpoint "just" provide the value of environment.getActiveProfiles()?
If so, I'm not sure that's what I would need since that's not necessarily the "effective profile" that will be used.

For example, if I don't set the active profiles property but set spring.profiles.default, then environment.getActiveProfiles() will be empty and the profiles I set for default will be used. I think it would be useful to return the "effectively used profiles". Something like this (see in the PR):

this.profiles = ObjectUtils.isEmpty(environment.getActiveProfiles()) ? environment.getDefaultProfiles() : environment.getActiveProfiles();

@wilkinsona
Copy link
Member

wilkinsona commented Jan 19, 2024

Thanks, @jonatan-ivanov. Sorry, I'd missed the distinction you were making between effective and active. I think our best option here would be to add a new field to the env endpoint that shows the default profiles alongside the active profiles. I'd rather do that than change the meaning of the existing field.

I've opened #39245.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants