Skip to content

fix: Map trilogy database adapter to mysql for Query Insights compatibility#2656

Merged
sl0thentr0py merged 3 commits intogetsentry:masterfrom
krismichalski:patch-1
Mar 9, 2026
Merged

fix: Map trilogy database adapter to mysql for Query Insights compatibility#2656
sl0thentr0py merged 3 commits intogetsentry:masterfrom
krismichalski:patch-1

Conversation

@krismichalski
Copy link
Contributor

Description

When using trilogy adapter in Rails app, Query Insights view in Sentry did not show any data.

The problem is that trilogy is not in the allowed system db name list:
https://github.com/getsentry/semantic-conventions/blob/main/docs/attributes-registry/db.md
despite being just a different MySQL adapter, and hence does not meet the criteria for span eligibility:
https://docs.sentry.io/product/insights/backend/queries/#span-eligibility

The simple fix is to just map trilogy to mysql for the db system name.

Current Behavior

No query data is displayed because trilogy is not recognized as a valid database system.

Expected Behavior

Query data from trilogy adapter should appear in Sentry's Query Insights view, similar to other MySQL adapters.

Alternative solution (how I tested it worked)

The same result can be achieved using before_send_transaction:

# Workaround: Map trilogy spans to mysql for Sentry compatibility
config.before_send_transaction = lambda do |event, _hint|
  event.spans.select { |span| span[:op].start_with?("db.") }.each do |span|
    span[:data]["db.system"] = "mysql" if span[:data]&.fetch("db.system", nil) == "trilogy"
  end
end

@sl0thentr0py sl0thentr0py changed the title Map trilogy database adapter to mysql for Query Insights compatibility fix: Map trilogy database adapter to mysql for Query Insights compatibility Mar 9, 2026
@sl0thentr0py sl0thentr0py merged commit cf9e45c into getsentry:master Mar 9, 2026
134 checks passed
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.35%. Comparing base (7d10c02) to head (8e87a7b).
⚠️ Report is 47 commits behind head on master.

Files with missing lines Patch % Lines
...b/sentry/rails/tracing/active_record_subscriber.rb 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2656      +/-   ##
==========================================
+ Coverage   90.13%   90.35%   +0.21%     
==========================================
  Files         132      141       +9     
  Lines        5301     5587     +286     
==========================================
+ Hits         4778     5048     +270     
- Misses        523      539      +16     
Components Coverage Δ
sentry-ruby 97.27% <98.24%> (-0.02%) ⬇️
sentry-rails 55.30% <11.11%> (-0.20%) ⬇️
sentry-sidekiq 95.05% <100.00%> (ø)
sentry-resque 94.44% <ø> (ø)
sentry-delayed_job 94.68% <ø> (ø)
sentry-opentelemetry 96.81% <92.00%> (-2.50%) ⬇️
Files with missing lines Coverage Δ
...b/sentry/rails/tracing/active_record_subscriber.rb 35.41% <0.00%> (-1.54%) ⬇️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants