open-telemetry/opentelemetry-ruby

ActionController::RoutingError - how to customize these requests?

gabricc opened this issue · 2 comments

Description of the bug
Hi everyone! I'm experimenting OpenTelemetry for our api. Everything seems to work fine, but apparently by default OpenTelemetry makes GET requests to specific routes!?
It was first doing for the root "/":
[37ed8e42-5a0c-453b-adb3-50140a22df00] ActionController::RoutingError (No route matches [GET] "/")
Then I created a health_check in the "/" and it worked!
But now it is complaining about the favicon.ico:
[83f22fa2-32c0-4834-9b95-aa16b86751f0] ActionController::RoutingError (No route matches [GET] "/favicon.ico")

is this something I can customize? Because we already have a favicon, but it is favicon.png.

Share details about your runtime

Operating system details: Alpine
RUBY_ENGINE: "ruby"
RUBY_VERSION: "2.7.5"

Share a simplified reproduction if possible

require "opentelemetry/sdk"
require "opentelemetry/instrumentation/all"
require "opentelemetry-exporter-otlp"

OpenTelemetry::SDK.configure do |c|
  if Rails.env.production? || Rails.env.staging?
    c.service_name = "slang-"+ENV["SENTRY_ENVIRONMENT"]+"-api"
    c.use 'OpenTelemetry::Instrumentation::ActiveSupport'
    c.use 'OpenTelemetry::Instrumentation::Rack'
    c.use 'OpenTelemetry::Instrumentation::ActionPack'
    c.use 'OpenTelemetry::Instrumentation::ActiveJob'
    c.use 'OpenTelemetry::Instrumentation::ActiveRecord'
    c.use 'OpenTelemetry::Instrumentation::ActionView'
    c.use 'OpenTelemetry::Instrumentation::AwsSdk'
    c.use 'OpenTelemetry::Instrumentation::Bunny'
    c.use 'OpenTelemetry::Instrumentation::ActiveModelSerializers'
    c.use 'OpenTelemetry::Instrumentation::ConcurrentRuby'
    c.use 'OpenTelemetry::Instrumentation::Ethon'
    c.use 'OpenTelemetry::Instrumentation::Faraday'
    c.use 'OpenTelemetry::Instrumentation::Net::HTTP'
    c.use 'OpenTelemetry::Instrumentation::PG'
    c.use 'OpenTelemetry::Instrumentation::Rails'
    c.use 'OpenTelemetry::Instrumentation::Rake'
    c.use 'OpenTelemetry::Instrumentation::Redis'
    c.use 'OpenTelemetry::Instrumentation::Sidekiq'
  end
end

Thanks in advance!

You can ignore it if you don't want to trace this endpoint

OpenTelemetry::SDK.configure do |c|
    config = {
      'OpenTelemetry::Instrumentation::Rack' => { untraced_endpoints: ['/favicon.ico'] }
    }
end

that solves my problem, thanks @johnjunjiezhao !