github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/examples/tracing/jaeger/ruby/rideshare/config/initializers/pyroscope.rb (about) 1 require "pyroscope" 2 require "pyroscope/otel" 3 4 require "opentelemetry/sdk" 5 require "opentelemetry/exporter/otlp" 6 require 'opentelemetry/exporter/jaeger' 7 8 app_name = "ride-sharing-app-ruby" 9 pyroscope_server_address = ENV["PYROSCOPE_SERVER_ADDRESS"] || "http://localhost:4040" 10 pyroscope_endpoint = ENV["OTEL_PYROSCOPE_ENDPOINT"] || "http://localhost:4040" 11 jaeger_endpoint = ENV["JAEGER_ENDPOINT"] || "http://localhost:14268/api/traces" 12 13 puts("jaeger endpoint #{jaeger_endpoint}") 14 15 Pyroscope.configure do |config| 16 config.application_name = app_name 17 config.log_level = "debug" 18 config.server_address = pyroscope_server_address 19 end 20 21 OpenTelemetry::SDK.configure do |c| 22 c.service_name = app_name 23 c.add_span_processor Pyroscope::Otel::SpanProcessor.new("#{app_name}.cpu", pyroscope_endpoint) 24 c.add_span_processor OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new( 25 OpenTelemetry::Exporter::Jaeger::CollectorExporter.new(endpoint: jaeger_endpoint)) 26 c.use_all() 27 end