Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(exporter-zipkin): round timestamp to nearest integer in zipkin annotations #4167

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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