Skip to content

feat(ruby/rails-api): add OtelFilterSpanProcessor, Sidekiq OTel fixes, and OTel Collector config#130

Open
prathamesh-sonpatki wants to merge 1 commit into
mainfrom
prathamesh/fde-62-ruby-rails-api-otel-noise-reduction
Open

feat(ruby/rails-api): add OtelFilterSpanProcessor, Sidekiq OTel fixes, and OTel Collector config#130
prathamesh-sonpatki wants to merge 1 commit into
mainfrom
prathamesh/fde-62-ruby-rails-api-otel-noise-reduction

Conversation

@prathamesh-sonpatki
Copy link
Copy Markdown
Member

Summary

  • Add OtelFilterSpanProcessor to opentelemetry.rb — drops BEGIN/COMMIT/ROLLBACK spans, health check paths, OTLP exporter Net::HTTP calls (meta-tracing loop fix), noisy Redis commands, and configurable Sidekiq queue/job spans
  • Add probabilistic sampling via OTEL_SAMPLE_RATE env var (parentbased_traceidratio)
  • Disable ActionView instrumentation (high volume, irrelevant for JSON APIs)
  • Add config/initializers/sidekiq.rb with OTel shutdown hook to flush spans on Sidekiq stop
  • Add otel-collector/config.yaml with filter/drop_noise processor (OTTL-based) mirroring the in-app filter, plus optional probabilistic_sampler — enables app → collector → Last9 architecture
  • Add docker-compose.yaml wiring Rails app to OTel Collector (LAST9_* env vars on collector)
  • Update .env.example with all new OTEL_FILTER_* and collector env vars
  • Update README with noise reduction guide, OTel Collector mode docs, and quick start

Closes FDE-62

Test plan

  • bundle install && bin/rails server starts without errors
  • Spans appear in Last9 APM dashboard
  • BEGIN/COMMIT/ROLLBACK spans absent from traces
  • /health requests produce no spans
  • docker compose up starts both app and collector; traces flow through collector to Last9
  • OTEL_SAMPLE_RATE=0.1 reduces trace volume to ~10%
  • OTEL_FILTER_SIDEKIQ_QUEUES=mailers drops spans from that queue

🤖 Generated with Claude Code

…, and OTel Collector config

- Add OtelFilterSpanProcessor inline in opentelemetry.rb — drops BEGIN/COMMIT/ROLLBACK
  spans, health check paths, OTLP exporter Net::HTTP calls (meta-tracing loop fix),
  noisy Redis commands, and configurable Sidekiq queue/job spans
- Add probabilistic sampling via OTEL_SAMPLE_RATE (parentbased_traceidratio)
- Disable ActionView instrumentation (high volume, irrelevant for JSON APIs)
- Add config/initializers/sidekiq.rb with OTel shutdown hook to flush spans on stop
- Add otel-collector/config.yaml with filter/drop_noise processor (OTTL-based) that
  mirrors the in-app filter — app → collector → Last9 architecture
- Add docker-compose.yaml wiring Rails app to collector (LAST9_* env vars on collector)
- Update .env.example with all new OTEL_FILTER_* and collector env vars
- Update README with noise reduction guide, OTel Collector mode, and quick start
- Fix .gitignore to allow .env.example to be committed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant