Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
fix(web): window hash (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
NavaBeginsky authored Jul 13, 2021
1 parent 5e426d6 commit d06a451
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/web/src/exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class EpsagonExporter extends CollectorTraceExporter {
}

convert(spans) {
console.log(spans)
try {
const convertedSpans = super.convert(spans);
const spansList = convertedSpans.resourceSpans[0].instrumentationLibrarySpans;
Expand Down Expand Up @@ -149,7 +150,7 @@ class EpsagonExporter extends CollectorTraceExporter {

spanErrs.push(spanStringError);
const attributesLength = this.addFinalGenericSpanAttrs(span.attributes, span.attributes.length, span);
span.name = window.location.pathname;
span.name = `${window.location.pathname}${window.location.hash}`;
span.events.unshift({
name: 'exception',
attributes: [
Expand Down
4 changes: 2 additions & 2 deletions packages/web/src/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ class EpsagonFormatter {
}

formatRouteChangeSpan(span, spanAttributes, attributesLength, userAgent) {
span.name = window.location.pathname;
span.name = `${window.location.pathname}${window.location.hash}`;
spanAttributes[attributesLength] = { key: 'http.request.headers.User-Agent', value: { stringValue: JSON.stringify(userAgent).replace(/"([^"]+)":/g, '$1:') } };
attributesLength++;
return attributesLength;
}

formatDocumentLoadSpan(span, spanAttributes, attributesLength) {
span.name = window.location.pathname;
span.name = `${window.location.pathname}${window.location.hash}`;
spanAttributes[attributesLength] = { key: 'type', value: { stringValue: 'browser' } };
attributesLength++;
spanAttributes[attributesLength] = { key: 'operation', value: { stringValue: 'page_load' } };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class EpsagonDocumentLoadInstrumentation extends DocumentLoadInstrumentation {
if (initialSpan && !this.epsParentSpan.currentSpan) {
this.epsParentSpan.currentSpan = initialSpan;
}
console.log(initialSpan)
this.addEpsSpanAttrs(initialSpan);
return initialSpan;
}
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/web-tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ function tag(key, value){
let _configData;

function init (configData) {
console.log('initializing')
_configData = configData;
if (configData.isEpsagonDisabled) {
return;
Expand Down

0 comments on commit d06a451

Please sign in to comment.