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

refactor(exporter-prometheus): remove unnecessary isNaN() check #5377

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Jan 27, 2025

Which problem is this PR solving?

Not a problem, but the valueString() function can be simplified a bit.

Fixes N/A

Short description of the changes

This commit removes special handling of NaN values when converting JavaScript numbers to Prometheus strings. The NaN case can be combined with the case for finite numbers, as JavaScript already stringifies NaN to the expected value.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Ran the test suite and added an additional test case.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added

@cjihrig cjihrig requested a review from a team as a code owner January 27, 2025 14:25
This commit removes special handling of NaN values when
converting JavaScript numbers to Prometheus strings. The NaN
case can be combined with the case for finite numbers, as
JavaScript already stringifies NaN to the expected value.
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.63%. Comparing base (bdc0e3a) to head (645c2f4).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5377      +/-   ##
==========================================
+ Coverage   94.62%   94.63%   +0.01%     
==========================================
  Files         318      318              
  Lines        8038     8035       -3     
  Branches     1687     1685       -2     
==========================================
- Hits         7606     7604       -2     
+ Misses        432      431       -1     
Files with missing lines Coverage Δ
...ry-exporter-prometheus/src/PrometheusSerializer.ts 95.77% <100.00%> (+0.60%) ⬆️

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

thanks 👍

@pichlermarc pichlermarc added this pull request to the merge queue Jan 27, 2025
Merged via the queue into open-telemetry:main with commit 321c31f Jan 27, 2025
15 checks passed
@cjihrig cjihrig deleted the prom-val-str branch January 27, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants