File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
packages/node/src/integrations/tracing/hapi Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { isWrapped } from '@opentelemetry/core' ;
1
2
import { HapiInstrumentation } from '@opentelemetry/instrumentation-hapi' ;
2
3
import {
3
4
SDK_VERSION ,
@@ -11,7 +12,7 @@ import {
11
12
} from '@sentry/core' ;
12
13
import { addOpenTelemetryInstrumentation } from '@sentry/opentelemetry' ;
13
14
import type { IntegrationFn } from '@sentry/types' ;
14
- import { logger } from '@sentry/utils' ;
15
+ import { consoleSandbox , logger } from '@sentry/utils' ;
15
16
import { DEBUG_BUILD } from '../../../debug-build' ;
16
17
import type { Boom , RequestEvent , ResponseObject , Server } from './types' ;
17
18
@@ -92,4 +93,14 @@ export const hapiErrorPlugin = {
92
93
*/
93
94
export async function setupHapiErrorHandler ( server : Server ) : Promise < void > {
94
95
await server . register ( hapiErrorPlugin ) ;
96
+
97
+ // eslint-disable-next-line @typescript-eslint/unbound-method
98
+ if ( ! isWrapped ( server . register ) ) {
99
+ consoleSandbox ( ( ) => {
100
+ // eslint-disable-next-line no-console
101
+ console . warn (
102
+ '[Sentry] Hapi is not instrumented. This is likely because you required/imported hapi before calling `Sentry.init()`.' ,
103
+ ) ;
104
+ } ) ;
105
+ }
95
106
}
You can’t perform that action at this time.
0 commit comments