Skip to content

Commit bc9244f

Browse files
chore: variable names cleanup (#1536)
Co-authored-by: Daniel Dyla <[email protected]>
1 parent 9b3ff19 commit bc9244f

File tree

1 file changed

+11
-11
lines changed
  • examples/tracer-web/examples/fetch

1 file changed

+11
-11
lines changed

examples/tracer-web/examples/fetch/index.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,28 @@ const getData = (url) => fetch(url, {
3939

4040
// example of keeping track of context between async operations
4141
const prepareClickEvent = () => {
42-
const url1 = 'https://httpbin.org/get';
42+
const url = 'https://httpbin.org/get';
4343

4444
const element = document.getElementById('button1');
4545

4646
const onClick = () => {
47-
const span1 = webTracerWithZone.startSpan(`files-series-info`, {
47+
const singleSpan = webTracerWithZone.startSpan(`files-series-info`, {
4848
parent: webTracerWithZone.getCurrentSpan(),
4949
});
50-
webTracerWithZone.withSpan(span1, () => {
51-
getData(url1).then((_data) => {
52-
webTracerWithZone.getCurrentSpan().addEvent('fetching-span1-completed');
53-
span1.end();
50+
webTracerWithZone.withSpan(singleSpan, () => {
51+
getData(url).then((_data) => {
52+
webTracerWithZone.getCurrentSpan().addEvent('fetching-single-span-completed');
53+
singleSpan.end();
5454
});
5555
});
5656
for (let i = 0, j = 5; i < j; i += 1) {
57-
const span1 = webTracerWithZone.startSpan(`files-series-info-${i}`, {
57+
const span = webTracerWithZone.startSpan(`files-series-info-${i}`, {
5858
parent: webTracerWithZone.getCurrentSpan(),
5959
});
60-
webTracerWithZone.withSpan(span1, () => {
61-
getData(url1).then((_data) => {
62-
webTracerWithZone.getCurrentSpan().addEvent('fetching-span1-completed');
63-
span1.end();
60+
webTracerWithZone.withSpan(span, () => {
61+
getData(url).then((_data) => {
62+
webTracerWithZone.getCurrentSpan().addEvent(`fetching-span-${i}-completed`);
63+
span.end();
6464
});
6565
});
6666
}

0 commit comments

Comments
 (0)