Skip to content

Commit

Permalink
Add doubleValue support to OTLP
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshyDev committed Jan 1, 2023
1 parent 2a29509 commit 1ea04f8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-drinks-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"workers-tracing": patch
---

Add support for doubleValue to OTLP
8 changes: 6 additions & 2 deletions src/transformers/otlp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface OtlpValue {
stringValue?: string;
intValue?: number;
boolValue?: boolean;
// TODO: double?
doubleValue?: number;

arrayValue?: { values: OtlpValue[] };
}
Expand Down Expand Up @@ -116,7 +116,11 @@ export class OtlpTransformer extends TraceTransformer {
if (typeof value === 'string') {
return { stringValue: value };
} else if (typeof value === 'number') {
return { intValue: value };
if (Number.isInteger(value)) {
return { intValue: value };
} else {
return { doubleValue: value };
}
} else if (typeof value === 'boolean') {
return { boolValue: value };
} else {
Expand Down

0 comments on commit 1ea04f8

Please sign in to comment.