You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Add a BaggageSpanProcessor to use in the web SDK, similar to what exists today in the Node Distro, to easily add attributes to downstream spans in a trace using baggage.
Describe the solution you'd like
#13 specifically references using a shared package extracted out from the Node Distro and packaged separately to use in both places. For now we're going to essentially copy the functionality into here, and separate the shared dependency later.
The text was updated successfully, but these errors were encountered:
## Which problem is this PR solving?
- Closes#66
## Short description of the changes
- Add BaggageSpanProcessor, and configure it in the span processor
builder
- Add and update tests to confirm baggage gets added as span attributes
- Add debug log for entries in baggage
## How to verify that this has the expected result
In the example app, add something to baggage and see it show up as an
attribute on a span created from parent context:
```js
const tracer = trace.getTracer('example-tracer');
// new context based on current, with key/values added to baggage
const ctx = propagation.setBaggage(
context.active(),
propagation.createBaggage({
for_the_spans: { value: 'important value' },
}),
);
// starting a new span on the tracer using the saved context
context.with(ctx, () => {
tracer.startActiveSpan('heygirl', (span) => {
// do work here
span.end();
})
})
```

or nest even further to get on downstream spans as well
```js
const tracer = trace.getTracer('example-tracer');
// new context based on current, with key/values added to baggage
const ctx = propagation.setBaggage(
context.active(),
propagation.createBaggage({
for_the_spans: { value: 'important value' },
}),
);
// starting a new span on the tracer using the saved context
context.with(ctx, () => {
tracer.startActiveSpan('heygirl', (span) => {
// do work here
context.with(trace.setSpan(context.active(), span), () => {
tracer.startActiveSpan('heygirl2', (childspan) => {
// do work here
childspan.end();
});
span.end();
})
})
});
```

Is your feature request related to a problem? Please describe.
Add a BaggageSpanProcessor to use in the web SDK, similar to what exists today in the Node Distro, to easily add attributes to downstream spans in a trace using baggage.
Describe the solution you'd like
#13 specifically references using a shared package extracted out from the Node Distro and packaged separately to use in both places. For now we're going to essentially copy the functionality into here, and separate the shared dependency later.
The text was updated successfully, but these errors were encountered: