@sentry/opentelemetry 11.0.0-rc.1 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -90
- package/build/esm/package.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,97 +10,15 @@
|
|
|
10
10
|
[](https://www.npmjs.com/package/@sentry/opentelemetry)
|
|
11
11
|
[](https://www.npmjs.com/package/@sentry/opentelemetry)
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
OpenTelemetry support for Sentry’s JavaScript SDKs.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
are setting up OpenTelemetry support for Sentry yourself.
|
|
15
|
+
## Documentation
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
- [OpenTelemetry documentation](https://docs.sentry.io/platforms/javascript/guides/node/opentelemetry/)
|
|
18
|
+
- [Capture spans from OpenTelemetry APIs](https://docs.sentry.io/platforms/javascript/guides/node/opentelemetry/using-opentelemetry-apis/)
|
|
19
|
+
- [Use your own OpenTelemetry pipeline](https://docs.sentry.io/platforms/javascript/guides/node/opentelemetry/custom-setup/)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
npm install @sentry/opentelemetry
|
|
21
|
+
## Support
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Note that `@sentry/opentelemetry` depends on the following peer dependencies:
|
|
28
|
-
|
|
29
|
-
- `@opentelemetry/api` version `1.0.0` or greater
|
|
30
|
-
|
|
31
|
-
## Usage
|
|
32
|
-
|
|
33
|
-
This package exposes a few building blocks you can add to your OpenTelemetry setup in order to capture OpenTelemetry
|
|
34
|
-
traces to Sentry.
|
|
35
|
-
|
|
36
|
-
This is how you can use this in your app:
|
|
37
|
-
|
|
38
|
-
1. Initialize Sentry, e.g. `@sentry/node`!
|
|
39
|
-
2. Call `setupEventContextTrace(client)`
|
|
40
|
-
3. Add `SentrySampler` as sampler
|
|
41
|
-
4. Add `SentrySpanProcessor` as span processor
|
|
42
|
-
5. Register the Sentry context manager (`SentryAsyncLocalStorageContextManager`, or `wrapContextManagerClass` for a custom base)
|
|
43
|
-
6. Add `SentryPropagator` as propagator
|
|
44
|
-
7. Setup OTEL-powered async context strategy for Sentry via `setOpenTelemetryContextAsyncContextStrategy()`
|
|
45
|
-
|
|
46
|
-
For example, you could set this up as follows:
|
|
47
|
-
|
|
48
|
-
```js
|
|
49
|
-
import * as Sentry from '@sentry/node';
|
|
50
|
-
import {
|
|
51
|
-
SentryAsyncLocalStorageContextManager,
|
|
52
|
-
SentryPropagator,
|
|
53
|
-
SentrySampler,
|
|
54
|
-
SentrySpanProcessor,
|
|
55
|
-
setupEventContextTrace,
|
|
56
|
-
setOpenTelemetryContextAsyncContextStrategy,
|
|
57
|
-
} from '@sentry/opentelemetry';
|
|
58
|
-
import { context, propagation, trace } from '@opentelemetry/api';
|
|
59
|
-
|
|
60
|
-
function setupSentry() {
|
|
61
|
-
Sentry.init({
|
|
62
|
-
dsn: 'xxx',
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const client = Sentry.getClient();
|
|
66
|
-
setupEventContextTrace(client);
|
|
67
|
-
|
|
68
|
-
const provider = new BasicTracerProvider({
|
|
69
|
-
sampler: new SentrySampler(client),
|
|
70
|
-
});
|
|
71
|
-
provider.addSpanProcessor(new SentrySpanProcessor());
|
|
72
|
-
|
|
73
|
-
// Initialize the provider
|
|
74
|
-
trace.setGlobalTracerProvider(provider);
|
|
75
|
-
context.setGlobalContextManager(new SentryAsyncLocalStorageContextManager());
|
|
76
|
-
|
|
77
|
-
setOpenTelemetryContextAsyncContextStrategy();
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
A full setup example can be found in
|
|
82
|
-
[node-experimental](https://github.com/getsentry/sentry-javascript/blob/develop/packages/node-experimental).
|
|
83
|
-
|
|
84
|
-
## Sentry Tracer Provider
|
|
85
|
-
|
|
86
|
-
`SentryTracerProvider` is a minimal OpenTelemetry tracer provider which creates native Sentry spans directly.
|
|
87
|
-
It is useful when code uses the global OpenTelemetry API and you do not need the full OpenTelemetry SDK span processor
|
|
88
|
-
and exporter pipeline.
|
|
89
|
-
|
|
90
|
-
```js
|
|
91
|
-
import { trace } from '@opentelemetry/api';
|
|
92
|
-
import { SentryTracerProvider } from '@sentry/opentelemetry';
|
|
93
|
-
|
|
94
|
-
trace.setGlobalTracerProvider(new SentryTracerProvider());
|
|
95
|
-
|
|
96
|
-
const span = trace.getTracer('example').startSpan('work');
|
|
97
|
-
span.end();
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
In `@sentry/node`, this is the default tracer provider.
|
|
101
|
-
|
|
102
|
-
The `SentryTracerProvider` does not handle OpenTelemetry logs and metrics.
|
|
103
|
-
|
|
104
|
-
## Links
|
|
105
|
-
|
|
106
|
-
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
|
|
23
|
+
- [Report a bug](https://github.com/getsentry/sentry-javascript/issues/new/choose)
|
|
24
|
+
- [Contributing](https://github.com/getsentry/sentry-javascript/blob/develop/CONTRIBUTING.md)
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"11.
|
|
1
|
+
{"type":"module","version":"11.1.0","sideEffects":false}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/opentelemetry",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "Official Sentry utilities for OpenTelemetry",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/opentelemetry",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@sentry/conventions": "^0.
|
|
31
|
-
"@sentry/core": "11.
|
|
30
|
+
"@sentry/conventions": "^0.24.0",
|
|
31
|
+
"@sentry/core": "11.1.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@opentelemetry/api": "^1.9.0"
|