Skip to content

graphqlIntegration: updating Sentry config removes responseHook from otel config #16004

Closed
@ldiqual

Description

@ldiqual

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

9.11.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

Important: I'm using late initialization using the ESM preload, which explains why setConfig is called twice.

Sentry.init({
  // ...
  integrations: [
    Sentry.graphqlIntegration({
      mergeItems: true, // Passed to otel, not defined in Sentry types
      ignoreResolveSpans: false,
      useOperationNameForRootSpan: true,
    }),
  ],
})

Steps to Reproduce

I added the following log line in otel's graphql instrumentation @opentelemetry/instrumentation-graphql/build/src/instrumentation.js:

setConfig(config = {}) {
  super.setConfig(Object.assign(Object.assign({}, DEFAULT_CONFIG), config));
  console.log('>>>setConfig done', this.getConfig())
}

First init (during esm preload) logs:

>>>setConfig done {
  enabled: true,
  mergeItems: false,
  depth: -1,
  allowValues: false,
  ignoreResolveSpans: true,
  ignoreTrivialResolveSpans: true,
  useOperationNameForRootSpan: true,
  responseHook: [Function: responseHook]
}

Second init (during late Sentry initialization):

>>>setConfig done {
  enabled: true,
  mergeItems: true,
  depth: -1,
  allowValues: false,
  ignoreResolveSpans: false,
  ignoreTrivialResolveSpans: true,
  useOperationNameForRootSpan: true
  // Note the missing hook
}

Expected Result

I would expect sentry to pass the requestHook again to setConfig so that useOperationNameForRootSpan can be applied.

Actual Result

responseHook is not passed

Metadata

Metadata

Assignees

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions