Skip to content

Commit

Permalink
fix(exporter-collector): proper data types for int and double
Browse files Browse the repository at this point in the history
  • Loading branch information
kudlatyamroth committed Feb 17, 2021
1 parent 03e741b commit 96c6f79
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/opentelemetry-exporter-collector/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,14 @@ export function toCollectorAnyValue(
anyValue.stringValue = value;
} else if (typeof value === 'boolean') {
anyValue.boolValue = value;
} else if (
typeof value === 'number' &&
value <= 2147483647 &&
value >= -2147483648 &&
Number.isInteger(value)
) {
anyValue.intValue = value;
} else if (typeof value === 'number') {
// all numbers will be treated as double
anyValue.doubleValue = value;
} else if (Array.isArray(value)) {
anyValue.arrayValue = toCollectorArrayValue(value);
Expand Down

0 comments on commit 96c6f79

Please sign in to comment.