File tree 3 files changed +18
-26
lines changed
packages/aws-serverless/src/integration
3 files changed +18
-26
lines changed Original file line number Diff line number Diff line change @@ -81,22 +81,18 @@ working on this during the v8 alpha/beta cycle.
81
81
### Using Custom OpenTelemetry Instrumentation
82
82
83
83
While we include some vetted OpenTelemetry instrumentation out of the box, you can also add your own instrumentation on
84
- top of that. You can do that by installing an instrumentation package (as well as ` @opentelemetry/instrumentation ` ) and
85
- setting it up like this:
84
+ top of that. You can do that by installing an instrumentation package and setting it up like this:
86
85
87
86
``` js
88
87
const Sentry = require (' @sentry/node' );
89
88
const { GenericPoolInstrumentation } = require (' @opentelemetry/instrumentation-generic-pool' );
90
- const { registerInstrumentations } = require (' @opentelemetry/instrumentation' );
91
89
92
90
Sentry .init ({
93
91
dsn: ' __DSN__' ,
94
92
});
95
93
96
94
// Afterwards, you can add additional instrumentation:
97
- registerInsturmentations ({
98
- instrumentations: [new GenericPoolInstrumentation ()],
99
- });
95
+ Sentry .addOpenTelemetryInstrumentation (new GenericPoolInstrumentation ());
100
96
```
101
97
102
98
### Using a Custom OpenTelemetry Setup
Original file line number Diff line number Diff line change 1
- import { registerInstrumentations } from '@opentelemetry/instrumentation' ;
2
1
import { AwsInstrumentation } from '@opentelemetry/instrumentation-aws-sdk' ;
3
2
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , defineIntegration } from '@sentry/core' ;
3
+ import { addOpenTelemetryInstrumentation } from '@sentry/node' ;
4
4
import type { IntegrationFn } from '@sentry/types' ;
5
5
6
6
const _awsIntegration = ( ( ) => {
7
7
return {
8
8
name : 'Aws' ,
9
9
setupOnce ( ) {
10
- registerInstrumentations ( {
11
- instrumentations : [
12
- new AwsInstrumentation ( {
13
- preRequestHook ( span ) {
14
- span . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , 'auto.otel.aws' ) ;
15
- } ,
16
- } ) ,
17
- ] ,
18
- } ) ;
10
+ addOpenTelemetryInstrumentation (
11
+ new AwsInstrumentation ( {
12
+ preRequestHook ( span ) {
13
+ span . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , 'auto.otel.aws' ) ;
14
+ } ,
15
+ } ) ,
16
+ ) ;
19
17
} ,
20
18
} ;
21
19
} ) satisfies IntegrationFn ;
Original file line number Diff line number Diff line change 1
- import { registerInstrumentations } from '@opentelemetry/instrumentation' ;
2
1
import { AwsLambdaInstrumentation } from '@opentelemetry/instrumentation-aws-lambda' ;
3
2
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , defineIntegration } from '@sentry/core' ;
3
+ import { addOpenTelemetryInstrumentation } from '@sentry/node' ;
4
4
import type { IntegrationFn } from '@sentry/types' ;
5
5
6
6
const _awsLambdaIntegration = ( ( ) => {
7
7
return {
8
8
name : 'AwsLambda' ,
9
9
setupOnce ( ) {
10
- registerInstrumentations ( {
11
- instrumentations : [
12
- new AwsLambdaInstrumentation ( {
13
- requestHook ( span ) {
14
- span . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , 'auto.otel.aws-lambda' ) ;
15
- } ,
16
- } ) ,
17
- ] ,
18
- } ) ;
10
+ addOpenTelemetryInstrumentation (
11
+ new AwsLambdaInstrumentation ( {
12
+ requestHook ( span ) {
13
+ span . setAttribute ( SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , 'auto.otel.aws-lambda' ) ;
14
+ } ,
15
+ } ) ,
16
+ ) ;
19
17
} ,
20
18
} ;
21
19
} ) satisfies IntegrationFn ;
You can’t perform that action at this time.
0 commit comments