micrometer-metrics / micrometer

An application observability facade for the most popular observability tools. Think SLF4J, but for observability.
https://micrometer.io
Apache License 2.0
4.44k stars 979 forks source link

Provide binders for Git and Build information #3154

Open mafr opened 2 years ago

mafr commented 2 years ago

Description There has been some discussion at the Spring Boot project about exposing information like the Git commit ID and Maven coordinates as metrics, similar in style to the existing JvmInfoMetrics binder. For consistency, we would provide the same information that Spring Boot's Actuator exposes on its /actuator/info endpoint.

The binders would receive the data via constructor arguments and add a constant gauge with tags for all attributes we want to expose. If some values are null, we would add a marker string ("unknown", "null", "N/A") to make sure all tags are always present.

Example:

git_info{app="some-service", branch="main", id="cafecafe", time="2022-04-26T18:39:18Z"} 1.0
build_info{app="some-service", name="Some Service", artifact="some-service", group="org.example", version="1.7", time="2022-04-28T12:01:07Z"} 1.0

This issue is intended to discuss whether this is a worthwhile addition and to discuss the design if the team decides to proceed.

Rationale Adding metrics binders to Micrometer would provide standardization of these metrics across all users of Micrometer, not just Spring Boot. The new metrics would be useful in Grafana dashboards, for example, to display which exact commit/version is currently deployed.

Additional context

jonatan-ivanov commented 2 years ago

@shakuzen fyi

jonatan-ivanov commented 1 year ago

@mafr Would you be up to opening a PR for this in Micrometer? It would be somewhat similar to the PR you opened for Boot, except we could copy the whole/partial GitProperties/BuildProperties classes. Then once Micrometer has this, we can add auto-configuration to Boot.

ardetrick commented 10 months ago

Hi @jonatan-ivanov - I've never made a contribution here before but I saw the "help wanted" tag and figured I would give it a try. Would appreciate your opinion on my PR and if it meets the desires and goals of this issue. Thanks!

ardetrick commented 10 months ago

Hi @jonatan-ivanov and @shakuzen - was wondering if either of you would be willing to take a look the PR I opened for this issue. Would great appreciate your opinions or an update on if this change is still of interest to micrometer. Thanks!

marcingrzejszczak commented 8 months ago

@ardetrick we will look into this ASAP, sorry for the big delay

ardetrick commented 8 months ago

Thanks @marcingrzejszczak - I know this is a busy time of the year but I eagerly await your team's feedback when you get a chance to take a look.

ardetrick commented 7 months ago

@marcingrzejszczak just want to put this back on you radar - thanks!