Skip to content

Commit

Permalink
fix(exporter-zipkin): round timestamp to nearest integer in zipkin an…
Browse files Browse the repository at this point in the history
…notations (#4167)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
  • Loading branch information
FelipeEmerim and pichlermarc authored Sep 28, 2023
1 parent 513d067 commit f0ceabc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
### :bug: (Bug Fix)

* fix(sdk-metrics): allow instrument names to contain '/' [#4155](https://github.com/open-telemetry/opentelemetry-js/pull/4155)
* fix(exporter-zipkin): round duration to the nearest int in annotations to be compliant with zipkin protocol [#4167](https://github.com/open-telemetry/opentelemetry-js/pull/4167) @FelipeEmerim

### :books: (Refine Doc)

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-exporter-zipkin/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function _toZipkinAnnotations(
events: TimedEvent[]
): zipkinTypes.Annotation[] {
return events.map(event => ({
timestamp: hrTimeToMicroseconds(event.time),
timestamp: Math.round(hrTimeToMicroseconds(event.time)),
value: event.name,
}));
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('transform', () => {
annotations: [
{
value: 'my-event',
timestamp: hrTimeToMicroseconds(span.events[0].time),
timestamp: Math.round(hrTimeToMicroseconds(span.events[0].time)),
},
],
duration: Math.round(
Expand Down Expand Up @@ -329,11 +329,11 @@ describe('transform', () => {
assert.deepStrictEqual(annotations, [
{
value: 'my-event1',
timestamp: hrTimeToMicroseconds(span.events[0].time),
timestamp: Math.round(hrTimeToMicroseconds(span.events[0].time)),
},
{
value: 'my-event2',
timestamp: hrTimeToMicroseconds(span.events[1].time),
timestamp: Math.round(hrTimeToMicroseconds(span.events[1].time)),
},
]);
});
Expand Down

0 comments on commit f0ceabc

Please sign in to comment.