Skip to content
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

Merged
merged 1 commit into from
Nov 21, 2017

Conversation

p-lambert
Copy link
Member

@p-lambert p-lambert commented Oct 17, 2017

Overview

This PR migrates the sinatra integration to the new configuration API.

Usage Example

require 'sinatra'
require 'ddtrace'
require 'ddtrace/contrib/sinatra/tracer'

Datadog.configure do |c|
  c.use :sinatra, default_service: 'my-sinatra-app'
end

get '/' do
  'Hello, World!'
end

@palazzem palazzem added this to the 0.10.0 milestone Oct 19, 2017
@palazzem palazzem self-requested a review October 19, 2017 16:22
@palazzem palazzem added core Involves Datadog core libraries integrations Involves tracing integrations labels Oct 19, 2017
@palazzem palazzem changed the base branch from pedro/create-configurable-module to master October 19, 2017 16:22
Copy link
Contributor

@palazzem palazzem left a 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
Copy link
Contributor

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?

Copy link
Contributor

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!

Copy link
Contributor

@palazzem palazzem left a 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
Copy link
Contributor

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!

@p-lambert p-lambert force-pushed the pedro/migrate-sinatra-configuration branch from 4ab41d2 to ea3153e Compare November 16, 2017 16:03
Copy link
Contributor

@palazzem palazzem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go!

@palazzem palazzem merged commit 50adcb8 into master Nov 21, 2017
@palazzem palazzem deleted the pedro/migrate-sinatra-configuration branch November 21, 2017 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries integrations Involves tracing integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants