8000 Add trace injection for prepared statements in Postgres by nenadnoveljic · Pull Request #7940 · DataDog/dd-trace-java · GitHub
[go: up one dir, main page]

Skip to content

Add trace injection for prepared statements in Postgres #7940

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

Merged
merged 20 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test cases
  • Loading branch information
nenadnoveljic committed Nov 20, 2024
commit 7b88bcaa68c9eaf5ede476e836f988bd145a5753
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,15 @@ public long setContextInfo(Connection connection, DBInfo dbInfo) {
return spanID;
}

// TODO: add description
/**
* Executes `SET application_name` statement on the Postgres DB to set the trace parent in
* `pg_stat_activity.application_name`. This is used for prepared statements where it isn't
* possible to propagate trace parent with the comment. Downside: makes an additional round trip
* to the database.
*
* @param span The span of the instrumented statement
* @param connection The same connection as the one that will be used for the actual statement
*/
public void setApplicationName(AgentSpan span, Connection connection) {
final long startTime = System.currentTimeMillis();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public static AgentScope onEnter(
if (span != null && INJECT_COMMENT) {
String traceParent = null;

// TODO: don't propagate trace info in the comments for postgres if full+ mode is defined
if (injectTraceContext) {
Integer priority = span.forceSamplingDecision();
if (priority != null) {
Expand Down
Loading
0