File tree Expand file tree Collapse file tree 3 files changed +18
-26
lines changed
packages/aws-serverless/src/integration Expand file tree Collapse file tree 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.
8181### Using Custom OpenTelemetry Instrumentation
8282
8383While 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:
8685
8786``` js
8887const Sentry = require (' @sentry/node' );
8988const { GenericPoolInstrumentation } = require (' @opentelemetry/instrumentation-generic-pool' );
90- const { registerInstrumentations } = require (' @opentelemetry/instrumentation' );
9189
9290Sentry .init ({
9391 dsn: ' __DSN__' ,
9492});
9593
9694// Afterwards, you can add additional instrumentation:
97- registerInsturmentations ({
98- instrumentations: [new GenericPoolInstrumentation ()],
99- });
95+ Sentry .addOpenTelemetryInstrumentation (new GenericPoolInstrumentation ());
10096```
10197
10298### Using a Custom OpenTelemetry Setup
Original file line number Diff line number Diff line change 1- import { registerInstrumentations } from '@opentelemetry/instrumentation' ;
21import { AwsInstrumentation } from '@opentelemetry/instrumentation-aws-sdk' ;
32import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , defineIntegration } from '@sentry/core' ;
3+ import { addOpenTelemetryInstrumentation } from '@sentry/node' ;
44import type { IntegrationFn } from '@sentry/types' ;
55
66const _awsIntegration = ( ( ) => {
77 return {
88 name : 'Aws' ,
99 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+ ) ;
1917 } ,
2018 } ;
2119} ) satisfies IntegrationFn ;
Original file line number Diff line number Diff line change 1- import { registerInstrumentations } from '@opentelemetry/instrumentation' ;
21import { AwsLambdaInstrumentation } from '@opentelemetry/instrumentation-aws-lambda' ;
32import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN , defineIntegration } from '@sentry/core' ;
3+ import { addOpenTelemetryInstrumentation } from '@sentry/node' ;
44import type { IntegrationFn } from '@sentry/types' ;
55
66const _awsLambdaIntegration = ( ( ) => {
77 return {
88 name : 'AwsLambda' ,
99 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+ ) ;
1917 } ,
2018 } ;
2119} ) satisfies IntegrationFn ;
You can’t perform that action at this time.
0 commit comments