Skip to content

Commit

Permalink
fix(prometheus-serializer): correct string used for NaN (#3477)
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonWeber authored Dec 13, 2022
1 parent e3a81d2 commit 6410ca1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ All notable changes to experimental packages in this project will be documented
* fix(instrumentation): only call `onRequire` for full matches on core modules with sub-paths [#3451](https://github.com/open-telemetry/opentelemetry-js/pull/3451) @mhassan1
* fix(instrumentation): add back support for absolute paths via `require-in-the-middle` [#3457](https://github.com/open-telemetry/opentelemetry-js/pull/3457) @mhassan1
* fix(prometheus-sanitization): replace repeated `_` with a single `_` [3470](https://github.com/open-telemetry/opentelemetry-js/pull/3470) @samimusallam
* fix(prometheus-serializer): correct string used for NaN [#3477](https://github.com/open-telemetry/opentelemetry-js/pull/3477) @JacksonWeber

### :books: (Refine Doc)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function enforcePrometheusNamingConvention(

function valueString(value: number) {
if (Number.isNaN(value)) {
return 'Nan';
return 'NaN';
} else if (!Number.isFinite(value)) {
if (value < 0) {
return '-Inf';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ describe('PrometheusSerializer', () => {
it('should serialize non-finite values', async () => {
const serializer = new PrometheusSerializer();
const cases = [
[NaN, 'Nan'],
[NaN, 'NaN'],
[-Infinity, '-Inf'],
[+Infinity, '+Inf'],
] as [number, string][];
Expand Down

0 comments on commit 6410ca1

Please sign in to comment.