File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -81,3 +81,4 @@ gem "standard", ">= 1.35.1"
8181gem "opentelemetry-sdk" , "~> 1.8"
8282gem "opentelemetry-exporter-otlp" , "~> 0.30.0"
8383gem "opentelemetry-instrumentation-all" , "~> 0.80.0"
84+ gem "opentelemetry-propagator-xray"
Original file line number Diff line number Diff line change 505505 opentelemetry-helpers-sql-obfuscation
506506 opentelemetry-instrumentation-base (~> 0.23.0 )
507507 opentelemetry-semantic_conventions (>= 1.8.0 )
508+ opentelemetry-propagator-xray (0.24.0 )
509+ opentelemetry-api (~> 1.0 )
508510 opentelemetry-registry (0.4.0 )
509511 opentelemetry-api (~> 1.1 )
510512 opentelemetry-sdk (1.8.1 )
@@ -795,6 +797,7 @@ DEPENDENCIES
795797 mailgun-ruby
796798 opentelemetry-exporter-otlp (~> 0.30.0 )
797799 opentelemetry-instrumentation-all (~> 0.80.0 )
800+ opentelemetry-propagator-xray
798801 opentelemetry-sdk (~> 1.8 )
799802 pg
800803 phony
Original file line number Diff line number Diff line change 1+ # Basic packages for your application
12require "opentelemetry/sdk"
23require "opentelemetry/instrumentation/all"
4+
5+ # Add imports for OTel components into the application
6+ require "opentelemetry-api"
7+ require "opentelemetry-exporter-otlp"
8+ require "opentelemetry-sdk"
9+
10+ # Import the gem containing the AWS X-Ray for OTel Ruby ID Generator and propagator
11+ require "opentelemetry-propagator-xray"
12+
13+ # Configure OpenTelmetry Ruby SDK
314OpenTelemetry ::SDK . configure do |c |
15+ # Set the service name to identify your application in the X-Ray backend service map
416 c . service_name = "pya"
5- c . use_all
17+
18+ c . span_processors = [
19+ # Use the BatchSpanProcessor to send traces in groups instead of one at a time
20+ Trace ::Export ::BatchSpanProcessor . new (
21+ # Use the default OLTP Exporter to send traces to the ADOT Collector
22+ OpenTelemetry ::Exporter ::OTLP ::Exporter . new (
23+ # The ADOT Collector is running as a sidecar and listening on port 4318
24+ "http://localhost:4318"
25+ )
26+ )
27+ ]
28+
29+ # The X-Ray ID Generator generates spans with X-Ray backend compliant IDs
30+ c . id_generator = OpenTelemetry ::Propagator ::XRay ::IDGenerator
31+
32+ # The X-Ray Propagator injects the X-Ray Tracing Header into downstream calls
33+ c . propagators = [ OpenTelemetry ::Propagator ::XRay ::TextMapPropagator . new ]
634end
You can’t perform that action at this time.
0 commit comments