Skip to content

Commit 14897c3

Browse files
authored
Merge pull request #13 from patterninc/replace_ddtrace_with_datadog_for_new_ruby_version
replace ddtrace with datadog for new ruby version [v1.1.0]
2 parents 37f909a + 759c5b5 commit 14897c3

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Or install it yourself as:
2121

2222
### Dependency
2323
* [Datadog](https://github.com/DataDog/dd-trace-rb) must be integrated in the project before we use this gem
24-
24+
* use version <=1.0.4 for ruby <3.4
2525
# Quick Use
2626
## Send notification to datadog(Traces to add errors in Datadog)
2727
```DatadogNotifier.notify(exception, payload_json)```

datadog_notifier.gemspec

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@
22

33
lib = File.expand_path('lib', __dir__)
44
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5-
require 'datadog_notifier'
5+
# Don't require datadog_notifier here - it has dependencies that aren't installed yet during bundle install
66
require 'datadog_notifier/version'
77

88
Gem::Specification.new do |spec|
99
spec.name = 'datadog_notifier'
1010
spec.version = DatadogNotifier::VERSION
1111
spec.authors = ['Patterninc']
1212
spec.email = ['amol.udage@pattern.com']
13-
spec.summary = 'Datadog notifier to send custom errors with ddtrace'
13+
spec.summary = 'Datadog notifier to send custom errors with datadog'
1414
spec.description = 'Datadog notifier to send custom errors in Datadog error tracking dashboard'
1515
spec.homepage = 'https://github.com/patterninc/datadog_notifier'
1616
spec.license = 'MIT'
1717

18-
spec.add_dependency 'ddtrace', '>= 1.13.0'
18+
ruby_version = Gem::Version.new(RUBY_VERSION)
19+
breaking_version = Gem::Version.new('3.4')
20+
21+
if ruby_version >= breaking_version
22+
spec.add_dependency 'datadog', '>= 2.0.0'
23+
else
24+
spec.add_dependency 'ddtrace', '>= 1.13.0'
25+
end
1926

2027
# Specify which files should be added to the gem when it is released.
2128
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.

lib/datadog_notifier.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# frozen_string_literal: true
22

3-
require 'ddtrace'
3+
if RUBY_VERSION < '3.4'
4+
require 'ddtrace'
5+
else
6+
require 'datadog'
7+
end
48
require 'datadog_notifier_exception'
59
require 'datadog_notifier/version'
610

0 commit comments

Comments
 (0)