fix(zipkin-exporter): round duration for zipkin (#4064)
Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
This commit is contained in:
parent
5259a0b928
commit
b400c2e5d9
|
|
@ -15,6 +15,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
|
|||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
* fix(exporter-zipkin): rounding duration to the nearest int to be compliant with zipkin protocol [#4064](https://github.com/open-telemetry/opentelemetry-js/pull/4064) @n0cloud
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
### :house: (Internal)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export function toZipkinSpan(
|
|||
id: span.spanContext().spanId,
|
||||
kind: ZIPKIN_SPAN_KIND_MAPPING[span.kind],
|
||||
timestamp: hrTimeToMicroseconds(span.startTime),
|
||||
duration: hrTimeToMicroseconds(span.duration),
|
||||
duration: Math.round(hrTimeToMicroseconds(span.duration)),
|
||||
localEndpoint: { serviceName },
|
||||
tags: _toZipkinTags(span, statusCodeTagName, statusErrorTagName),
|
||||
annotations: span.events.length
|
||||
|
|
|
|||
|
|
@ -85,8 +85,8 @@ describe('transform', () => {
|
|||
timestamp: hrTimeToMicroseconds(span.events[0].time),
|
||||
},
|
||||
],
|
||||
duration: hrTimeToMicroseconds(
|
||||
hrTimeDuration(span.startTime, span.endTime)
|
||||
duration: Math.round(
|
||||
hrTimeToMicroseconds(hrTimeDuration(span.startTime, span.endTime))
|
||||
),
|
||||
id: span.spanContext().spanId,
|
||||
localEndpoint: {
|
||||
|
|
@ -128,8 +128,8 @@ describe('transform', () => {
|
|||
assert.deepStrictEqual(zipkinSpan, {
|
||||
kind: 'SERVER',
|
||||
annotations: undefined,
|
||||
duration: hrTimeToMicroseconds(
|
||||
hrTimeDuration(span.startTime, span.endTime)
|
||||
duration: Math.round(
|
||||
hrTimeToMicroseconds(hrTimeDuration(span.startTime, span.endTime))
|
||||
),
|
||||
id: span.spanContext().spanId,
|
||||
localEndpoint: {
|
||||
|
|
@ -179,8 +179,8 @@ describe('transform', () => {
|
|||
assert.deepStrictEqual(zipkinSpan, {
|
||||
kind: item.zipkin,
|
||||
annotations: undefined,
|
||||
duration: hrTimeToMicroseconds(
|
||||
hrTimeDuration(span.startTime, span.endTime)
|
||||
duration: Math.round(
|
||||
hrTimeToMicroseconds(hrTimeDuration(span.startTime, span.endTime))
|
||||
),
|
||||
id: span.spanContext().spanId,
|
||||
localEndpoint: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue