Skip to content

Commit

Permalink
add Stripe instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
agrobbin committed Jan 21, 2023
1 parent 095cffb commit 5be411f
Show file tree
Hide file tree
Showing 35 changed files with 434 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ elsif ruby_version?('2.3')
gem 'sidekiq'
gem 'sneakers', '>= 2.12.0'
gem 'sqlite3', '~> 1.3.6'
gem 'stripe', '~> 5.15'
gem 'sucker_punch'
gem 'typhoeus'
gem 'que', '>= 1.0.0', '< 2.0.0'
Expand Down Expand Up @@ -683,6 +684,7 @@ elsif ruby_version?('2.4')
gem 'sidekiq'
gem 'sneakers', '>= 2.12.0'
gem 'sqlite3', '~> 1.3.6'
gem 'stripe', '~> 6.0'
gem 'sucker_punch'
gem 'typhoeus'
gem 'que', '>= 1.0.0', '< 2.0.0'
Expand Down Expand Up @@ -951,6 +953,7 @@ elsif ruby_version?('2.5')
gem 'sneakers', '>= 2.12.0'
gem 'bunny', '~> 2.19.0' # uninitialized constant OpenSSL::SSL::TLS1_3_VERSION for jruby, https://github.com/ruby-amqp/bunny/issues/645
gem 'sqlite3', '~> 1.4.1', platform: :ruby
gem 'stripe', '~> 7.0'
gem 'jdbc-sqlite3', '>= 3.28', platform: :jruby
gem 'sucker_punch'
gem 'typhoeus'
Expand Down Expand Up @@ -1199,6 +1202,7 @@ elsif ruby_version?('2.6')
gem 'sidekiq', '~> 6.5'
gem 'sneakers', '>= 2.12.0'
gem 'sqlite3', '~> 1.4.1', platform: :ruby
gem 'stripe', '~> 8.0'
gem 'jdbc-sqlite3', '>= 3.28', platform: :jruby
gem 'sucker_punch'
gem 'typhoeus'
Expand Down Expand Up @@ -1426,6 +1430,7 @@ elsif ruby_version?('2.7')
gem 'sidekiq', '~> 6' # TODO: Support sidekiq 7.x
gem 'sneakers', '>= 2.12.0'
gem 'sqlite3', '~> 1.4.1'
gem 'stripe'
gem 'sucker_punch'
gem 'typhoeus'
gem 'que', '>= 1.0.0'
Expand Down Expand Up @@ -1557,6 +1562,7 @@ elsif ruby_version?('3.0') || ruby_version?('3.1')
gem 'sidekiq', '~> 6' # TODO: Support sidekiq 7.x
gem 'sneakers', '>= 2.12.0'
gem 'sqlite3', '>= 1.4.2', platform: :ruby
gem 'stripe'
gem 'jdbc-sqlite3', '>= 3.28', platform: :jruby
gem 'sucker_punch'
gem 'typhoeus'
Expand Down Expand Up @@ -1688,6 +1694,7 @@ elsif ruby_version?('3.2')
gem 'sidekiq'
gem 'sneakers', '>= 2.12.0'
gem 'sqlite3', '>= 1.4.2'
gem 'stripe'
gem 'sucker_punch'
gem 'typhoeus'
gem 'que', '>= 1.0.0'
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ namespace :spec do
:sidekiq,
:sinatra,
:sneakers,
:stripe,
:sucker_punch,
:suite
].each do |contrib|
Expand Down Expand Up @@ -313,6 +314,7 @@ task :ci do
declare '❌ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:shoryuken'
declare '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:sidekiq'
declare '❌ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:sneakers'
declare '❌ 2.1 / ❌ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:stripe'
declare '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:sucker_punch'
declare '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:suite'

Expand Down
22 changes: 22 additions & 0 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ To contribute, check out the [contribution guidelines][contribution docs] and [d
- [Sidekiq](#sidekiq)
- [Sinatra](#sinatra)
- [Sneakers](#sneakers)
- [Stripe](#stripe)
- [Sucker Punch](#sucker-punch)
- [Additional configuration](#additional-configuration)
- [Custom logging](#custom-logging)
Expand Down Expand Up @@ -515,6 +516,7 @@ For a list of available integrations, and their configuration options, please re
| Sidekiq | `sidekiq` | `>= 3.5.4` | `>= 3.5.4` | *[Link](#sidekiq)* | *[Link](https://github.com/mperham/sidekiq)* |
| Sinatra | `sinatra` | `>= 1.4` | `>= 1.4` | *[Link](#sinatra)* | *[Link](https://github.com/sinatra/sinatra)* |
| Sneakers | `sneakers` | `>= 2.12.0` | `>= 2.12.0` | *[Link](#sneakers)* | *[Link](https://github.com/jondot/sneakers)* |
| Stripe | `stripe` | `>= 5.15.0` | `>= 5.15.0` | *[Link](#stripe)* | *[Link](https://github.com/stripe/stripe-ruby)* |
| Sucker Punch | `sucker_punch` | `>= 2.0` | `>= 2.0` | *[Link](#sucker-punch)* | *[Link](https://github.com/brandonhilkert/sucker_punch)* |
#### CI Visibility
Expand Down Expand Up @@ -2032,6 +2034,26 @@ end
| `tag_body` | Enable tagging of job message. `true` for on, `false` for off. | `false` |
| `error_handler` | Custom error handler invoked when a job raises an error. Provided `span` and `error` as arguments. Sets error on the span by default. Useful for ignoring transient errors. | `proc { |span, error| span.set_error(error) unless span.nil? }` |

### Stripe

The Stripe integration traces Stripe API requests.

You can enable it through `Datadog.configure`:

```ruby
require 'ddtrace'
Datadog.configure do |c|
c.tracing.instrument :stripe, **options
end
```

`options` are the following keyword arguments:

| Key | Description | Default |
| --- | ----------- | ------- |
| `enabled` | Defines whether Stripe should be traced. Useful for temporarily disabling tracing. `true` or `false` | `true` |

### Sucker Punch

The `sucker_punch` integration traces all scheduled jobs:
Expand Down
1 change: 1 addition & 0 deletions gemfiles/jruby_9.2.21.0_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/jruby_9.2.21.0_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/jruby_9.3.9.0_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/jruby_9.3.9.0_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/jruby_9.4.0.0_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/jruby_9.4.0.0_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/ruby_2.3.8_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/ruby_2.3.8_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/ruby_2.4.10_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/ruby_2.4.10_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/ruby_2.5.9_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/ruby_2.5.9_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/ruby_2.6.10_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/ruby_2.6.10_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/ruby_2.7.6_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/ruby_2.7.6_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/ruby_3.0.4_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/ruby_3.0.4_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/ruby_3.1.2_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/ruby_3.1.2_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions gemfiles/ruby_3.2.0_contrib.gemfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions gemfiles/ruby_3.2.0_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/datadog/tracing/contrib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,5 @@ module Contrib
require_relative 'contrib/sidekiq/integration'
require_relative 'contrib/sinatra/integration'
require_relative 'contrib/sneakers/integration'
require_relative 'contrib/stripe/integration'
require_relative 'contrib/sucker_punch/integration'
Loading

0 comments on commit 5be411f

Please sign in to comment.