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

[rails] Rails auto-instrumentation is disabled by default #55

Merged
merged 4 commits into from
Jan 18, 2017

Conversation

palazzem
Copy link
Contributor

What it does

Disables Rails auto-instrumentation by default. This means that adding the gem to the Gemfile is not enough to enable the tracing. Users must add the initializer file so that:

# config/initializers/datadog-tracer.rb

Rails.configuration.datadog_trace = {
  # these two are required now otherwise the
  # instrumentation will not be active
  auto_instrument: true,
  auto_instrument_redis: true,

  default_service: 'my-rails-app'
}

If users want to activate the tracing only for some environments, they may:

# config/initializers/datadog-tracer.rb

# this is an example; users may not have these environments
tracer_status = Rails.env.staging? || Rails.env.production?

Rails.configuration.datadog_trace = {
  auto_instrument: tracer_status,
  auto_instrument_redis: tracer_status,
  default_service: 'my-rails-app'
}

In this way, is up to users in which environment enable the Rails auto-instrumentation, so that installing our gem will not have any kind of side-effect until users enable the gem.
As a side note, the default tracer (Datadog.tracer) will still be activated and the regular tracer can be used.

@palazzem palazzem added the core Involves Datadog core libraries label Jan 12, 2017
@palazzem palazzem force-pushed the palazzem/rails-disabled-default branch from 3e83010 to 780e2dc Compare January 13, 2017 18:27
}

If you're using \Rails 3 or higher, the auto-instrumentation will be automatically activated and no more configuration
is required. Your application will be listed as +my-rails-app+ in your {dashboard}[https://app.datadoghq.com/trace].
If you're using \Rails 3 or higher, your application will be listed as +my-rails-app+ in your {dashboard}[https://app.datadoghq.com/trace].

Choose a reason for hiding this comment

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

This URL is very likely to change, let's avoid linking app-internal URL in the doc. Maybe as my-rails-app or as my-rails-app in your service list could do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@palazzem palazzem force-pushed the palazzem/rails-disabled-default branch from 98f4247 to 34a26df Compare January 18, 2017 13:50
@palazzem palazzem merged commit c30edb8 into master Jan 18, 2017
@palazzem palazzem deleted the palazzem/rails-disabled-default branch January 18, 2017 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants