diff --git a/Rakefile b/Rakefile index a3791ec2688..1e56a54d89a 100644 --- a/Rakefile +++ b/Rakefile @@ -176,6 +176,9 @@ TEST_METADATA = { 'suite' => { 'contrib' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby' }, + 'trilogy' => { + 'relational_db' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ❌ jruby' + }, 'qless' => { 'contrib-old' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby' }, @@ -189,7 +192,8 @@ TEST_METADATA = { 'rails6-mysql2' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ✅ jruby', 'rails6-postgres' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ✅ jruby', 'rails61-mysql2' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby', - 'rails61-postgres' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby' + 'rails61-postgres' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ jruby', + 'rails61-trilogy' => '❌ 2.1 / ❌ 2.2 / ❌ 2.3 / ❌ 2.4 / ❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ❌ jruby' }, 'railsautoinstrument' => { 'rails32-postgres' => '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ❌ 2.4 / ❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ✅ jruby', @@ -500,7 +504,8 @@ namespace :spec do :sneakers, :stripe, :sucker_punch, - :suite + :suite, + :trilogy ].each do |contrib| desc '' # "Explicitly hiding from `rake -T`" RSpec::Core::RakeTask.new(contrib) do |t, args| diff --git a/appraisal/ruby-3.0.rb b/appraisal/ruby-3.0.rb index ef3903a77a3..d1ec9f356f1 100644 --- a/appraisal/ruby-3.0.rb +++ b/appraisal/ruby-3.0.rb @@ -41,6 +41,15 @@ gem 'net-smtp' end +appraise 'rails61-trilogy' do + gem 'rails', '~> 6.1.0' + gem 'trilogy' + gem 'activerecord-trilogy-adapter' + gem 'sprockets', '< 4' + gem 'lograge', '~> 0.11' + gem 'net-smtp' +end + appraise 'resque2-redis3' do gem 'redis', '< 4.0' gem 'resque', '>= 2.0' @@ -88,6 +97,7 @@ gem 'pg', platform: :ruby gem 'sqlite3', '>= 1.4.2', platform: :ruby gem 'sequel', '~> 5.54.0' # TODO: Support sequel 5.62.0+ + gem 'trilogy' end appraise 'activesupport' do diff --git a/appraisal/ruby-3.1.rb b/appraisal/ruby-3.1.rb index ef3903a77a3..d1ec9f356f1 100644 --- a/appraisal/ruby-3.1.rb +++ b/appraisal/ruby-3.1.rb @@ -41,6 +41,15 @@ gem 'net-smtp' end +appraise 'rails61-trilogy' do + gem 'rails', '~> 6.1.0' + gem 'trilogy' + gem 'activerecord-trilogy-adapter' + gem 'sprockets', '< 4' + gem 'lograge', '~> 0.11' + gem 'net-smtp' +end + appraise 'resque2-redis3' do gem 'redis', '< 4.0' gem 'resque', '>= 2.0' @@ -88,6 +97,7 @@ gem 'pg', platform: :ruby gem 'sqlite3', '>= 1.4.2', platform: :ruby gem 'sequel', '~> 5.54.0' # TODO: Support sequel 5.62.0+ + gem 'trilogy' end appraise 'activesupport' do diff --git a/appraisal/ruby-3.2.rb b/appraisal/ruby-3.2.rb index ef3903a77a3..d1ec9f356f1 100644 --- a/appraisal/ruby-3.2.rb +++ b/appraisal/ruby-3.2.rb @@ -41,6 +41,15 @@ gem 'net-smtp' end +appraise 'rails61-trilogy' do + gem 'rails', '~> 6.1.0' + gem 'trilogy' + gem 'activerecord-trilogy-adapter' + gem 'sprockets', '< 4' + gem 'lograge', '~> 0.11' + gem 'net-smtp' +end + appraise 'resque2-redis3' do gem 'redis', '< 4.0' gem 'resque', '>= 2.0' @@ -88,6 +97,7 @@ gem 'pg', platform: :ruby gem 'sqlite3', '>= 1.4.2', platform: :ruby gem 'sequel', '~> 5.54.0' # TODO: Support sequel 5.62.0+ + gem 'trilogy' end appraise 'activesupport' do diff --git a/appraisal/ruby-3.3.rb b/appraisal/ruby-3.3.rb index 6cca55fd17c..ccd417aa0a7 100644 --- a/appraisal/ruby-3.3.rb +++ b/appraisal/ruby-3.3.rb @@ -41,6 +41,15 @@ gem 'net-smtp' end +appraise 'rails61-trilogy' do + gem 'rails', '~> 6.1.0' + gem 'trilogy' + gem 'activerecord-trilogy-adapter' + gem 'sprockets', '< 4' + gem 'lograge', '~> 0.11' + gem 'net-smtp' +end + appraise 'resque2-redis3' do gem 'redis', '< 4.0' gem 'resque', '>= 2.0' @@ -88,6 +97,7 @@ gem 'pg', platform: :ruby gem 'sqlite3', '>= 1.4.2', platform: :ruby gem 'sequel', '~> 5.54.0' # TODO: Support sequel 5.62.0+ + gem 'trilogy' end appraise 'activesupport' do diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index e95401a2a29..e4d077fdef1 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -2024,6 +2024,29 @@ end LogJob.perform_async('login') ``` +### Trilogy + +The trilogy integration traces any SQL command sent through the `trilogy` gem. + +```ruby +require 'trilogy' +require 'ddtrace' + +Datadog.configure do |c| + c.tracing.instrument :trilogy, **options +end + +client = Trilogy.new(host: "localhost", username: "root") +client.query("SELECT * FROM users WHERE group='x'") +``` + +`options` are the following keyword arguments: + +| Key | Env Var | Description | Default | +|-----------------------|---------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------| +| `service_name` | `DD_TRACE_TRILOGY_SERVICE_NAME` | Name of application running the `trilogy` instrumentation. May be overridden by `global_default_service_name`. [See *Additional Configuration* for more details](#additional-configuration) | `trilogy` | +| `peer_service` | `DD_TRACE_TRILOGY_PEER_SERVICE` | Name of external service the application connects to | `nil` | + ## Additional configuration To change the default behavior of `ddtrace`, you can use, in order of priority, with 1 being the highest: diff --git a/gemfiles/ruby_3.0_rails61_trilogy.gemfile b/gemfiles/ruby_3.0_rails61_trilogy.gemfile new file mode 100644 index 00000000000..1f20e767927 --- /dev/null +++ b/gemfiles/ruby_3.0_rails61_trilogy.gemfile @@ -0,0 +1,50 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 2.4.0" +gem "benchmark-ips", "~> 2.8" +gem "benchmark-memory", "< 0.2" +gem "builder" +gem "climate_control", "~> 0.2.0" +gem "concurrent-ruby" +gem "extlz4", "~> 0.3", ">= 0.3.3" +gem "json-schema", "< 3" +gem "memory_profiler", "~> 0.9" +gem "os", "~> 1.1" +gem "pimpmychangelog", ">= 0.1.2" +gem "pry" +gem "pry-byebug" +gem "pry-stack_explorer" +gem "rake", ">= 10.5" +gem "rake-compiler", "~> 1.1", ">= 1.1.1" +gem "redcarpet", "~> 3.4" +gem "rspec", "~> 3.12" +gem "rspec-collection_matchers", "~> 1.1" +gem "rspec-wait", "~> 0" +gem "rspec_junit_formatter", ">= 0.5.1" +gem "rspec_n", "~> 1.3" +gem "simplecov", git: "https://github.com/DataDog/simplecov", ref: "3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db" +gem "simplecov-cobertura", "~> 2.1.0" +gem "warning", "~> 1" +gem "webmock", ">= 3.10.0" +gem "webrick", ">= 1.7.0" +gem "yard", "~> 0.9" +gem "rubocop", "~> 1.50.0", require: false +gem "rubocop-packaging", "~> 0.5.2", require: false +gem "rubocop-performance", "~> 1.9", require: false +gem "rubocop-rspec", ["~> 2.20", "< 2.21"], require: false +gem "dogstatsd-ruby", ">= 3.3.0", "!= 5.0.0", "!= 5.0.1", "!= 5.1.0" +gem "google-protobuf", ["~> 3.0", "!= 3.7.0", "!= 3.7.1"] +gem "rails", "~> 6.1.0" +gem "trilogy" +gem "activerecord-trilogy-adapter" +gem "sprockets", "< 4" +gem "lograge", "~> 0.11" +gem "net-smtp" + +group :check do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.0_rails61_trilogy.gemfile.lock b/gemfiles/ruby_3.0_rails61_trilogy.gemfile.lock new file mode 100644 index 00000000000..ee5d68db96f --- /dev/null +++ b/gemfiles/ruby_3.0_rails61_trilogy.gemfile.lock @@ -0,0 +1,348 @@ +GIT + remote: https://github.com/DataDog/simplecov + revision: 3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db + ref: 3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db + specs: + simplecov (0.21.2) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + +PATH + remote: .. + specs: + ddtrace (1.17.0) + datadog-ci (~> 0.5.0) + debase-ruby_core_source (= 3.2.3) + libdatadog (~> 5.0.0.1.0) + libddwaf (~> 1.14.0.0.0) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (>= 2.7.1) + actionmailer (6.1.7.6) + actionpack (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7.6) + actionview (= 6.1.7.6) + activesupport (= 6.1.7.6) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.6) + actionpack (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + nokogiri (>= 1.8.5) + actionview (6.1.7.6) + activesupport (= 6.1.7.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7.6) + activesupport (= 6.1.7.6) + globalid (>= 0.3.6) + activemodel (6.1.7.6) + activesupport (= 6.1.7.6) + activerecord (6.1.7.6) + activemodel (= 6.1.7.6) + activesupport (= 6.1.7.6) + activerecord-trilogy-adapter (3.1.2) + activerecord (>= 6.0.a, < 7.1.a) + trilogy (>= 2.4.0) + activestorage (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activesupport (= 6.1.7.6) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.5) + public_suffix (>= 2.0.2, < 6.0) + appraisal (2.4.1) + bundler + rake + thor (>= 0.14.0) + ast (2.4.2) + benchmark-ips (2.12.0) + benchmark-memory (0.1.2) + memory_profiler (~> 0.9) + binding_of_caller (1.0.0) + debug_inspector (>= 0.0.1) + builder (3.2.4) + byebug (11.1.3) + climate_control (0.2.0) + coderay (1.1.3) + colorize (0.8.1) + concurrent-ruby (1.2.2) + crack (0.4.5) + rexml + crass (1.0.6) + cri (2.15.11) + datadog-ci (0.5.0) + msgpack + date (3.3.4) + debase-ruby_core_source (3.2.3) + debug_inspector (1.1.0) + diff-lcs (1.5.0) + docile (1.4.0) + dogstatsd-ruby (5.6.1) + erubi (1.12.0) + extlz4 (0.3.4) + ffi (1.16.3) + globalid (1.2.1) + activesupport (>= 6.1) + google-protobuf (3.25.1-aarch64-linux) + google-protobuf (3.25.1-x86_64-linux) + hashdiff (1.0.1) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + json (2.6.3) + json-schema (2.8.1) + addressable (>= 2.4) + libdatadog (5.0.0.1.0-aarch64-linux) + libdatadog (5.0.0.1.0-x86_64-linux) + libddwaf (1.14.0.0.0-aarch64-linux) + ffi (~> 1.0) + libddwaf (1.14.0.0.0-x86_64-linux) + ffi (~> 1.0) + lograge (0.14.0) + actionpack (>= 4) + activesupport (>= 4) + railties (>= 4) + request_store (~> 1.0) + loofah (2.22.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + memory_profiler (0.9.14) + method_source (1.0.0) + mini_mime (1.1.5) + minitest (5.20.0) + msgpack (1.7.2) + net-imap (0.4.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.4.0) + net-protocol + nio4r (2.6.1) + nokogiri (1.15.5-aarch64-linux) + racc (~> 1.4) + nokogiri (1.15.5-x86_64-linux) + racc (~> 1.4) + os (1.1.4) + parallel (1.23.0) + parser (3.2.2.4) + ast (~> 2.4.1) + racc + pimpmychangelog (0.1.3) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.10.1) + byebug (~> 11.0) + pry (>= 0.13, < 0.15) + pry-stack_explorer (0.6.1) + binding_of_caller (~> 1.0) + pry (~> 0.13) + public_suffix (5.0.4) + racc (1.7.3) + rack (2.2.8) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.6) + actioncable (= 6.1.7.6) + actionmailbox (= 6.1.7.6) + actionmailer (= 6.1.7.6) + actionpack (= 6.1.7.6) + actiontext (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activemodel (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + bundler (>= 1.15.0) + railties (= 6.1.7.6) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + method_source + rake (>= 12.2) + thor (~> 1.0) + rainbow (3.1.1) + rake (13.1.0) + rake-compiler (1.2.5) + rake + redcarpet (3.6.0) + regexp_parser (2.8.2) + request_store (1.5.1) + rack (>= 1.4) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rspec-wait (0.0.9) + rspec (>= 3, < 4) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + rspec_n (1.5.0) + colorize (~> 0.8.0) + cri (~> 2.15.3) + rubocop (1.50.2) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.2.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.19.0) + rubocop (~> 1.41) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-performance (1.19.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rspec (2.20.0) + rubocop (~> 1.33) + rubocop-capybara (~> 2.17) + ruby-progressbar (1.13.0) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + thor (1.3.0) + timeout (0.4.1) + trilogy (2.6.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + warning (1.3.0) + webmock (3.19.1) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.8.1) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + yard (0.9.34) + zeitwerk (2.6.12) + +PLATFORMS + aarch64-linux + x86_64-linux + +DEPENDENCIES + activerecord-trilogy-adapter + appraisal (~> 2.4.0) + benchmark-ips (~> 2.8) + benchmark-memory (< 0.2) + builder + climate_control (~> 0.2.0) + concurrent-ruby + ddtrace! + dogstatsd-ruby (>= 3.3.0, != 5.1.0, != 5.0.1, != 5.0.0) + extlz4 (~> 0.3, >= 0.3.3) + google-protobuf (~> 3.0, != 3.7.1, != 3.7.0) + json-schema (< 3) + lograge (~> 0.11) + memory_profiler (~> 0.9) + net-smtp + os (~> 1.1) + pimpmychangelog (>= 0.1.2) + pry + pry-byebug + pry-stack_explorer + rails (~> 6.1.0) + rake (>= 10.5) + rake-compiler (~> 1.1, >= 1.1.1) + redcarpet (~> 3.4) + rspec (~> 3.12) + rspec-collection_matchers (~> 1.1) + rspec-wait (~> 0) + rspec_junit_formatter (>= 0.5.1) + rspec_n (~> 1.3) + rubocop (~> 1.50.0) + rubocop-packaging (~> 0.5.2) + rubocop-performance (~> 1.9) + rubocop-rspec (~> 2.20, < 2.21) + simplecov! + simplecov-cobertura (~> 2.1.0) + sprockets (< 4) + trilogy + warning (~> 1) + webmock (>= 3.10.0) + webrick (>= 1.7.0) + yard (~> 0.9) + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/ruby_3.0_relational_db.gemfile b/gemfiles/ruby_3.0_relational_db.gemfile index 271db905936..96112188e6d 100644 --- a/gemfiles/ruby_3.0_relational_db.gemfile +++ b/gemfiles/ruby_3.0_relational_db.gemfile @@ -44,6 +44,7 @@ gem "mysql2", ">= 0.5.3", platform: :ruby gem "pg", platform: :ruby gem "sqlite3", ">= 1.4.2", platform: :ruby gem "sequel", "~> 5.54.0" +gem "trilogy" group :check do diff --git a/gemfiles/ruby_3.0_relational_db.gemfile.lock b/gemfiles/ruby_3.0_relational_db.gemfile.lock index c40d6236a12..8c053ac6b6f 100644 --- a/gemfiles/ruby_3.0_relational_db.gemfile.lock +++ b/gemfiles/ruby_3.0_relational_db.gemfile.lock @@ -164,6 +164,7 @@ GEM sqlite3 (1.6.6-aarch64-linux) sqlite3 (1.6.6-x86_64-linux) thor (1.2.2) + trilogy (2.6.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) @@ -219,6 +220,7 @@ DEPENDENCIES simplecov! simplecov-cobertura (~> 2.1.0) sqlite3 (>= 1.4.2) + trilogy warning (~> 1) webmock (>= 3.10.0) webrick (>= 1.7.0) diff --git a/gemfiles/ruby_3.1_rails61_trilogy.gemfile b/gemfiles/ruby_3.1_rails61_trilogy.gemfile new file mode 100644 index 00000000000..1f20e767927 --- /dev/null +++ b/gemfiles/ruby_3.1_rails61_trilogy.gemfile @@ -0,0 +1,50 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 2.4.0" +gem "benchmark-ips", "~> 2.8" +gem "benchmark-memory", "< 0.2" +gem "builder" +gem "climate_control", "~> 0.2.0" +gem "concurrent-ruby" +gem "extlz4", "~> 0.3", ">= 0.3.3" +gem "json-schema", "< 3" +gem "memory_profiler", "~> 0.9" +gem "os", "~> 1.1" +gem "pimpmychangelog", ">= 0.1.2" +gem "pry" +gem "pry-byebug" +gem "pry-stack_explorer" +gem "rake", ">= 10.5" +gem "rake-compiler", "~> 1.1", ">= 1.1.1" +gem "redcarpet", "~> 3.4" +gem "rspec", "~> 3.12" +gem "rspec-collection_matchers", "~> 1.1" +gem "rspec-wait", "~> 0" +gem "rspec_junit_formatter", ">= 0.5.1" +gem "rspec_n", "~> 1.3" +gem "simplecov", git: "https://github.com/DataDog/simplecov", ref: "3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db" +gem "simplecov-cobertura", "~> 2.1.0" +gem "warning", "~> 1" +gem "webmock", ">= 3.10.0" +gem "webrick", ">= 1.7.0" +gem "yard", "~> 0.9" +gem "rubocop", "~> 1.50.0", require: false +gem "rubocop-packaging", "~> 0.5.2", require: false +gem "rubocop-performance", "~> 1.9", require: false +gem "rubocop-rspec", ["~> 2.20", "< 2.21"], require: false +gem "dogstatsd-ruby", ">= 3.3.0", "!= 5.0.0", "!= 5.0.1", "!= 5.1.0" +gem "google-protobuf", ["~> 3.0", "!= 3.7.0", "!= 3.7.1"] +gem "rails", "~> 6.1.0" +gem "trilogy" +gem "activerecord-trilogy-adapter" +gem "sprockets", "< 4" +gem "lograge", "~> 0.11" +gem "net-smtp" + +group :check do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.1_rails61_trilogy.gemfile.lock b/gemfiles/ruby_3.1_rails61_trilogy.gemfile.lock new file mode 100644 index 00000000000..ee5d68db96f --- /dev/null +++ b/gemfiles/ruby_3.1_rails61_trilogy.gemfile.lock @@ -0,0 +1,348 @@ +GIT + remote: https://github.com/DataDog/simplecov + revision: 3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db + ref: 3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db + specs: + simplecov (0.21.2) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + +PATH + remote: .. + specs: + ddtrace (1.17.0) + datadog-ci (~> 0.5.0) + debase-ruby_core_source (= 3.2.3) + libdatadog (~> 5.0.0.1.0) + libddwaf (~> 1.14.0.0.0) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (>= 2.7.1) + actionmailer (6.1.7.6) + actionpack (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7.6) + actionview (= 6.1.7.6) + activesupport (= 6.1.7.6) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.6) + actionpack (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + nokogiri (>= 1.8.5) + actionview (6.1.7.6) + activesupport (= 6.1.7.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7.6) + activesupport (= 6.1.7.6) + globalid (>= 0.3.6) + activemodel (6.1.7.6) + activesupport (= 6.1.7.6) + activerecord (6.1.7.6) + activemodel (= 6.1.7.6) + activesupport (= 6.1.7.6) + activerecord-trilogy-adapter (3.1.2) + activerecord (>= 6.0.a, < 7.1.a) + trilogy (>= 2.4.0) + activestorage (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activesupport (= 6.1.7.6) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.5) + public_suffix (>= 2.0.2, < 6.0) + appraisal (2.4.1) + bundler + rake + thor (>= 0.14.0) + ast (2.4.2) + benchmark-ips (2.12.0) + benchmark-memory (0.1.2) + memory_profiler (~> 0.9) + binding_of_caller (1.0.0) + debug_inspector (>= 0.0.1) + builder (3.2.4) + byebug (11.1.3) + climate_control (0.2.0) + coderay (1.1.3) + colorize (0.8.1) + concurrent-ruby (1.2.2) + crack (0.4.5) + rexml + crass (1.0.6) + cri (2.15.11) + datadog-ci (0.5.0) + msgpack + date (3.3.4) + debase-ruby_core_source (3.2.3) + debug_inspector (1.1.0) + diff-lcs (1.5.0) + docile (1.4.0) + dogstatsd-ruby (5.6.1) + erubi (1.12.0) + extlz4 (0.3.4) + ffi (1.16.3) + globalid (1.2.1) + activesupport (>= 6.1) + google-protobuf (3.25.1-aarch64-linux) + google-protobuf (3.25.1-x86_64-linux) + hashdiff (1.0.1) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + json (2.6.3) + json-schema (2.8.1) + addressable (>= 2.4) + libdatadog (5.0.0.1.0-aarch64-linux) + libdatadog (5.0.0.1.0-x86_64-linux) + libddwaf (1.14.0.0.0-aarch64-linux) + ffi (~> 1.0) + libddwaf (1.14.0.0.0-x86_64-linux) + ffi (~> 1.0) + lograge (0.14.0) + actionpack (>= 4) + activesupport (>= 4) + railties (>= 4) + request_store (~> 1.0) + loofah (2.22.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + memory_profiler (0.9.14) + method_source (1.0.0) + mini_mime (1.1.5) + minitest (5.20.0) + msgpack (1.7.2) + net-imap (0.4.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.4.0) + net-protocol + nio4r (2.6.1) + nokogiri (1.15.5-aarch64-linux) + racc (~> 1.4) + nokogiri (1.15.5-x86_64-linux) + racc (~> 1.4) + os (1.1.4) + parallel (1.23.0) + parser (3.2.2.4) + ast (~> 2.4.1) + racc + pimpmychangelog (0.1.3) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.10.1) + byebug (~> 11.0) + pry (>= 0.13, < 0.15) + pry-stack_explorer (0.6.1) + binding_of_caller (~> 1.0) + pry (~> 0.13) + public_suffix (5.0.4) + racc (1.7.3) + rack (2.2.8) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.6) + actioncable (= 6.1.7.6) + actionmailbox (= 6.1.7.6) + actionmailer (= 6.1.7.6) + actionpack (= 6.1.7.6) + actiontext (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activemodel (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + bundler (>= 1.15.0) + railties (= 6.1.7.6) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + method_source + rake (>= 12.2) + thor (~> 1.0) + rainbow (3.1.1) + rake (13.1.0) + rake-compiler (1.2.5) + rake + redcarpet (3.6.0) + regexp_parser (2.8.2) + request_store (1.5.1) + rack (>= 1.4) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rspec-wait (0.0.9) + rspec (>= 3, < 4) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + rspec_n (1.5.0) + colorize (~> 0.8.0) + cri (~> 2.15.3) + rubocop (1.50.2) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.2.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.19.0) + rubocop (~> 1.41) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-performance (1.19.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rspec (2.20.0) + rubocop (~> 1.33) + rubocop-capybara (~> 2.17) + ruby-progressbar (1.13.0) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + thor (1.3.0) + timeout (0.4.1) + trilogy (2.6.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + warning (1.3.0) + webmock (3.19.1) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.8.1) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + yard (0.9.34) + zeitwerk (2.6.12) + +PLATFORMS + aarch64-linux + x86_64-linux + +DEPENDENCIES + activerecord-trilogy-adapter + appraisal (~> 2.4.0) + benchmark-ips (~> 2.8) + benchmark-memory (< 0.2) + builder + climate_control (~> 0.2.0) + concurrent-ruby + ddtrace! + dogstatsd-ruby (>= 3.3.0, != 5.1.0, != 5.0.1, != 5.0.0) + extlz4 (~> 0.3, >= 0.3.3) + google-protobuf (~> 3.0, != 3.7.1, != 3.7.0) + json-schema (< 3) + lograge (~> 0.11) + memory_profiler (~> 0.9) + net-smtp + os (~> 1.1) + pimpmychangelog (>= 0.1.2) + pry + pry-byebug + pry-stack_explorer + rails (~> 6.1.0) + rake (>= 10.5) + rake-compiler (~> 1.1, >= 1.1.1) + redcarpet (~> 3.4) + rspec (~> 3.12) + rspec-collection_matchers (~> 1.1) + rspec-wait (~> 0) + rspec_junit_formatter (>= 0.5.1) + rspec_n (~> 1.3) + rubocop (~> 1.50.0) + rubocop-packaging (~> 0.5.2) + rubocop-performance (~> 1.9) + rubocop-rspec (~> 2.20, < 2.21) + simplecov! + simplecov-cobertura (~> 2.1.0) + sprockets (< 4) + trilogy + warning (~> 1) + webmock (>= 3.10.0) + webrick (>= 1.7.0) + yard (~> 0.9) + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/ruby_3.1_relational_db.gemfile b/gemfiles/ruby_3.1_relational_db.gemfile index 271db905936..96112188e6d 100644 --- a/gemfiles/ruby_3.1_relational_db.gemfile +++ b/gemfiles/ruby_3.1_relational_db.gemfile @@ -44,6 +44,7 @@ gem "mysql2", ">= 0.5.3", platform: :ruby gem "pg", platform: :ruby gem "sqlite3", ">= 1.4.2", platform: :ruby gem "sequel", "~> 5.54.0" +gem "trilogy" group :check do diff --git a/gemfiles/ruby_3.1_relational_db.gemfile.lock b/gemfiles/ruby_3.1_relational_db.gemfile.lock index c40d6236a12..8c053ac6b6f 100644 --- a/gemfiles/ruby_3.1_relational_db.gemfile.lock +++ b/gemfiles/ruby_3.1_relational_db.gemfile.lock @@ -164,6 +164,7 @@ GEM sqlite3 (1.6.6-aarch64-linux) sqlite3 (1.6.6-x86_64-linux) thor (1.2.2) + trilogy (2.6.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) @@ -219,6 +220,7 @@ DEPENDENCIES simplecov! simplecov-cobertura (~> 2.1.0) sqlite3 (>= 1.4.2) + trilogy warning (~> 1) webmock (>= 3.10.0) webrick (>= 1.7.0) diff --git a/gemfiles/ruby_3.2_rails61_trilogy.gemfile b/gemfiles/ruby_3.2_rails61_trilogy.gemfile new file mode 100644 index 00000000000..8767a69b2ba --- /dev/null +++ b/gemfiles/ruby_3.2_rails61_trilogy.gemfile @@ -0,0 +1,49 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 2.4.0" +gem "benchmark-ips", "~> 2.8" +gem "benchmark-memory", "< 0.2" +gem "builder" +gem "climate_control", "~> 0.2.0" +gem "concurrent-ruby" +gem "extlz4", "~> 0.3", ">= 0.3.3" +gem "json-schema", "< 3" +gem "memory_profiler", "~> 0.9" +gem "os", "~> 1.1" +gem "pimpmychangelog", ">= 0.1.2" +gem "pry" +gem "pry-stack_explorer" +gem "rake", ">= 10.5" +gem "rake-compiler", "~> 1.1", ">= 1.1.1" +gem "redcarpet", "~> 3.4" +gem "rspec", "~> 3.12" +gem "rspec-collection_matchers", "~> 1.1" +gem "rspec-wait", "~> 0" +gem "rspec_junit_formatter", ">= 0.5.1" +gem "rspec_n", "~> 1.3" +gem "simplecov", git: "https://github.com/DataDog/simplecov", ref: "3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db" +gem "simplecov-cobertura", "~> 2.1.0" +gem "warning", "~> 1" +gem "webmock", ">= 3.10.0" +gem "webrick", ">= 1.7.0" +gem "yard", "~> 0.9" +gem "rubocop", "~> 1.50.0", require: false +gem "rubocop-packaging", "~> 0.5.2", require: false +gem "rubocop-performance", "~> 1.9", require: false +gem "rubocop-rspec", ["~> 2.20", "< 2.21"], require: false +gem "dogstatsd-ruby", ">= 3.3.0", "!= 5.0.0", "!= 5.0.1", "!= 5.1.0" +gem "google-protobuf", ["~> 3.0", "!= 3.7.0", "!= 3.7.1"] +gem "rails", "~> 6.1.0" +gem "trilogy" +gem "activerecord-trilogy-adapter" +gem "sprockets", "< 4" +gem "lograge", "~> 0.11" +gem "net-smtp" + +group :check do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.2_rails61_trilogy.gemfile.lock b/gemfiles/ruby_3.2_rails61_trilogy.gemfile.lock new file mode 100644 index 00000000000..8d6cce39bab --- /dev/null +++ b/gemfiles/ruby_3.2_rails61_trilogy.gemfile.lock @@ -0,0 +1,343 @@ +GIT + remote: https://github.com/DataDog/simplecov + revision: 3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db + ref: 3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db + specs: + simplecov (0.21.2) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + +PATH + remote: .. + specs: + ddtrace (1.17.0) + datadog-ci (~> 0.5.0) + debase-ruby_core_source (= 3.2.3) + libdatadog (~> 5.0.0.1.0) + libddwaf (~> 1.14.0.0.0) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (>= 2.7.1) + actionmailer (6.1.7.6) + actionpack (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7.6) + actionview (= 6.1.7.6) + activesupport (= 6.1.7.6) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.6) + actionpack (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + nokogiri (>= 1.8.5) + actionview (6.1.7.6) + activesupport (= 6.1.7.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7.6) + activesupport (= 6.1.7.6) + globalid (>= 0.3.6) + activemodel (6.1.7.6) + activesupport (= 6.1.7.6) + activerecord (6.1.7.6) + activemodel (= 6.1.7.6) + activesupport (= 6.1.7.6) + activerecord-trilogy-adapter (3.1.2) + activerecord (>= 6.0.a, < 7.1.a) + trilogy (>= 2.4.0) + activestorage (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activesupport (= 6.1.7.6) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.5) + public_suffix (>= 2.0.2, < 6.0) + appraisal (2.4.1) + bundler + rake + thor (>= 0.14.0) + ast (2.4.2) + benchmark-ips (2.12.0) + benchmark-memory (0.1.2) + memory_profiler (~> 0.9) + binding_of_caller (1.0.0) + debug_inspector (>= 0.0.1) + builder (3.2.4) + climate_control (0.2.0) + coderay (1.1.3) + colorize (0.8.1) + concurrent-ruby (1.2.2) + crack (0.4.5) + rexml + crass (1.0.6) + cri (2.15.11) + datadog-ci (0.5.0) + msgpack + date (3.3.4) + debase-ruby_core_source (3.2.3) + debug_inspector (1.1.0) + diff-lcs (1.5.0) + docile (1.4.0) + dogstatsd-ruby (5.6.1) + erubi (1.12.0) + extlz4 (0.3.4) + ffi (1.16.3) + globalid (1.2.1) + activesupport (>= 6.1) + google-protobuf (3.25.1-aarch64-linux) + google-protobuf (3.25.1-x86_64-linux) + hashdiff (1.0.1) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + json (2.6.3) + json-schema (2.8.1) + addressable (>= 2.4) + libdatadog (5.0.0.1.0-aarch64-linux) + libdatadog (5.0.0.1.0-x86_64-linux) + libddwaf (1.14.0.0.0-aarch64-linux) + ffi (~> 1.0) + libddwaf (1.14.0.0.0-x86_64-linux) + ffi (~> 1.0) + lograge (0.14.0) + actionpack (>= 4) + activesupport (>= 4) + railties (>= 4) + request_store (~> 1.0) + loofah (2.22.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + memory_profiler (0.9.14) + method_source (1.0.0) + mini_mime (1.1.5) + minitest (5.20.0) + msgpack (1.7.2) + net-imap (0.4.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.4.0) + net-protocol + nio4r (2.6.1) + nokogiri (1.15.5-aarch64-linux) + racc (~> 1.4) + nokogiri (1.15.5-x86_64-linux) + racc (~> 1.4) + os (1.1.4) + parallel (1.23.0) + parser (3.2.2.4) + ast (~> 2.4.1) + racc + pimpmychangelog (0.1.3) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + pry-stack_explorer (0.6.1) + binding_of_caller (~> 1.0) + pry (~> 0.13) + public_suffix (5.0.4) + racc (1.7.3) + rack (2.2.8) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.6) + actioncable (= 6.1.7.6) + actionmailbox (= 6.1.7.6) + actionmailer (= 6.1.7.6) + actionpack (= 6.1.7.6) + actiontext (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activemodel (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + bundler (>= 1.15.0) + railties (= 6.1.7.6) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + method_source + rake (>= 12.2) + thor (~> 1.0) + rainbow (3.1.1) + rake (13.1.0) + rake-compiler (1.2.5) + rake + redcarpet (3.6.0) + regexp_parser (2.8.2) + request_store (1.5.1) + rack (>= 1.4) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rspec-wait (0.0.9) + rspec (>= 3, < 4) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + rspec_n (1.5.0) + colorize (~> 0.8.0) + cri (~> 2.15.3) + rubocop (1.50.2) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.2.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.19.0) + rubocop (~> 1.41) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-performance (1.19.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rspec (2.20.0) + rubocop (~> 1.33) + rubocop-capybara (~> 2.17) + ruby-progressbar (1.13.0) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + thor (1.3.0) + timeout (0.4.1) + trilogy (2.6.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + warning (1.3.0) + webmock (3.19.1) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.8.1) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + yard (0.9.34) + zeitwerk (2.6.12) + +PLATFORMS + aarch64-linux + x86_64-linux + +DEPENDENCIES + activerecord-trilogy-adapter + appraisal (~> 2.4.0) + benchmark-ips (~> 2.8) + benchmark-memory (< 0.2) + builder + climate_control (~> 0.2.0) + concurrent-ruby + ddtrace! + dogstatsd-ruby (>= 3.3.0, != 5.1.0, != 5.0.1, != 5.0.0) + extlz4 (~> 0.3, >= 0.3.3) + google-protobuf (~> 3.0, != 3.7.1, != 3.7.0) + json-schema (< 3) + lograge (~> 0.11) + memory_profiler (~> 0.9) + net-smtp + os (~> 1.1) + pimpmychangelog (>= 0.1.2) + pry + pry-stack_explorer + rails (~> 6.1.0) + rake (>= 10.5) + rake-compiler (~> 1.1, >= 1.1.1) + redcarpet (~> 3.4) + rspec (~> 3.12) + rspec-collection_matchers (~> 1.1) + rspec-wait (~> 0) + rspec_junit_formatter (>= 0.5.1) + rspec_n (~> 1.3) + rubocop (~> 1.50.0) + rubocop-packaging (~> 0.5.2) + rubocop-performance (~> 1.9) + rubocop-rspec (~> 2.20, < 2.21) + simplecov! + simplecov-cobertura (~> 2.1.0) + sprockets (< 4) + trilogy + warning (~> 1) + webmock (>= 3.10.0) + webrick (>= 1.7.0) + yard (~> 0.9) + +BUNDLED WITH + 2.3.26 diff --git a/gemfiles/ruby_3.2_relational_db.gemfile b/gemfiles/ruby_3.2_relational_db.gemfile index 893d1514376..6b322705da6 100644 --- a/gemfiles/ruby_3.2_relational_db.gemfile +++ b/gemfiles/ruby_3.2_relational_db.gemfile @@ -43,6 +43,7 @@ gem "mysql2", ">= 0.5.3", platform: :ruby gem "pg", platform: :ruby gem "sqlite3", ">= 1.4.2", platform: :ruby gem "sequel", "~> 5.54.0" +gem "trilogy" group :check do diff --git a/gemfiles/ruby_3.2_relational_db.gemfile.lock b/gemfiles/ruby_3.2_relational_db.gemfile.lock index 5274c12b322..80e31087fee 100644 --- a/gemfiles/ruby_3.2_relational_db.gemfile.lock +++ b/gemfiles/ruby_3.2_relational_db.gemfile.lock @@ -160,6 +160,7 @@ GEM sqlite3 (1.6.6-aarch64-linux) sqlite3 (1.6.6-x86_64-linux) thor (1.2.2) + trilogy (2.6.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) @@ -214,6 +215,7 @@ DEPENDENCIES simplecov! simplecov-cobertura (~> 2.1.0) sqlite3 (>= 1.4.2) + trilogy warning (~> 1) webmock (>= 3.10.0) webrick (>= 1.7.0) diff --git a/gemfiles/ruby_3.3_rails61_trilogy.gemfile b/gemfiles/ruby_3.3_rails61_trilogy.gemfile new file mode 100644 index 00000000000..8767a69b2ba --- /dev/null +++ b/gemfiles/ruby_3.3_rails61_trilogy.gemfile @@ -0,0 +1,49 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", "~> 2.4.0" +gem "benchmark-ips", "~> 2.8" +gem "benchmark-memory", "< 0.2" +gem "builder" +gem "climate_control", "~> 0.2.0" +gem "concurrent-ruby" +gem "extlz4", "~> 0.3", ">= 0.3.3" +gem "json-schema", "< 3" +gem "memory_profiler", "~> 0.9" +gem "os", "~> 1.1" +gem "pimpmychangelog", ">= 0.1.2" +gem "pry" +gem "pry-stack_explorer" +gem "rake", ">= 10.5" +gem "rake-compiler", "~> 1.1", ">= 1.1.1" +gem "redcarpet", "~> 3.4" +gem "rspec", "~> 3.12" +gem "rspec-collection_matchers", "~> 1.1" +gem "rspec-wait", "~> 0" +gem "rspec_junit_formatter", ">= 0.5.1" +gem "rspec_n", "~> 1.3" +gem "simplecov", git: "https://github.com/DataDog/simplecov", ref: "3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db" +gem "simplecov-cobertura", "~> 2.1.0" +gem "warning", "~> 1" +gem "webmock", ">= 3.10.0" +gem "webrick", ">= 1.7.0" +gem "yard", "~> 0.9" +gem "rubocop", "~> 1.50.0", require: false +gem "rubocop-packaging", "~> 0.5.2", require: false +gem "rubocop-performance", "~> 1.9", require: false +gem "rubocop-rspec", ["~> 2.20", "< 2.21"], require: false +gem "dogstatsd-ruby", ">= 3.3.0", "!= 5.0.0", "!= 5.0.1", "!= 5.1.0" +gem "google-protobuf", ["~> 3.0", "!= 3.7.0", "!= 3.7.1"] +gem "rails", "~> 6.1.0" +gem "trilogy" +gem "activerecord-trilogy-adapter" +gem "sprockets", "< 4" +gem "lograge", "~> 0.11" +gem "net-smtp" + +group :check do + +end + +gemspec path: "../" diff --git a/gemfiles/ruby_3.3_rails61_trilogy.gemfile.lock b/gemfiles/ruby_3.3_rails61_trilogy.gemfile.lock new file mode 100644 index 00000000000..4a29ed1c5e9 --- /dev/null +++ b/gemfiles/ruby_3.3_rails61_trilogy.gemfile.lock @@ -0,0 +1,342 @@ +GIT + remote: https://github.com/DataDog/simplecov + revision: 3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db + ref: 3bb6b7ee58bf4b1954ca205f50dd44d6f41c57db + specs: + simplecov (0.21.2) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + +PATH + remote: .. + specs: + ddtrace (1.17.0) + datadog-ci (~> 0.5.0) + debase-ruby_core_source (= 3.2.3) + libdatadog (~> 5.0.0.1.0) + libddwaf (~> 1.14.0.0.0) + msgpack + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (>= 2.7.1) + actionmailer (6.1.7.6) + actionpack (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activesupport (= 6.1.7.6) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.7.6) + actionview (= 6.1.7.6) + activesupport (= 6.1.7.6) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.6) + actionpack (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + nokogiri (>= 1.8.5) + actionview (6.1.7.6) + activesupport (= 6.1.7.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7.6) + activesupport (= 6.1.7.6) + globalid (>= 0.3.6) + activemodel (6.1.7.6) + activesupport (= 6.1.7.6) + activerecord (6.1.7.6) + activemodel (= 6.1.7.6) + activesupport (= 6.1.7.6) + activerecord-trilogy-adapter (3.1.2) + activerecord (>= 6.0.a, < 7.1.a) + trilogy (>= 2.4.0) + activestorage (6.1.7.6) + actionpack (= 6.1.7.6) + activejob (= 6.1.7.6) + activerecord (= 6.1.7.6) + activesupport (= 6.1.7.6) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.8.5) + public_suffix (>= 2.0.2, < 6.0) + appraisal (2.4.1) + bundler + rake + thor (>= 0.14.0) + ast (2.4.2) + benchmark-ips (2.12.0) + benchmark-memory (0.1.2) + memory_profiler (~> 0.9) + binding_of_caller (1.0.0) + debug_inspector (>= 0.0.1) + builder (3.2.4) + climate_control (0.2.0) + coderay (1.1.3) + colorize (0.8.1) + concurrent-ruby (1.2.2) + crack (0.4.5) + rexml + crass (1.0.6) + cri (2.15.11) + datadog-ci (0.5.0) + msgpack + date (3.3.4) + debase-ruby_core_source (3.2.3) + debug_inspector (1.1.0) + diff-lcs (1.5.0) + docile (1.4.0) + dogstatsd-ruby (5.6.1) + erubi (1.12.0) + extlz4 (0.3.4) + ffi (1.16.3) + globalid (1.2.1) + activesupport (>= 6.1) + google-protobuf (3.25.1) + hashdiff (1.0.1) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + json (2.6.3) + json-schema (2.8.1) + addressable (>= 2.4) + libdatadog (5.0.0.1.0-aarch64-linux) + libdatadog (5.0.0.1.0-x86_64-linux) + libddwaf (1.14.0.0.0-aarch64-linux) + ffi (~> 1.0) + libddwaf (1.14.0.0.0-x86_64-linux) + ffi (~> 1.0) + lograge (0.14.0) + actionpack (>= 4) + activesupport (>= 4) + railties (>= 4) + request_store (~> 1.0) + loofah (2.22.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + memory_profiler (0.9.14) + method_source (1.0.0) + mini_mime (1.1.5) + mini_portile2 (2.8.5) + minitest (5.20.0) + msgpack (1.7.2) + net-imap (0.4.5) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.4.0) + net-protocol + nio4r (2.6.1) + nokogiri (1.15.5) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + os (1.1.4) + parallel (1.23.0) + parser (3.2.2.4) + ast (~> 2.4.1) + racc + pimpmychangelog (0.1.3) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + pry-stack_explorer (0.6.1) + binding_of_caller (~> 1.0) + pry (~> 0.13) + public_suffix (5.0.4) + racc (1.7.3) + rack (2.2.8) + rack-test (2.1.0) + rack (>= 1.3) + rails (6.1.7.6) + actioncable (= 6.1.7.6) + actionmailbox (= 6.1.7.6) + actionmailer (= 6.1.7.6) + actionpack (= 6.1.7.6) + actiontext (= 6.1.7.6) + actionview (= 6.1.7.6) + activejob (= 6.1.7.6) + activemodel (= 6.1.7.6) + activerecord (= 6.1.7.6) + activestorage (= 6.1.7.6) + activesupport (= 6.1.7.6) + bundler (>= 1.15.0) + railties (= 6.1.7.6) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (6.1.7.6) + actionpack (= 6.1.7.6) + activesupport (= 6.1.7.6) + method_source + rake (>= 12.2) + thor (~> 1.0) + rainbow (3.1.1) + rake (13.1.0) + rake-compiler (1.2.5) + rake + redcarpet (3.6.0) + regexp_parser (2.8.2) + request_store (1.5.1) + rack (>= 1.4) + rexml (3.2.6) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.6) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.1) + rspec-wait (0.0.9) + rspec (>= 3, < 4) + rspec_junit_formatter (0.6.0) + rspec-core (>= 2, < 4, != 2.12.0) + rspec_n (1.5.0) + colorize (~> 0.8.0) + cri (~> 2.15.3) + rubocop (1.50.2) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.2.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.28.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.19.0) + rubocop (~> 1.41) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-performance (1.19.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-rspec (2.20.0) + rubocop (~> 1.33) + rubocop-capybara (~> 2.17) + ruby-progressbar (1.13.0) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + thor (1.3.0) + timeout (0.4.1) + trilogy (2.6.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + warning (1.3.0) + webmock (3.19.1) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.8.1) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + yard (0.9.34) + zeitwerk (2.6.12) + +PLATFORMS + aarch64-linux + x86_64-linux + +DEPENDENCIES + activerecord-trilogy-adapter + appraisal (~> 2.4.0) + benchmark-ips (~> 2.8) + benchmark-memory (< 0.2) + builder + climate_control (~> 0.2.0) + concurrent-ruby + ddtrace! + dogstatsd-ruby (>= 3.3.0, != 5.1.0, != 5.0.1, != 5.0.0) + extlz4 (~> 0.3, >= 0.3.3) + google-protobuf (~> 3.0, != 3.7.1, != 3.7.0) + json-schema (< 3) + lograge (~> 0.11) + memory_profiler (~> 0.9) + net-smtp + os (~> 1.1) + pimpmychangelog (>= 0.1.2) + pry + pry-stack_explorer + rails (~> 6.1.0) + rake (>= 10.5) + rake-compiler (~> 1.1, >= 1.1.1) + redcarpet (~> 3.4) + rspec (~> 3.12) + rspec-collection_matchers (~> 1.1) + rspec-wait (~> 0) + rspec_junit_formatter (>= 0.5.1) + rspec_n (~> 1.3) + rubocop (~> 1.50.0) + rubocop-packaging (~> 0.5.2) + rubocop-performance (~> 1.9) + rubocop-rspec (~> 2.20, < 2.21) + simplecov! + simplecov-cobertura (~> 2.1.0) + sprockets (< 4) + trilogy + warning (~> 1) + webmock (>= 3.10.0) + webrick (>= 1.7.0) + yard (~> 0.9) + +BUNDLED WITH + 2.3.27 diff --git a/gemfiles/ruby_3.3_relational_db.gemfile b/gemfiles/ruby_3.3_relational_db.gemfile index 893d1514376..6b322705da6 100644 --- a/gemfiles/ruby_3.3_relational_db.gemfile +++ b/gemfiles/ruby_3.3_relational_db.gemfile @@ -43,6 +43,7 @@ gem "mysql2", ">= 0.5.3", platform: :ruby gem "pg", platform: :ruby gem "sqlite3", ">= 1.4.2", platform: :ruby gem "sequel", "~> 5.54.0" +gem "trilogy" group :check do diff --git a/gemfiles/ruby_3.3_relational_db.gemfile.lock b/gemfiles/ruby_3.3_relational_db.gemfile.lock index c35e8635062..49ed6105c5e 100644 --- a/gemfiles/ruby_3.3_relational_db.gemfile.lock +++ b/gemfiles/ruby_3.3_relational_db.gemfile.lock @@ -160,6 +160,7 @@ GEM sqlite3 (1.6.6) mini_portile2 (~> 2.8.0) thor (1.2.2) + trilogy (2.6.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.4.2) @@ -214,6 +215,7 @@ DEPENDENCIES simplecov! simplecov-cobertura (~> 2.1.0) sqlite3 (>= 1.4.2) + trilogy warning (~> 1) webmock (>= 3.10.0) webrick (>= 1.7.0) diff --git a/lib/datadog/tracing/contrib.rb b/lib/datadog/tracing/contrib.rb index 92ca64b5ea5..0c7e5871428 100644 --- a/lib/datadog/tracing/contrib.rb +++ b/lib/datadog/tracing/contrib.rb @@ -79,3 +79,4 @@ module Contrib require_relative 'contrib/sneakers/integration' require_relative 'contrib/stripe/integration' require_relative 'contrib/sucker_punch/integration' +require_relative 'contrib/trilogy/integration' diff --git a/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb b/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb new file mode 100644 index 00000000000..811d1cd1c1c --- /dev/null +++ b/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb @@ -0,0 +1,58 @@ +# frozen_string_literal: true + +require_relative '../../configuration/settings' +require_relative '../ext' + +require_relative '../../propagation/sql_comment' + +module Datadog + module Tracing + module Contrib + module Trilogy + module Configuration + # Custom settings for the Trilogy integration + # @public_api + class Settings < Contrib::Configuration::Settings + option :enabled do |o| + o.type :bool + o.env Ext::ENV_ENABLED + o.default true + end + + option :analytics_enabled do |o| + o.type :bool + o.env Ext::ENV_ANALYTICS_ENABLED + o.default false + end + + option :analytics_sample_rate do |o| + o.type :float + o.env Ext::ENV_ANALYTICS_SAMPLE_RATE + o.default 1.0 + end + + option :service_name do |o| + o.default do + Contrib::SpanAttributeSchema.fetch_service_name( + Ext::ENV_SERVICE_NAME, + Ext::DEFAULT_PEER_SERVICE_NAME + ) + end + end + + option :comment_propagation do |o| + o.type :string + o.env Contrib::Propagation::SqlComment::Ext::ENV_DBM_PROPAGATION_MODE + o.default Contrib::Propagation::SqlComment::Ext::DISABLED + end + + option :peer_service do |o| + o.type :string, nilable: true + o.env Ext::ENV_PEER_SERVICE + end + end + end + end + end + end +end diff --git a/lib/datadog/tracing/contrib/trilogy/ext.rb b/lib/datadog/tracing/contrib/trilogy/ext.rb new file mode 100644 index 00000000000..94bd22792ac --- /dev/null +++ b/lib/datadog/tracing/contrib/trilogy/ext.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Datadog + module Tracing + module Contrib + module Trilogy + # Trilogy integration constants + # @public_api Changing resource names, tag names, or environment variables creates breaking changes. + module Ext + ENV_ENABLED = 'DD_TRACE_TRILOGY_ENABLED' + ENV_SERVICE_NAME = 'DD_TRACE_TRILOGY_SERVICE_NAME' + ENV_PEER_SERVICE = 'DD_TRACE_TRILOGY_PEER_SERVICE' + + ENV_ANALYTICS_ENABLED = 'DD_TRACE_TRILOGY_ANALYTICS_ENABLED' + ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_TRILOGY_ANALYTICS_SAMPLE_RATE' + DEFAULT_PEER_SERVICE_NAME = 'trilogy' + SPAN_QUERY = 'trilogy.query' + TAG_DB_NAME = 'trilogy.db.name' + TAG_COMPONENT = 'trilogy' + TAG_OPERATION_QUERY = 'query' + TAG_SYSTEM = 'mysql' + PEER_SERVICE_SOURCES = (Array[Ext::TAG_DB_NAME] + Contrib::Ext::DB::PEER_SERVICE_SOURCES).freeze + end + end + end + end +end diff --git a/lib/datadog/tracing/contrib/trilogy/instrumentation.rb b/lib/datadog/tracing/contrib/trilogy/instrumentation.rb new file mode 100644 index 00000000000..39fa186bd03 --- /dev/null +++ b/lib/datadog/tracing/contrib/trilogy/instrumentation.rb @@ -0,0 +1,94 @@ +# frozen_string_literal: true + +require_relative '../../metadata/ext' +require_relative '../analytics' +require_relative 'ext' +require_relative '../ext' +require_relative '../propagation/sql_comment' +require_relative '../propagation/sql_comment/mode' + +module Datadog + module Tracing + module Contrib + module Trilogy + # Trilogy patch module + module Instrumentation + def self.included(base) + base.prepend(InstanceMethods) + end + + # Trilogy patch instance methods + module InstanceMethods + def query(sql) + service = Datadog.configuration_for(self, :service_name) || datadog_configuration[:service_name] + + Tracing.trace(Ext::SPAN_QUERY, service: service) do |span, trace_op| + span.resource = sql + span.span_type = Tracing::Metadata::Ext::SQL::TYPE + + if datadog_configuration[:peer_service] + span.set_tag( + Tracing::Metadata::Ext::TAG_PEER_SERVICE, + datadog_configuration[:peer_service] + ) + end + + # Tag original global service name if not used + if span.service != Datadog.configuration.service + span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_BASE_SERVICE, Datadog.configuration.service) + end + + span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM) + span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT) + + span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT) + span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_QUERY) + + span.set_tag(Tracing::Metadata::Ext::TAG_PEER_HOSTNAME, connection_options[:host]) + + # Set analytics sample rate + Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled? + + span.set_tag(Ext::TAG_DB_NAME, connection_options[:database]) + span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_HOST, connection_options[:host]) + span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_PORT, connection_options[:port]) + + Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES) + + propagation_mode = Contrib::Propagation::SqlComment::Mode.new(comment_propagation) + + Contrib::Propagation::SqlComment.annotate!(span, propagation_mode) + sql = Contrib::Propagation::SqlComment.prepend_comment( + sql, + span, + trace_op, + propagation_mode + ) + + super(sql) + end + end + + private + + def datadog_configuration + Datadog.configuration.tracing[:trilogy] + end + + def analytics_enabled? + datadog_configuration[:analytics_enabled] + end + + def analytics_sample_rate + datadog_configuration[:analytics_sample_rate] + end + + def comment_propagation + datadog_configuration[:comment_propagation] + end + end + end + end + end + end +end diff --git a/lib/datadog/tracing/contrib/trilogy/integration.rb b/lib/datadog/tracing/contrib/trilogy/integration.rb new file mode 100644 index 00000000000..f8131d54088 --- /dev/null +++ b/lib/datadog/tracing/contrib/trilogy/integration.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +require_relative '../integration' +require_relative 'configuration/settings' +require_relative 'patcher' + +module Datadog + module Tracing + module Contrib + module Trilogy + # Description of Trilogy integration + class Integration + include Contrib::Integration + + MINIMUM_VERSION = Gem::Version.new('2.0.0') + + # @public_api Changing the integration name or integration options can cause breaking changes + register_as :trilogy + + def self.version + Gem.loaded_specs['trilogy'] && Gem.loaded_specs['trilogy'].version + end + + def self.loaded? + !defined?(::Trilogy).nil? + end + + def self.compatible? + super && version >= MINIMUM_VERSION + end + + def new_configuration + Configuration::Settings.new + end + + def patcher + Patcher + end + end + end + end + end +end diff --git a/lib/datadog/tracing/contrib/trilogy/patcher.rb b/lib/datadog/tracing/contrib/trilogy/patcher.rb new file mode 100644 index 00000000000..e8910f86a1e --- /dev/null +++ b/lib/datadog/tracing/contrib/trilogy/patcher.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require_relative '../patcher' +require_relative 'instrumentation' + +module Datadog + module Tracing + module Contrib + module Trilogy + # Patcher enables patching of 'trilogy' module. + module Patcher + include Contrib::Patcher + + module_function + + def target_version + Integration.version + end + + def patch + patch_trilogy_client + end + + def patch_trilogy_client + ::Trilogy.include(Instrumentation) + end + end + end + end + end +end diff --git a/sig/datadog/tracing/contrib/trilogy/configuration/settings.rbs b/sig/datadog/tracing/contrib/trilogy/configuration/settings.rbs new file mode 100644 index 00000000000..7289e28f64d --- /dev/null +++ b/sig/datadog/tracing/contrib/trilogy/configuration/settings.rbs @@ -0,0 +1,12 @@ +module Datadog + module Tracing + module Contrib + module Trilogy + module Configuration + class Settings < Contrib::Configuration::Settings + end + end + end + end + end +end diff --git a/sig/datadog/tracing/contrib/trilogy/ext.rbs b/sig/datadog/tracing/contrib/trilogy/ext.rbs new file mode 100644 index 00000000000..ce8cacf01e7 --- /dev/null +++ b/sig/datadog/tracing/contrib/trilogy/ext.rbs @@ -0,0 +1,33 @@ +module Datadog + module Tracing + module Contrib + module Trilogy + module Ext + ENV_ENABLED: "DD_TRACE_TRILOGY_ENABLED" + + ENV_SERVICE_NAME: "DD_TRACE_TRILOGY_SERVICE_NAME" + + ENV_PEER_SERVICE: "DD_TRACE_TRILOGY_PEER_SERVICE" + + ENV_ANALYTICS_ENABLED: "DD_TRACE_TRILOGY_ANALYTICS_ENABLED" + + ENV_ANALYTICS_SAMPLE_RATE: "DD_TRACE_TRILOGY_ANALYTICS_SAMPLE_RATE" + + DEFAULT_PEER_SERVICE_NAME: "trilogy" + + SPAN_QUERY: "trilogy.query" + + TAG_DB_NAME: "trilogy.db.name" + + TAG_COMPONENT: "trilogy" + + TAG_OPERATION_QUERY: "query" + + TAG_SYSTEM: "mysql" + + PEER_SERVICE_SOURCES: untyped + end + end + end + end +end diff --git a/sig/datadog/tracing/contrib/trilogy/instrumentation.rbs b/sig/datadog/tracing/contrib/trilogy/instrumentation.rbs new file mode 100644 index 00000000000..08dac081bb6 --- /dev/null +++ b/sig/datadog/tracing/contrib/trilogy/instrumentation.rbs @@ -0,0 +1,24 @@ +module Datadog + module Tracing + module Contrib + module Trilogy + module Instrumentation + def self.included: (untyped base) -> untyped + module InstanceMethods + def query: (untyped sql) -> untyped + + private + + def datadog_configuration: () -> untyped + + def analytics_enabled?: () -> untyped + + def analytics_sample_rate: () -> untyped + + def comment_propagation: () -> untyped + end + end + end + end + end +end diff --git a/sig/datadog/tracing/contrib/trilogy/integration.rbs b/sig/datadog/tracing/contrib/trilogy/integration.rbs new file mode 100644 index 00000000000..a5b67c03523 --- /dev/null +++ b/sig/datadog/tracing/contrib/trilogy/integration.rbs @@ -0,0 +1,23 @@ +module Datadog + module Tracing + module Contrib + module Trilogy + class Integration + include Contrib::Integration + + MINIMUM_VERSION: untyped + + def self.version: () -> untyped + + def self.loaded?: () -> untyped + + def self.compatible?: () -> untyped + + def new_configuration: () -> untyped + + def patcher: () -> untyped + end + end + end + end +end diff --git a/sig/datadog/tracing/contrib/trilogy/patcher.rbs b/sig/datadog/tracing/contrib/trilogy/patcher.rbs new file mode 100644 index 00000000000..be5b4deace0 --- /dev/null +++ b/sig/datadog/tracing/contrib/trilogy/patcher.rbs @@ -0,0 +1,17 @@ +module Datadog + module Tracing + module Contrib + module Trilogy + module Patcher + include Contrib::Patcher + + def self?.target_version: () -> untyped + + def self?.patch: () -> untyped + + def self?.patch_trilogy_client: () -> untyped + end + end + end + end +end diff --git a/spec/datadog/tracing/contrib/rails/support/database.rb b/spec/datadog/tracing/contrib/rails/support/database.rb index 32565663130..e62fb071938 100644 --- a/spec/datadog/tracing/contrib/rails/support/database.rb +++ b/spec/datadog/tracing/contrib/rails/support/database.rb @@ -13,6 +13,7 @@ def load_adapter! mysql2 activerecord-jdbcpostgresql-adapter activerecord-jdbcmysql-adapter + activerecord-trilogy-adapter ].each do |adapter| begin require adapter @@ -21,6 +22,8 @@ def load_adapter! connector = postgres_url elsif adapter.include?('mysql') connector = mysql_url + elsif adapter == 'activerecord-trilogy-adapter' + connector = mysql_url('trilogy') end rescue LoadError puts "#{adapter} gem not found, trying another connector" @@ -47,9 +50,9 @@ def postgres_hash } end - def mysql_url + def mysql_url(protocol = 'mysql2') hash = mysql_hash - "mysql2://root:#{hash[:password]}@#{hash[:host]}:#{hash[:port]}/#{hash[:database]}" + "#{protocol}://root:#{hash[:password]}@#{hash[:host]}:#{hash[:port]}/#{hash[:database]}" end def mysql_hash diff --git a/spec/datadog/tracing/contrib/trilogy/configuration/settings_spec.rb b/spec/datadog/tracing/contrib/trilogy/configuration/settings_spec.rb new file mode 100644 index 00000000000..1bed5a45405 --- /dev/null +++ b/spec/datadog/tracing/contrib/trilogy/configuration/settings_spec.rb @@ -0,0 +1,6 @@ +require 'datadog/tracing/contrib/trilogy/configuration/settings' +require 'datadog/tracing/contrib/service_name_settings_examples' + +RSpec.describe Datadog::Tracing::Contrib::Trilogy::Configuration::Settings do + it_behaves_like 'service name setting', 'trilogy' +end diff --git a/spec/datadog/tracing/contrib/trilogy/integration_spec.rb b/spec/datadog/tracing/contrib/trilogy/integration_spec.rb new file mode 100644 index 00000000000..a22a39d1ffc --- /dev/null +++ b/spec/datadog/tracing/contrib/trilogy/integration_spec.rb @@ -0,0 +1,55 @@ +require 'datadog/tracing/contrib/support/spec_helper' + +require 'datadog/tracing/contrib/trilogy/integration' + +RSpec.describe Datadog::Tracing::Contrib::Trilogy::Integration do + let(:integration) { described_class.new(:trilogy) } + + describe '.version' do + subject(:version) { described_class.version } + + context 'when the "trilogy" gem is loaded' do + include_context 'loaded gems', trilogy: described_class::MINIMUM_VERSION + it { is_expected.to be_a_kind_of(Gem::Version) } + end + + context 'when "trilogy" gem is not loaded' do + include_context 'loaded gems', trilogy: nil + it { is_expected.to be nil } + end + end + + describe '.loaded?' do + subject(:loaded?) { described_class.loaded? } + + context 'when Trilogy is defined' do + before { stub_const('Trilogy', Class.new) } + + it { is_expected.to be true } + end + + context 'when Trilogy is not defined' do + before { hide_const('Trilogy') } + + it { is_expected.to be false } + end + end + + describe '#auto_instrument?' do + subject(:auto_instrument?) { integration.auto_instrument? } + + it { is_expected.to be(true) } + end + + describe '#default_configuration' do + subject(:default_configuration) { integration.default_configuration } + + it { is_expected.to be_a_kind_of(Datadog::Tracing::Contrib::Trilogy::Configuration::Settings) } + end + + describe '#patcher' do + subject(:patcher) { integration.patcher } + + it { is_expected.to be Datadog::Tracing::Contrib::Trilogy::Patcher } + end +end diff --git a/spec/datadog/tracing/contrib/trilogy/patcher_spec.rb b/spec/datadog/tracing/contrib/trilogy/patcher_spec.rb new file mode 100644 index 00000000000..07994ef603f --- /dev/null +++ b/spec/datadog/tracing/contrib/trilogy/patcher_spec.rb @@ -0,0 +1,155 @@ +require 'datadog/tracing/contrib/integration_examples' +require 'datadog/tracing/contrib/support/spec_helper' +require 'datadog/tracing/contrib/analytics_examples' +require 'datadog/tracing/contrib/propagation/sql_comment' +require 'datadog/tracing/contrib/sql_comment_propagation_examples' +require 'datadog/tracing/contrib/environment_service_name_examples' +require 'datadog/tracing/contrib/span_attribute_schema_examples' +require 'datadog/tracing/contrib/peer_service_configuration_examples' + +require 'ddtrace' +require 'trilogy' + +RSpec.describe 'Trlogy::Client patcher' do + let(:service_name) { 'trilogy' } + let(:configuration_options) { { service_name: service_name } } + + let(:client) do + Trilogy.new( + host: host, + port: port, + database: database, + username: username, + password: password + ) + end + + let(:host) { ENV.fetch('TEST_MYSQL_HOST') { '127.0.0.1' } } + let(:port) { ENV.fetch('TEST_MYSQL_PORT') { '3306' } } + let(:database) { ENV.fetch('TEST_MYSQL_DB') { 'mysql' } } + let(:username) { ENV.fetch('TEST_MYSQL_USER') { 'root' } } + let(:password) { ENV.fetch('TEST_MYSQL_PASSWORD') { 'root' } } + + before do + Datadog.configure do |c| + c.tracing.instrument :trilogy, configuration_options + end + end + + around do |example| + # Reset before and after each example; don't allow global state to linger. + Datadog.registry[:trilogy].reset_configuration! + example.run + Datadog.registry[:trilogy].reset_configuration! + end + + describe 'tracing' do + describe '#query' do + subject(:query) { client.query(sql_statement) } + + let(:sql_statement) { 'SELECT 1' } + + context 'when the tracer is disabled' do + before { tracer.enabled = false } + + it 'does not write spans' do + query + + expect(spans).to be_empty + end + end + + context 'when the client is configured directly' do + let(:service_name) { 'trilogy-override' } + + before do + Datadog.configure_onto(client, service_name: service_name) + end + + it 'produces a trace with service override' do + query + + expect(spans.count).to eq(1) + expect(span.service).to eq(service_name) + expect(span.get_tag('span.kind')).to eq('client') + expect(span.get_tag('db.system')).to eq('mysql') + expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_PEER_SERVICE)).to eq(database) + end + + it_behaves_like 'with sql comment propagation', span_op_name: 'trilogy.query' + end + + context 'when a successful query is made' do + it 'produces a trace' do + query + + expect(spans.count).to eq(1) + expect(span.get_tag('span.kind')).to eq('client') + expect(span.get_tag('trilogy.db.name')).to eq(database) + expect(span.get_tag('out.host')).to eq(host) + expect(span.get_tag('out.port')).to eq(port.to_f) + expect(span.get_tag('db.system')).to eq('mysql') + expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('trilogy') + expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('query') + end + + it_behaves_like 'analytics for integration' do + before { query } + let(:analytics_enabled_var) { Datadog::Tracing::Contrib::Trilogy::Ext::ENV_ANALYTICS_ENABLED } + let(:analytics_sample_rate_var) { Datadog::Tracing::Contrib::Trilogy::Ext::ENV_ANALYTICS_SAMPLE_RATE } + end + + it_behaves_like 'a peer service span' do + before { query } + let(:peer_service_val) { database } + let(:peer_service_source) { 'trilogy.db.name' } + end + + it_behaves_like 'measured span for integration', false do + before { query } + end + + it_behaves_like 'with sql comment propagation', span_op_name: 'trilogy.query' + + it_behaves_like 'environment service name', 'DD_TRACE_TRILOGY_SERVICE_NAME' do + let(:configuration_options) { {} } + end + + it_behaves_like 'configured peer service span', 'DD_TRACE_TRILOGY_PEER_SERVICE' do + let(:configuration_options) { {} } + end + + it_behaves_like 'schema version span' do + let(:configuration_options) { {} } + let(:peer_service_val) { database } + let(:peer_service_source) { 'trilogy.db.name' } + end + end + + context 'when a failed query is made' do + let(:sql_statement) { 'SELECT INVALID' } + + it 'traces failed queries' do + expect { query }.to raise_error(Trilogy::Error) + + expect(spans.count).to eq(1) + expect(span.status).to eq(1) + expect(span.get_tag('span.kind')).to eq('client') + expect(span.get_tag('db.system')).to eq('mysql') + expect(span.get_tag('error.message')) + .to eq("1054: Unknown column 'INVALID' in 'field list'") + end + + it_behaves_like 'with sql comment propagation', span_op_name: 'trilogy.query', error: Trilogy::Error + + it_behaves_like 'environment service name', 'DD_TRACE_TRILOGY_SERVICE_NAME', error: Trilogy::Error do + let(:configuration_options) { {} } + end + + it_behaves_like 'configured peer service span', 'DD_TRACE_TRILOGY_PEER_SERVICE', error: Trilogy::Error do + let(:configuration_options) { {} } + end + end + end + end +end diff --git a/spec/datadog/tracing/contrib_spec.rb b/spec/datadog/tracing/contrib_spec.rb index 6cea00579e8..46cb9b8c012 100644 --- a/spec/datadog/tracing/contrib_spec.rb +++ b/spec/datadog/tracing/contrib_spec.rb @@ -52,7 +52,8 @@ 'sinatra' => 'Sinatra', 'sneakers' => 'Sneakers', 'stripe' => 'Stripe', - 'sucker_punch' => 'SuckerPunch' + 'sucker_punch' => 'SuckerPunch', + 'trilogy' => 'Trilogy' } Dir.chdir("#{root}/lib/datadog/tracing/contrib") do |pwd|