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

Custom spans #141

Merged

Conversation

crdgonzalezca
Copy link
Contributor

Update the user interaction client example creating custom spans for the different tasks the click handler runs.
Also, update a little the documentation on how to do it. I know the documentation is not complete now, however, it will be completely updated later in the next weeks for productionization, for now just update a bit the documentation on this.

@codecov-io
Copy link

codecov-io commented Jul 17, 2019

Codecov Report

Merging #141 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #141   +/-   ##
=======================================
  Coverage   96.33%   96.33%           
=======================================
  Files          31       31           
  Lines         928      928           
  Branches      144      144           
=======================================
  Hits          894      894           
  Misses         34       34

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8abcac...ebfc930. Read the comment docs.

Copy link
Contributor

@draffensperger draffensperger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Could you also create a test case that has a custom span?

examples/user_interaction/client/src/App.js Outdated Show resolved Hide resolved
examples/user_interaction/client/src/App.js Outdated Show resolved Hide resolved
@crdgonzalezca
Copy link
Contributor Author

Requested changes are done. Ready to review.

this.callSleepApi();
});
}

callSleepApi() {
const xhr = new XMLHttpRequest();
// Create a child span for the XHR.
const callSleepApiCustomSpan = tracing.tracer.startChildSpan({ name: 'Call Sleep API' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you think about removing this custom span since there will already be one for the XHR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep it. My thought is to show in the example that is possible to create custom spans even if those tasks already generate automatic spans. I will add some comments to clarify more this example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think it's fine to keep. Is there another call that does not have a custom span on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the call to prime numbers API does not have a custom span, as it also is an XHR, I decided to not create a custom span for that.

this.callSleepApi();
});
}

callSleepApi() {
const xhr = new XMLHttpRequest();
// Create a child span for the XHR.
const callSleepApiCustomSpan = tracing.tracer.startChildSpan({ name: 'Call Sleep API' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think it's fine to keep. Is there another call that does not have a custom span on it?

@draffensperger draffensperger merged commit 423b608 into census-instrumentation:master Jul 19, 2019
@crdgonzalezca crdgonzalezca deleted the custom_spans branch July 24, 2019 15:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants