Skip to main content

Interface: GraphQLWatcherConfig

Defined in: nestlens.config.ts:281

GraphQL watcher configuration

Properties​

captureHeaders?​

optional captureHeaders: boolean

Defined in: nestlens.config.ts:321

Capture request headers (sensitive headers masked). Default: true


captureResponse?​

optional captureResponse: boolean

Defined in: nestlens.config.ts:375

Capture response data. Default: false


captureVariables?​

optional captureVariables: boolean

Defined in: nestlens.config.ts:296

Capture variables passed to operations. Default: true


detectN1Queries?​

optional detectN1Queries: boolean

Defined in: nestlens.config.ts:345

Enable N+1 query detection. Default: true


enabled?​

optional enabled: boolean

Defined in: nestlens.config.ts:282


ignoreIntrospection?​

optional ignoreIntrospection: boolean

Defined in: nestlens.config.ts:331

Skip introspection queries (__schema, __type). Default: true


ignoreOperations?​

optional ignoreOperations: string[]

Defined in: nestlens.config.ts:333

Operation names to ignore. Example: ['HealthCheck', 'InternalMetrics']


maxQuerySize?​

optional maxQuerySize: number

Defined in: nestlens.config.ts:294

Maximum query size in bytes before truncation. Default: 8192 (8KB)


maxResponseSize?​

optional maxResponseSize: number

Defined in: nestlens.config.ts:403

Maximum response size in bytes before truncation. Default: 64KB (65536)

Read this before raising it. A captured response is serialized and walked key by key on the event loop of the application being watched, so this option buys detail with latency added to every operation that returns a response near the limit:

responsecost per operation
70 KB~0.3ms
280 KB~1.2ms
980 KB~3.7ms
4900 KB~27ms

It is linear, and it is time the request is not doing its own work. 64KB is enough to read a response on the dashboard; someone once set this to 5MB in production because nothing here said what that meant.

Responses over the limit are cheap — around 0.2ms, whatever their size, because they are rejected without being serialized. So the table is the cost of the responses you choose to keep, and raising the limit is what moves a response into it.

Measured by npm run benchmark:sanitizer; run it rather than trusting these figures on hardware that is not the one they came from.


maxVariablesSize?​

optional maxVariablesSize: number

Defined in: nestlens.config.ts:305

Maximum size of the recorded variables in bytes. Default: 65536 (64KB).

The query is truncated at maxQuerySize and the response at maxResponseSize; the variables were bounded only in depth, so a single operation carrying a 100KB argument was stored whole — 101,228 bytes for one entry, repeatable on every request.


n1Threshold?​

optional n1Threshold: number

Defined in: nestlens.config.ts:347

Threshold for N+1 warnings (number of calls to same resolver). Default: 10


recordExceptions?​

optional recordExceptions: boolean

Defined in: nestlens.config.ts:363

Also record what a failed operation threw, as an exception. Default: true.

A failed HTTP request produces two entries — the request and the exception the handler threw — and a failed operation used to produce only the operation. Everything that reads exceptions was therefore empty on a GraphQL API however the application was configured: the Exceptions page, stats.unresolvedExceptions, sampling.always: ['exception'] and an alerting webhook on events: ['exception'], both of which are the defaults.

Set to false where the operation entry is enough — the errors are on it either way, up to the first five.


resolverTracingSampleRate?​

optional resolverTracingSampleRate: number

Defined in: nestlens.config.ts:341

Sample rate for resolver tracing (0-1). Default: 0.1 (when enabled)


samplingRate?​

optional samplingRate: number

Defined in: nestlens.config.ts:371

Sample rate for operation tracking (0-1). Default: 1.0 (track all)


sensitiveHeaders?​

optional sensitiveHeaders: MaskingTerms

Defined in: nestlens.config.ts:329

Additional header names to mask (case-insensitive), merged with the built-in defaults ['authorization', 'cookie', 'set-cookie', 'x-api-key', 'x-auth-token']. Example: ['x-csrf-token', 'x-session-id']

{ replace: [...] } masks exactly these instead; see MaskingTerms.


sensitiveVariables?​

optional sensitiveVariables: MaskingTerms

Defined in: nestlens.config.ts:319

Variable and response field names to mask, added to the built-in list and to whatever security.dataMasking.sensitiveParams names.

A name matches on whole words, ignoring case, underscores and dashes: token covers apiToken, api_token, TOKENS and resetToken, and does not cover tokenCount. A trailing * matches by prefix instead.

Masking here is what the collector trusts — it does not walk a payload this watcher has already cleaned — so this list is the whole answer for GraphQL variables and responses. { replace: [...] } masks exactly these and drops both built-in lists; see MaskingTerms.


server?​

optional server: "apollo" | "mercurius" | "auto"

Defined in: nestlens.config.ts:290

GraphQL server to use. Default: 'auto' (auto-detect)

  • 'apollo': Apollo Server (@apollo/server)
  • 'mercurius': Mercurius (Fastify GraphQL)
  • 'auto': Auto-detect based on installed packages

subscriptions?​

optional subscriptions: GraphQLSubscriptionConfig

Defined in: nestlens.config.ts:367

Subscription tracking configuration


tags()?​

optional tags: (ctx) => string[] | Promise<string[]>

Defined in: nestlens.config.ts:407

Custom tags function for GraphQL operations

Parameters​

ctx​

GraphQLOperationContext

Returns​

string[] | Promise<string[]>


traceFieldResolvers?​

optional traceFieldResolvers: boolean

Defined in: nestlens.config.ts:337

Enable field-level resolver tracing. Default: false


traceSlowResolvers?​

optional traceSlowResolvers: number

Defined in: nestlens.config.ts:339

Only trace resolvers slower than this threshold (ms). Undefined = disabled