Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add documentation on ContextManagers and Zone.js #386

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

Comment on lines +137 to +152
### Context Management
OpenTelemetry uses the concept of a [Context Manager](https://opentelemetry.io/docs/languages/js/context/#context-manager) to store propagate global span context through your system. OpenTelemetry provides a context manager for browser instrumentation based on the [Zone.js](https://github.com/angular/angular/tree/main/packages/zone.js) library to track global context across asynchronous execution threads. This context manager can be plugged into this instrumentation like so:

```js
import { ZoneContextManager } from '@opentelemetry/context-zone';

const sdk = new HoneycombWebSDK({
// other config options omitted...
contextManager: new ZoneContextManager()
});
sdk.start();
```

Zone.js has known limitations with async/await code, and [requires](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-context-zone-peer-dep#installation) your code to be transpiled down to ES2015. It also may carry a performance penalty.

For these reasons, we do not enable ZoneContextManager by default.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the primary change, the rest is reformatting the tables to be easier to read in plain text.

@MustafaHaddara MustafaHaddara added type: documentation Improvements or additions to documentation version: no bump A PR with maintenance or doc changes that aren't included in a release. labels Nov 8, 2024
@MustafaHaddara MustafaHaddara marked this pull request as ready for review November 8, 2024 18:04
@MustafaHaddara MustafaHaddara requested a review from a team as a code owner November 8, 2024 18:04
@MustafaHaddara MustafaHaddara merged commit 8c1213c into main Nov 8, 2024
17 checks passed
@MustafaHaddara MustafaHaddara deleted the mh/context-docs branch November 8, 2024 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation Improvements or additions to documentation version: no bump A PR with maintenance or doc changes that aren't included in a release.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants