Skip to content

[APMS-20023] Add fallback for hidden URI in JDBC - #6123

Open
vpellan wants to merge 4 commits into
masterfrom
vpellan/jdbc-fallback-for-hidden-uri
Open

[APMS-20023] Add fallback for hidden URI in JDBC#6123
vpellan wants to merge 4 commits into
masterfrom
vpellan/jdbc-fallback-for-hidden-uri

Conversation

@vpellan

@vpellan vpellan commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Add fallback for hidden URI in sequel with JDBC. With DataSource/JNDI-managed connection it is possible to have a hidden URI that can still be access through

db.synchronize do |conn|
  conn.get_meta_data.get_url if conn.respond_to?(:get_meta_data)
end

Motivation:

APMS-20023

Change log entry

None. We do not officially support JRuby anymore and this is specific to JRuby

Additional Notes:

How to test the change?

The CI does not test this because we do not test on JRuby anymore. So the tests are best effort and reproduce what would happen on JRuby, in a Ruby env

@vpellan
vpellan requested review from a team as code owners July 29, 2026 15:53
@vpellan
vpellan requested review from mabdinur and wantsui July 29, 2026 15:53
@dd-octo-sts dd-octo-sts Bot added integrations Involves tracing integrations tracing labels Jul 29, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c8a2cbbe4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/datadog/tracing/contrib/sequel/utils.rb Outdated
Comment thread lib/datadog/tracing/contrib/sequel/utils.rb Outdated
Comment thread lib/datadog/tracing/contrib/sequel/utils.rb Outdated
@datadog-official

datadog-official Bot commented Jul 29, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 90.02% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f1c3244 | Docs | Datadog PR Page | Give us feedback!

@pr-commenter

pr-commenter Bot commented Jul 30, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-30 12:21:25

Comparing candidate commit f1c3244 in PR branch vpellan/jdbc-fallback-for-hidden-uri with baseline commit 90f3c3c in branch master.

📊 Benchmarking dashboard

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:tracing - trace.to_digest - Continue

  • unstable throughput [-1852.340op/s; +1161.353op/s] or [-6.266%; +3.929%]

@Strech Strech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To be honest changes are not easy to follow (so to say)

Comment on lines +178 to +185
begin
db.synchronize do |conn|
conn.get_meta_data.get_url if conn.respond_to?(:get_meta_data)
end
rescue => e
Datadog.logger.debug { "Sequel: unable to resolve JDBC connection metadata (#{e.class})" }
return nil
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If we return nil, does it make more senseto rescue in method body instead to return nil? It will be a ruby-style, not AI style then

def method
  # ...
  url = "..."
  # ...
rescue
  logger  { "..." }
  nil
end

Comment on lines +146 to +148
if parsed[:host].nil? && parsed[:port].nil? && parsed[:database].nil?
parsed = jdbc_metadata_from_connection(db) || parsed
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In this condition, we know for a fact that parsed host/port/database are nil, does it make sense to fallback to parsed here?

# Sequel's JDBC adapter connects with the URL and ignores separate
# :host/:port options, unlike native adapters where those options take precedence.
if !parsed[:host].nil? || !parsed[:port].nil? || !parsed[:database].nil?
if parsed[:host] || parsed[:port] || parsed[:database]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Before the condition was !nil and we used those values in assignments, not we potentially can have host or port as nil value, not sure that I can follow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrations Involves tracing integrations tracing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants