-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add OpenTelemetry Node SDK docs #5760
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
e5d15a1
Add OpenTelemetry Node SDK docs
AbhiPrasad f70cc14
use correct snippet
AbhiPrasad 2cf0425
Update src/platforms/common/performance/instrumentation/opentelemetry…
mydea 10e1c71
Update src/platforms/common/performance/instrumentation/opentelemetry…
mydea 3e2b794
Update src/platform-includes/performance/opentelemetry-install/node.mdx
mydea aafc9ac
fix usage
mydea df03993
fix otel yarn install
mydea d28c563
Update src/platform-includes/performance/opentelemetry-setup/node.mdx
mydea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/platform-includes/performance/opentelemetry-install/node.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
```bash {tabTitle:npm} | ||
npm install @sentry/node @sentry/opentelemetry-node | ||
``` | ||
|
||
```bash {tabTitle:yarn} | ||
yarn add @sentry/node @sentry/opentelemetry-node | ||
``` | ||
|
||
<Note> | ||
|
||
Note that @sentry/opentelemetry-node depends on the following peer dependencies: | ||
|
||
- @opentelemetry/api, version 1.0.0 or greater | ||
- @opentelemetry/sdk-trace-base, version 1.0.0 or greater, or a package that implements it, like @opentelemetry/sdk-node | ||
|
||
</Note> | ||
27 changes: 27 additions & 0 deletions
27
src/platform-includes/performance/opentelemetry-setup/node.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
You need to register `SentrySpanProcessor` and `SentryPropagator` with your OpenTelemetry installation: | ||
|
||
```js | ||
import * as Sentry from "@sentry/node"; | ||
import { SentrySpanProcessor } from "@sentry/opentelemetry-node"; | ||
|
||
import * as otelApi from "@opentelemetry/api"; | ||
import { getNodeAutoInstrumentations } from "@opentelemetry/auto-instrumentations-node"; | ||
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-grpc"; | ||
|
||
// Make sure to call `Sentry.init` BEFORE initializing the OpenTelemetry SDK | ||
Sentry.init({ | ||
dsn: "___PUBLIC_DSN___", | ||
// ... | ||
}); | ||
|
||
const sdk = new opentelemetry.NodeSDK({ | ||
// Existing config | ||
traceExporter: new OTLPTraceExporter(), | ||
instrumentations: [getNodeAutoInstrumentations()], | ||
|
||
// Sentry config | ||
spanProcessor: new SentrySpanProcessor(), | ||
}); | ||
|
||
otelApi.propagation.setGlobalPropagator(new SentryPropagator()); | ||
``` |
43 changes: 43 additions & 0 deletions
43
src/platforms/common/performance/instrumentation/opentelemetry.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
title: OpenTelemetry Support | ||
mydea marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sidebar_order: 20 | ||
supported: | ||
- node | ||
notSupported: | ||
- javascript | ||
- python | ||
- dart | ||
- flutter | ||
- react-native | ||
- java | ||
- java.spring-boot | ||
- android | ||
- apple | ||
- dotnet | ||
- javascript.cordova | ||
- javascript.electron | ||
- go | ||
- ruby | ||
- unity | ||
- rust | ||
- native | ||
- php | ||
- native.breakpad | ||
- native.crashpad | ||
- native.minidumps | ||
- unreal | ||
- native.wasm | ||
description: "Using OpenTelemetry with Sentry Performance." | ||
--- | ||
|
||
<Include name="alpha-note.mdx" /> | ||
|
||
You can configure your [OpenTelemetry SDK](https://opentelemetry.io/) to send traces and spans to Sentry. | ||
|
||
## Install | ||
|
||
<PlatformContent includePath="performance/opentelemetry-install" /> | ||
|
||
## Usage | ||
|
||
<PlatformContent includePath="performance/opentelemetry-setup" /> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the note about dependencies come before the install step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personally I find it better placed below (so the flow: this is how to install sentry. But make sure that you also have these dependencies installed). But we can of course still adjust this later as well! :)