Skip to content

Add config to disable obfuscation in memcached queries#2725

Merged
pablomartinezbernardo merged 2 commits intomasterfrom
pmartinez/memcached-disable-obfuscation
Jun 21, 2024
Merged

Add config to disable obfuscation in memcached queries#2725
pablomartinezbernardo merged 2 commits intomasterfrom
pmartinez/memcached-disable-obfuscation

Conversation

@pablomartinezbernardo
Copy link
Copy Markdown
Contributor

Description

Add config to disable obfuscation in memcached queries. Keeps old behavior by default. Added on both memcache and memcached. Tests for memached cover only one path, but I didn't want to duplicate the number of integration tests.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Jun 20, 2024

Benchmarks

Benchmark execution time: 2024-06-20 15:12:56

Comparing candidate commit 8e2b1b9 in PR branch pmartinez/memcached-disable-obfuscation with baseline commit 59d1238 in branch master.

Found 2 performance improvements and 1 performance regressions! Performance is the same for 175 metrics, 0 unstable metrics.

scenario:EmptyFileBench/benchEmptyFileOverhead

  • 🟩 execution_time [-159.345µs; -63.355µs] or [-5.951%; -2.366%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache

  • 🟩 execution_time [-6.943µs; -5.817µs] or [-2.890%; -2.421%]

scenario:PDOBench/benchPDOBaseline-opcache

  • 🟥 execution_time [+12.590µs; +17.053µs] or [+7.240%; +9.807%]

@pablomartinezbernardo pablomartinezbernardo marked this pull request as ready for review June 20, 2024 11:52
@pablomartinezbernardo pablomartinezbernardo requested review from a team as code owners June 20, 2024 11:52
Comment thread ext/configuration.h
CONFIG(STRING, DD_VERSION, "", .ini_change = ddtrace_alter_dd_version, \
.env_config_fallback = ddtrace_conf_otel_resource_attributes_version) \
CONFIG(STRING, DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP, DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP_DEFAULT) \
CONFIG(BOOL, DD_TRACE_MEMCACHED_OBFUSCATION, "true") \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: In the APMS ticket, it appears that Ruby and Python both choose to use DD_TRACE_MEMCACHED_COMMAND_ENABLED - Is there a reason for using a different name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes: Ruby and Python's behavior before those envs were implemented was to not include the command at all. The env includes the command, rather than unobfuscating it.

Comment on lines +128 to +130
$queryParams = dd_trace_env_config("DD_TRACE_MEMCACHED_OBFUSCATION") ?
Obfuscation::toObfuscatedString($args[0]) : $args[0];
$span->meta['memcached.query'] = $command . ' ' . $queryParams;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My feeling is that since all the changes have the same structure, we could do a standard function for this. At least, if we ever have an issue, this would prevent us from having to look at five different places. This could be considered a nit :-)

Copy link
Copy Markdown
Contributor

@PROFeNoM PROFeNoM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@pablomartinezbernardo pablomartinezbernardo merged commit 231d5bd into master Jun 21, 2024
@pablomartinezbernardo pablomartinezbernardo deleted the pmartinez/memcached-disable-obfuscation branch June 21, 2024 10:38
@github-actions github-actions Bot added this to the 1.2.0 milestone Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants