Skip to content

Commit eebd278

Browse files
authored
Merge pull request #610 from metrico/fix/undef_time_unix_nano
fix for when timeUnixNano is undefined
2 parents c506c3a + f2338ec commit eebd278

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/handlers/otlp_log_push.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ async function handle (req, res) {
3030
}
3131
const labels = stringify(logAttrs)
3232
const fingerprint = fingerPrint(labels)
33-
const ts = BigInt(logRecord.timeUnixNano)
33+
const ts = logRecord.timeUnixNano
34+
? BigInt(logRecord.timeUnixNano)
35+
: logRecord.observedTimeUnixNano
36+
? BigInt(logRecord.observedTimeUnixNano)
37+
: BigInt(Date.now()) * BigInt(1000000)
3438
promises.push(bulk.add([[
3539
fingerprint,
3640
ts,

0 commit comments

Comments
 (0)