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
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
fix sized StringBuilder
  • Loading branch information
nenadnoveljic committed Dec 3, 2024
commit faa95415474c2aa71a6fc02845e5359b4fd53f60
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,14 @@ public void setApplicationName(AgentSpan span, Connection connection) {
final String traceContext = "_DD_" + traceParent;

// SET doesn't work with parameters
StringBuilder sql = new StringBuilder();
sql.append("SET application_name = '");
final String setCommandBegin = "SET application_name = '";
final String setCommandEnd = "';";
StringBuilder sql =
new StringBuilder(
setCommandBegin.length() + traceContext.length() + setCommandEnd.length());
sql.append(setCommandBegin);
sql.append(traceContext);
sql.append("';");
sql.append(setCommandEnd);

try (Statement statement = connection.createStatement()) {
statement.execute(sql.toString());
Expand Down
0