Skip to content

Commit

Permalink
feat(otel): Add support for non-tuple OTEL time.
Browse files Browse the repository at this point in the history
  • Loading branch information
onurtemizkan committed Jun 28, 2024
1 parent c548c3c commit 5c25ba1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/opentelemetry/src/utils/convertOtelTimeToSeconds.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/** Convert an OTEL time to seconds */
export function convertOtelTimeToSeconds([seconds, nano]: [number, number]): number {
export function convertOtelTimeToSeconds(otelTime: [number, number] | number): number {
if (!Array.isArray(otelTime)) {
return otelTime;
}

const [seconds, nano] = otelTime;

return seconds + nano / 1_000_000_000;
}

0 comments on commit 5c25ba1

Please sign in to comment.