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

feat: add diag warning when metric name is invalid #2122

Merged
merged 11 commits into from
Apr 22, 2021

Conversation

weyert
Copy link
Contributor

@weyert weyert commented Apr 19, 2021

Which problem is this PR solving?

If you are using the metric kind counter Prometheus expects the
metric name to have the suffix _total as it will throw the following
error:

failed_requests counter metrics should have "_total" suffix

This commit logs a warning message when the diag log level is DEBUG to
assist implementors

Short description of the changes

Adds a log warning when an invalid metric name is given

If you are using the metric kind `counter` Prometheus expects the
metric name to have the suffix `_total` as it will throw the following
error:

```
failed_requests counter metrics should have "_total" suffix

```

This commit logs a warning message when the diag log level is DEBUG to
assist implementors
Copy link
Member

@naseemkullah naseemkullah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@codecov
Copy link

codecov bot commented Apr 19, 2021

Codecov Report

Merging #2122 (99abebf) into main (a0385c4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 99abebf differs from pull request most recent head 9130227. Consider uploading reports for the commit 9130227 to get more accurate results

@@           Coverage Diff           @@
##             main    #2122   +/-   ##
=======================================
  Coverage   92.75%   92.76%           
=======================================
  Files         140      140           
  Lines        4981     4987    +6     
  Branches     1028     1029    +1     
=======================================
+ Hits         4620     4626    +6     
  Misses        361      361           
Impacted Files Coverage Δ
...ry-exporter-prometheus/src/PrometheusSerializer.ts 98.18% <100.00%> (+0.10%) ⬆️

@weyert
Copy link
Contributor Author

weyert commented Apr 19, 2021

Added unit test :)

@dyladan dyladan added the enhancement New feature or request label Apr 19, 2021
@weyert
Copy link
Contributor Author

weyert commented Apr 21, 2021

@naseemkullah I have moved it into its own function for now.

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, hope you can address the comment before merging

@weyert
Copy link
Contributor Author

weyert commented Apr 22, 2021

lgtm, hope you can address the comment before merging

updated it :)

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.

6 participants