Skip to content

Commit 96c6f79

Browse files
committed
fix(exporter-collector): proper data types for int and double
1 parent 03e741b commit 96c6f79

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/opentelemetry-exporter-collector/src/transform.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,14 @@ export function toCollectorAnyValue(
9595
anyValue.stringValue = value;
9696
} else if (typeof value === 'boolean') {
9797
anyValue.boolValue = value;
98+
} else if (
99+
typeof value === 'number' &&
100+
value <= 2147483647 &&
101+
value >= -2147483648 &&
102+
Number.isInteger(value)
103+
) {
104+
anyValue.intValue = value;
98105
} else if (typeof value === 'number') {
99-
// all numbers will be treated as double
100106
anyValue.doubleValue = value;
101107
} else if (Array.isArray(value)) {
102108
anyValue.arrayValue = toCollectorArrayValue(value);

0 commit comments

Comments
 (0)