-
Notifications
You must be signed in to change notification settings - Fork 377
Description
Package Name
graphql (plugin)
Package Version(s)
Latest dd-trace v5.86.0
Describe the feature you'd like
Add support for configuring the GraphQL plugin collapse option via an environment variable (e.g., DD_TRACE_GRAPHQL_COLLAPSE). This would allow users to control whether GraphQL field list items are collapsed (e.g., users.*.name vs users.0.name, users.1.name) through an env var, instead of requiring code changes.
The current method requires direct code modification (e.g., tracer.use('graphql', { collapse: false })), but environments using dd-trace/initialize.mjs cannot use plugin options without changing source. Supporting an env var config would enable true zero-code-configuration and align with other integrations that support env vars.
Is your feature request related to a problem?
Currently, when using dd-trace with GraphQL and initializing via dd-trace/initialize.mjs, it is not possible to set plugin options like collapse through environment variables alone. This prevents users in many cloud/containerized setups from truly configuring all tracing options without changing application code. This limits flexibility and consistency, especially compared to integrations where most settings can be managed via env vars.
Describe alternatives you've considered
One option is to maintain a custom init file or post-init configuration script that reads environment variables and configures the plugin in code, but this adds operational burden and is less portable across environments.
Additional context
If this feature does not exist yet, I'd be happy to propose a PR to add it, following the convention of other environment variable-driven options in dd-trace-js. This feature would help users who cannot patch startup scripts easily or must follow strict image deployment pipelines.