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
pattern as class variable
  • Loading branch information
nenadnoveljic committed Dec 3, 2024
commit 75cf7e53b7ef4a635f31e5940d016b8e264aba74
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class JDBCDecorator extends DatabaseClientDecorator<DBInfo> {
SpanNaming.instance().namingSchema().database().service("jdbc");
public static final String DBM_PROPAGATION_MODE_STATIC = "service";
public static final String DBM_PROPAGATION_MODE_FULL = "full";
private static final Pattern traceParentPattern =
Pattern.compile("^00-[a-f0-9]{32}-[a-f0-9]{16}-[a-f0-9]{2}$");

public static final String DBM_PROPAGATION_MODE = Config.get().getDBMPropagationMode();
public static final boolean INJECT_COMMENT =
Expand Down Expand Up @@ -343,8 +345,7 @@ public void setApplicationName(AgentSpan span, Connection connection) {
return;
}
final String traceParent = DECORATE.traceParent(span, priority);
final Pattern pattern = Pattern.compile("^00-[a-f0-9]{32}-[a-f0-9]{16}-[a-f0-9]{2}$");
if (traceParent == null || !pattern.matcher(traceParent).matches()) {
if (traceParent == null || !traceParentPattern.matcher(traceParent).matches()) {
throw new IllegalArgumentException("Invalid trace parent: " + traceParent);
}
final String traceContext = "_DD_" + traceParent;
Expand Down
Loading
0