Skip to content

Commit

Permalink
fix: apply round in zipkin annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeEmerim committed Sep 27, 2023
1 parent 2499708 commit 411c40d
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 [#]() @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 411c40d

Please sign in to comment.