Skip to content

Commit

Permalink
Capture Cockroach DB config in sentry-rails ActiveRecordSubscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
natikgadzhi committed Nov 27, 2023
1 parent 168b43a commit 86a0ffc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
- Respect custom `Delayed::Job.max_attempts` if it's defined [#2176](https:/getsentry/sentry-ruby/pull/2176)
- Fixed a bug where `Net::HTTP` instrumentation won't work for some IPv6 addresses [#2180](https:/getsentry/sentry-ruby/pull/2180)
- Allow non-string error message to be reported to sentry ([#2137](https:/getsentry/sentry-ruby/pull/2137))
- `sentry-rails` will now capture Cockroach DB adapter config into spans data [#2182](https:/getsentry/sentry-ruby/pull/2182)

## 5.13.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ def self.subscribe!
end

next unless connection

db_config = if connection.pool.respond_to?(:db_config)
connection.pool.db_config.configuration_hash
elsif connection.pool.respond_to?(:spec)
connection.pool.spec.config
# CockroachDB pool shows up as NullPool, but we can grab
# it's configuration from the instance variable.
elsif connection.instance_variable_defined?(:@config)
connection.instance_variable_get(:@config)

Check warning on line 37 in sentry-rails/lib/sentry/rails/tracing/active_record_subscriber.rb

View check run for this annotation

Codecov / codecov/patch

sentry-rails/lib/sentry/rails/tracing/active_record_subscriber.rb#L36-L37

Added lines #L36 - L37 were not covered by tests
end

next unless db_config
Expand Down

0 comments on commit 86a0ffc

Please sign in to comment.