-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate sinatra
to new configuration API
#226
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good to me! Mostly asking about backward compatibility because it would be a nice to have feature.
@@ -44,7 +44,7 @@ def patch_active_record | |||
def self.datadog_trace | |||
# TODO: Consider using patcher for Rails as well. | |||
# @tracer ||= defined?(::Rails) && ::Rails.configuration.datadog_trace | |||
@datadog_trace ||= defined?(::Sinatra) && ::Sinatra::Application.settings.datadog_tracer.cfg | |||
@datadog_trace ||= defined?(::Sinatra) && Datadog.configuration[:sinatra].to_h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be interesting if we can avoid this breaking change. Maybe we can use the legacy instrumentation with priority if it's available, falling back to the new one. Consider that the real use case is:
- I have the legacy instrumentation
- I replace it with the new one
It's legit to say "having the legacy instrumentation AND the new one doesn't work fine". Do we have other blockers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p-lambert ok we can make this breaking change, but it would be great testing in a real application other than relying on tests. Thanks a lot!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly waiting to use the new API with a real application.
@@ -44,7 +44,7 @@ def patch_active_record | |||
def self.datadog_trace | |||
# TODO: Consider using patcher for Rails as well. | |||
# @tracer ||= defined?(::Rails) && ::Rails.configuration.datadog_trace | |||
@datadog_trace ||= defined?(::Sinatra) && ::Sinatra::Application.settings.datadog_tracer.cfg | |||
@datadog_trace ||= defined?(::Sinatra) && Datadog.configuration[:sinatra].to_h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@p-lambert ok we can make this breaking change, but it would be great testing in a real application other than relying on tests. Thanks a lot!
4ab41d2
to
ea3153e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go!
Overview
This PR migrates the
sinatra
integration to the new configuration API.Usage Example