Skip to content

Configure active_record as part of rails #764

Open

Description

With

Datadog.configure do |c|
  c.tracer env: Rails.env
  c.use :rails, service_name: "myapp-rails"
end

I see the following services instrumented in Datadog:

- active_record
- myapp-rails
- myapp-rails-cache
- myapp-rails-postgres

This is ok for one service, but I have multiple Rails apps (all using ActiveRecord) that I want to instrument, so I need to differentiate active_record from one app from another.

I understand there's c.use :active_record and c.use :rails, but I'm not sure why active_record is configured separately from rails. What I want is to have:

- myapp-active_record
- myapp-rails
- myapp-rails-cache
- myapp-rails-postgres

Is there a way to achieve this? I read this issue #574 and this PR #450, and it seems that the following is exactly what I need:

Datadog.configure do |c|
  c.use :rails do |rails|
    rails.service_name = 'myapp'
    
    rails.active_record do |active_record|
      active_record.orm_service_name = 'myapp-active_record'
    end
  end
end

But when I tried it I got a NoMethodError:

undefined method `active_record' for #<Datadog::Contrib::Rails::Configuration::Settings:0x00007ff12073d9d0> (NoMethodError)

I'm using 0.24.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

integrationsInvolves tracing integrationsquestionGeneral inquiry that may or may not involve changes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions