tomhughes left a comment (openstreetmap/openstreetmap-website#6405)

So I wanted to add it to the settings but the opentelemetry gems really, really 
don't help with that and want you to use the environment :cry: 

I did eventually manage to make it work after digging through the source to 
find out what the gems did with the environment variables but it wasn't pretty 
- there's no API call that is a direct equivalent so you wind up having to 
create several objects yourself and wire them together.

Much the same goes for the `-all` thing - it is possible, and it's not quite as 
bad and is at least documented but it's quite a bit more verbose.

In particular there's no way to enable `opentelemetry-instrumentation-rails` 
and have it do everything so you have to do all the subcomponents of that 
separately and I wound up with something like this:

```ruby
require "opentelemetry/sdk"
require "opentelemetry/instrumentation/action_mailer"
require "opentelemetry/instrumentation/action_pack"
require "opentelemetry/instrumentation/action_view"
require "opentelemetry/instrumentation/active_job"
require "opentelemetry/instrumentation/active_record"
require "opentelemetry/instrumentation/active_storage"
require "opentelemetry/instrumentation/active_support"
require "opentelemetry/instrumentation/dalli"
require "opentelemetry/instrumentation/delayed_job"
require "opentelemetry/instrumentation/faraday"
require "opentelemetry/instrumentation/pg"
require "opentelemetry/instrumentation/rack"
require "opentelemetry/instrumentation/rails"

OpenTelemetry::SDK.configure do |c|
  c.use "OpenTelemetry::Instrumentation::ActionMailer"
  c.use "OpenTelemetry::Instrumentation::ActionPack"
  c.use "OpenTelemetry::Instrumentation::ActionView"
  c.use "OpenTelemetry::Instrumentation::ActiveJob"
  c.use "OpenTelemetry::Instrumentation::ActiveRecord"
  c.use "OpenTelemetry::Instrumentation::ActiveStorage"
  c.use "OpenTelemetry::Instrumentation::ActiveSupport"
  c.use "OpenTelemetry::Instrumentation::Dalli"
  c.use "OpenTelemetry::Instrumentation::DelayedJob"
  c.use "OpenTelemetry::Instrumentation::Faraday"
  c.use "OpenTelemetry::Instrumentation::PG"
  c.use "OpenTelemetry::Instrumentation::Rack"
  c.use "OpenTelemetry::Instrumentation::Rails"
end
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6405#issuecomment-3328687344
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/6405/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to