Skip to content

Commit

Permalink
Merge branch 'main' into warren/introduce-pino-mixin-function
Browse files Browse the repository at this point in the history
  • Loading branch information
wrn14897 authored Jun 27, 2024
2 parents 65b9b2e + 1b37576 commit 0ed1f46
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/neat-hounds-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperdx/instrumentation-sentry-node': patch
'@hyperdx/node-opentelemetry': patch
---

fix: check if addIntegration method exists
16 changes: 13 additions & 3 deletions packages/instrumentation-sentry-node/src/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,19 @@ export class SentryNodeInstrumentation extends InstrumentationBase {
this._wrap(moduleExports, 'init', (original: any) => {
return (...args: any[]) => {
const result = original.apply(this, args);
// WARNING: we need to add the integration once the SDK is initialized
moduleExports.addIntegration(hyperdxIntegration());
diag.debug('Added HyperDX Sentry integration.');
try {
if (moduleExports.addIntegration instanceof Function) {
// WARNING: we need to add the integration once the SDK is initialized
moduleExports.addIntegration(hyperdxIntegration());
diag.debug('Added HyperDX Sentry integration');
} else {
diag.error(
'Sentry SDK does not support addIntegration method',
);
}
} catch (e) {
diag.error('Error adding HyperDX Sentry integration', e);
}
return result;
};
});
Expand Down

0 comments on commit 0ed1f46

Please sign in to comment.