@@ -18,11 +18,12 @@ import {
18
18
} from '@sentry/core' ;
19
19
import { DEBUG_BUILD } from '../../debug-build' ;
20
20
import type { NodeClient } from '../../sdk/client' ;
21
- import { INSTRUMENTATION_NAME , MAX_BODY_BYTE_LENGTH } from './constants' ;
21
+ import { MAX_BODY_BYTE_LENGTH } from './constants' ;
22
22
23
23
type ServerEmit = typeof Server . prototype . emit ;
24
24
25
25
const HTTP_SERVER_INSTRUMENTED_KEY = createContextKey ( 'sentry_http_server_instrumented' ) ;
26
+ const INTEGRATION_NAME = 'Http.Server' ;
26
27
27
28
interface ServerCallbackOptions {
28
29
request : IncomingMessage ;
@@ -94,7 +95,7 @@ const _httpServerIntegration = ((options: HttpServerIntegrationOptions = {}) =>
94
95
} ;
95
96
96
97
return {
97
- name : 'HttpServer' ,
98
+ name : INTEGRATION_NAME ,
98
99
setupOnce ( ) {
99
100
const onHttpServerRequestStart = ( ( _data : unknown ) => {
100
101
const data = _data as { server : Server } ;
@@ -166,7 +167,7 @@ function instrumentServer(
166
167
return target . apply ( thisArg , args ) ;
167
168
}
168
169
169
- DEBUG_BUILD && debug . log ( INSTRUMENTATION_NAME , 'Handling incoming request' ) ;
170
+ DEBUG_BUILD && debug . log ( INTEGRATION_NAME , 'Handling incoming request' ) ;
170
171
171
172
const isolationScope = getIsolationScope ( ) . clone ( ) ;
172
173
const request = args [ 1 ] as IncomingMessage ;
@@ -335,7 +336,7 @@ function patchRequestToCaptureBody(
335
336
let bodyByteLength = 0 ;
336
337
const chunks : Buffer [ ] = [ ] ;
337
338
338
- DEBUG_BUILD && debug . log ( INSTRUMENTATION_NAME , 'Patching request.on' ) ;
339
+ DEBUG_BUILD && debug . log ( INTEGRATION_NAME , 'Patching request.on' ) ;
339
340
340
341
/**
341
342
* We need to keep track of the original callbacks, in order to be able to remove listeners again.
@@ -359,7 +360,7 @@ function patchRequestToCaptureBody(
359
360
360
361
if ( event === 'data' ) {
361
362
DEBUG_BUILD &&
362
- debug . log ( INSTRUMENTATION_NAME , `Handling request.on("data") with maximum body size of ${ maxBodySize } b` ) ;
363
+ debug . log ( INTEGRATION_NAME , `Handling request.on("data") with maximum body size of ${ maxBodySize } b` ) ;
363
364
364
365
const callback = new Proxy ( listener , {
365
366
apply : ( target , thisArg , args : Parameters < typeof listener > ) => {
@@ -372,12 +373,12 @@ function patchRequestToCaptureBody(
372
373
bodyByteLength += bufferifiedChunk . byteLength ;
373
374
} else if ( DEBUG_BUILD ) {
374
375
debug . log (
375
- INSTRUMENTATION_NAME ,
376
+ INTEGRATION_NAME ,
376
377
`Dropping request body chunk because maximum body length of ${ maxBodySize } b is exceeded.` ,
377
378
) ;
378
379
}
379
380
} catch ( err ) {
380
- DEBUG_BUILD && debug . error ( INSTRUMENTATION_NAME , 'Encountered error while storing body chunk.' ) ;
381
+ DEBUG_BUILD && debug . error ( INTEGRATION_NAME , 'Encountered error while storing body chunk.' ) ;
381
382
}
382
383
383
384
return Reflect . apply ( target , thisArg , args ) ;
@@ -429,13 +430,13 @@ function patchRequestToCaptureBody(
429
430
}
430
431
} catch ( error ) {
431
432
if ( DEBUG_BUILD ) {
432
- debug . error ( INSTRUMENTATION_NAME , 'Error building captured request body' , error ) ;
433
+ debug . error ( INTEGRATION_NAME , 'Error building captured request body' , error ) ;
433
434
}
434
435
}
435
436
} ) ;
436
437
} catch ( error ) {
437
438
if ( DEBUG_BUILD ) {
438
- debug . error ( INSTRUMENTATION_NAME , 'Error patching request to capture body' , error ) ;
439
+ debug . error ( INTEGRATION_NAME , 'Error patching request to capture body' , error ) ;
439
440
}
440
441
}
441
442
}
0 commit comments