-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DBM: Add option to append SQL comment propagation #3809
Conversation
BenchmarksBenchmark execution time: 2024-08-12 21:58:03 Comparing candidate commit 8f4efc5 in PR branch Found 1 performance improvements and 1 performance regressions! Performance is the same for 21 metrics, 2 unstable metrics. scenario:profiler - Allocations (baseline)
scenario:tracing - Tracing.log_correlation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3809 +/- ##
=======================================
Coverage 97.90% 97.91%
=======================================
Files 1261 1261
Lines 75620 75665 +45
Branches 3706 3710 +4
=======================================
+ Hits 74036 74084 +48
+ Misses 1584 1581 -3 ☔ View full report in Codecov by Sentry. |
@@ -1990,6 +1992,9 @@ client.query("SELECT * FROM users WHERE group='x'") | |||
| `enabled` | `DD_TRACE_TRILOGY_ENABLED` | `Bool` | Whether the integration should create spans. | `true` | | |||
| `service_name` | `DD_TRACE_TRILOGY_SERVICE_NAME` | `String` | Name of application running the `trilogy` instrumentation. May be overridden by `global_default_service_name`. [See _Additional Configuration_ for more details](#additional-configuration) | `trilogy` | | |||
| `peer_service` | `DD_TRACE_TRILOGY_PEER_SERVICE` | `String` | Name of external service the application connects to | `nil` | | |||
| `comment_propagation` | `DD_DBM_PROPAGATION_MODE` | `String` | SQL comment propagation mode for database monitoring. <br />(example: `disabled` \| `service`\| `full`). <br /><br />**Important**: _Note that enabling SQL comment propagation results in potentially confidential data (service names) being stored in the databases which can then be accessed by other third parties that have been granted access to the database._ | `'disabled'` | | |||
| `append_propagation` | | `Bool` | Appends the SQL comment propagation to the query string. Prepends the comment if `false`. For long query strings, the appended propagation comment might be truncated, causing loss of correlation between the query and trace. | `false` | | |||
| `on_error` | | `Proc` | Custom error handler invoked when MySQL raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring errors that are handled at the application level. | `proc { \|span, error\| span.set_error(error) unless span.nil? }` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this documenting an existing option that wasn't documented? Would be clearer to have this addition in its own PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this documenting an existing option that wasn't documented?
Yes.
Can I keep it here, please? I will save me like 20 minutes now, then a context switch later, and some stress.
Fixes #3601
Add an option (defaults to
false
) to append the DBM trace propagation comment instead, of prepending it.This allow users using database monitor tools to see the SQL query itself first, instead of the Datadog trace propagation comment first.
Motivation:
To correlate Database Monitoring and Traces, the tracer add a SQL comments to instrumented SQL queries.
Currently, the comments are prepended to the query, to prevent any possible truncation from removing the propagation data.
But this means that, in any external tools use to monitor the database, the queries will have the Datadog propagation comment first, and not the query itself. This makes inspecting the query quite inconvenient in many tools.
How to test the change?
There are tests covering all the changes.