Skip to content

Commit

Permalink
Merge branch 'main' into update-otlp-proto-exporter-protobuf-7.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
seemk authored Nov 22, 2022
2 parents 6282882 + c9a3494 commit 06a4969
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 2 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ All notable changes to experimental packages in this project will be documented

### :bug: (Bug Fix)

* fix(instrumentation-xhr): http.url attribute should be absolute [#3200](https://github.com/open-telemetry/opentelemetry-js/pull/3200) @t2t2

### :books: (Refine Doc)

### :house: (Internal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,17 @@ describe('fetch', () => {
`event ${PTN.REQUEST_START} is not defined`
);
});

it('should have an absolute http.url attribute', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
const attributes = span.attributes;

assert.strictEqual(
attributes[SemanticAttributes.HTTP_URL],
location.origin + '/get',
`attributes ${SemanticAttributes.HTTP_URL} is wrong`
);
});
});

describe('when PerformanceObserver is undefined', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export class XMLHttpRequestInstrumentation extends InstrumentationBase<XMLHttpRe
kind: api.SpanKind.CLIENT,
attributes: {
[SemanticAttributes.HTTP_METHOD]: method,
[SemanticAttributes.HTTP_URL]: url,
[SemanticAttributes.HTTP_URL]: parseUrl(url).toString(),
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,17 @@ describe('xhr', () => {
`event ${PTN.REQUEST_START} is not defined`
);
});

it('should have an absolute http.url attribute', () => {
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
const attributes = span.attributes;

assert.strictEqual(
attributes[SemanticAttributes.HTTP_URL],
location.origin + '/get',
`attributes ${SemanticAttributes.HTTP_URL} is wrong`
);
});
});

});
Expand Down

0 comments on commit 06a4969

Please sign in to comment.