Skip to content

Commit

Permalink
fix(opentelemetry-plugin-xml-http-request): define span kind as CLIEN…
Browse files Browse the repository at this point in the history
…T for xmlhttprequests (#1002)
  • Loading branch information
ivansenic authored May 1, 2020
1 parent d246c54 commit 6cf5406
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/opentelemetry-plugin-xml-http-request/src/xhr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ export class XMLHttpRequestPlugin extends BasePlugin<XMLHttpRequest> {
}

const currentSpan = this._tracer.startSpan(url, {
kind: api.SpanKind.CLIENT,
attributes: {
[AttributeNames.COMPONENT]: this.component,
[AttributeNames.HTTP_METHOD]: method,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,15 @@ describe('xhr', () => {
assert.strictEqual(span.name, url, 'span has wrong name');
});

it('span should have correct kind', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
assert.strictEqual(
span.kind,
types.SpanKind.CLIENT,
'span has wrong kind'
);
});

it('span should have correct attributes', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
const attributes = span.attributes;
Expand Down

0 comments on commit 6cf5406

Please sign in to comment.