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.host tags
- All 120+ data commands (
get, set, hGet, etc.), multi, exec remain traced
Prior art
Same pattern as DD_TRACE_PDO_PREPARED_STATEMENTS_ENABLED (PR #3752) and Go tracer's WithIgnoreQueryTypes.
Implementation scope
ext/configuration.h — declare CONFIG(BOOL, DD_TRACE_REDIS_LIFECYCLE_COMMANDS_ENABLED, "true")
src/DDTrace/Integrations/PHPRedis/PHPRedisIntegration.php — conditional hook registration
src/DDTrace/Integrations/Predis/PredisIntegration.php — conditional hook registration
metadata/supported-configurations.json — document the variable
- Tests for both integrations
Summary
Add
DD_TRACE_REDIS_LIFECYCLE_COMMANDS_ENABLED(boolean, defaulttrue) 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: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__construct,connect,executePipelineout.hosttagsget,set,hGet, etc.),multi,execremain tracedPrior art
Same pattern as
DD_TRACE_PDO_PREPARED_STATEMENTS_ENABLED(PR #3752) and Go tracer'sWithIgnoreQueryTypes.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