Skip to content

feat: Return API and scanner version in the metrics output.#647

Merged
jnioche merged 1 commit intomainfrom
266-return-api-and-scanner-version-in-the-metrics-output
Dec 20, 2024
Merged

feat: Return API and scanner version in the metrics output.#647
jnioche merged 1 commit intomainfrom
266-return-api-and-scanner-version-in-the-metrics-output

Conversation

@demeringo
Copy link
Collaborator

Two new labels are added to all the metrics: cloud_scanner_version and boaviztapi_version.

Per example:

# HELP boavizta_gwp_use_kgco2eq Global Warming Potential of use.
# TYPE boavizta_gwp_use_kgco2eq gauge
boavizta_gwp_use_kgco2eq{awsregion="eu-west-3",country="FRA",cloud_scanner_version="4.5.6",boaviztapi_version="v1.2.3"} 0.6

2 new labels are added to the metrics: cloud_scanner_version and boaviztapi_version.
@demeringo demeringo linked an issue Dec 19, 2024 that may be closed by this pull request
@demeringo demeringo requested a review from jnioche December 19, 2024 19:11
@jnioche
Copy link
Collaborator

jnioche commented Dec 20, 2024

I was picturing more something like

cloud_scanner_version{awsregion="eu-west-3",country="FRA"} "4.5.6"
boaviztapi_version{awsregion="eu-west-3",country="FRA"} "v1.2.3"

assuming of course that the values can be strings. Attaching this info to every single metric generated is useful only if you want to filter based on them. I suppose if you had several instances of CS storing into Prometheus at the same time then that could be relevant. Is that the idea? You could then compare the results for different versions of the API for instance.

@demeringo
Copy link
Collaborator Author

demeringo commented Dec 20, 2024

I fully agree on the principle but I think that OpenMetrics / Prometheus metrics format only support numerical values (not string).
I believe that the only way to have strings is to use the labels.

Yes the general idea behind this PR is to provide info to end user in the context of where we collects data during a long time span. In this case we may collect metrics that span several versions of API and as we have seen the values returned for the same resource may evolved with new API version. This can help identify the reason for a change in value.

@jnioche
Copy link
Collaborator

jnioche commented Dec 20, 2024

I think you are right about the values being numerical only
https://stackoverflow.com/questions/65850083/prometheus-java-client-export-string-based-metrics

Let's go for what you suggested

@jnioche jnioche added the enhancement New feature or request label Dec 20, 2024
@jnioche jnioche added this to the 3.2.0 milestone Dec 20, 2024
@jnioche jnioche merged commit 2e89144 into main Dec 20, 2024
3 checks passed
@jnioche jnioche deleted the 266-return-api-and-scanner-version-in-the-metrics-output branch December 20, 2024 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Return API and scanner version in the metrics output

2 participants