-
Notifications
You must be signed in to change notification settings - Fork 173
feat(redis): add DD_TRACE_REDIS_LIFECYCLE_COMMANDS_ENABLED to disable lifecycle spans #3753
Copy link
Copy link
Open
Description
Summary
Add DD_TRACE_REDIS_LIFECYCLE_COMMANDS_ENABLED (boolean, default true) to allow users to disable tracing of Redis lifecycle/admin/introspection operations independently from data commands.
Motivation
Applications using Redis heavily generate many low-value spans (connect, close, auth, ping, getHost, isConnected, bgSave, etc.) that add noise without observability value. Users want to reduce span volume without disabling the entire Redis integration.
Proposed behaviour
When DD_TRACE_REDIS_LIFECYCLE_COMMANDS_ENABLED=false:
- PHPRedis: 27 lifecycle methods NOT traced:
connect,pconnect,open,popen,close,auth,select,ping,echo,isConnected,getHost,getPort,getDbNum,getTimeout,getReadTimeout,bgRewriteAOF,bgSave,flushAll,flushDb,save,restore,swapdb,_serialize,_unserialize,getLastError,clearLastError,RedisCluster.__construct - Predis: 3 methods NOT traced:
__construct,connect,executePipeline - Connection metadata (ObjectKVStore) is preserved so data command spans still have
out.hosttags - All 120+ data commands (
get,set,hGet, etc.),multi,execremain traced
Prior art
Same pattern as DD_TRACE_PDO_PREPARED_STATEMENTS_ENABLED (PR #3752) and Go tracer's WithIgnoreQueryTypes.
Implementation scope
ext/configuration.h— declareCONFIG(BOOL, DD_TRACE_REDIS_LIFECYCLE_COMMANDS_ENABLED, "true")src/DDTrace/Integrations/PHPRedis/PHPRedisIntegration.php— conditional hook registrationsrc/DDTrace/Integrations/Predis/PredisIntegration.php— conditional hook registrationmetadata/supported-configurations.json— document the variable- Tests for both integrations
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels