diff --git a/instrumentation/aws_sdk/Appraisals b/instrumentation/aws_sdk/Appraisals index 41ffa67ca..c9c9b908b 100644 --- a/instrumentation/aws_sdk/Appraisals +++ b/instrumentation/aws_sdk/Appraisals @@ -13,7 +13,7 @@ appraise 'aws-sdk-3' do end # pre-Observability support in V3 SDK -appraise 'aws-sdk-3.2' do +appraise 'aws-sdk-3.202' do gem 'aws-sdk-core', '~> 3.202' gem 'aws-sdk-lambda', '~> 1.127' gem 'aws-sdk-dynamodb', '~> 1.118' diff --git a/instrumentation/aws_sdk/README.md b/instrumentation/aws_sdk/README.md index 7ddb0de05..fcf4de368 100644 --- a/instrumentation/aws_sdk/README.md +++ b/instrumentation/aws_sdk/README.md @@ -40,20 +40,19 @@ This instrumentation offers the following configuration options: span kind of `internal` are suppressed from traces. ## Integration with SDK V3's Telemetry support -AWS SDK for Ruby V3 added support for Observability which includes a configuration, +AWS SDK for Ruby V3 added support for Observability which includes a new configuration, `telemetry_provider` and an OpenTelemetry-based telemetry provider. Only applies to AWS service gems released after 2024-09-03. -Using the OTel telemetry provider will give you insights about specific handlers -during the SDK request/response lifecycle. - +Using later versions of these gems will give more details on the internal spans. +See below for example usage: ```ruby # configures the OpenTelemetry SDK with instrumentation defaults OpenTelemetry::SDK.configure do |c| c.use 'OpenTelemetry::Instrumentation::AwsSdk' end -# create otel provider and pass to client config +# create open-telemetry provider and pass to client config otel_provider = Aws::Telemetry::OTelProvider.new client = Aws::S3::Client.new(telemetry_provider: otel_provider) ``` diff --git a/instrumentation/aws_sdk/lib/opentelemetry/instrumentation/aws_sdk/instrumentation.rb b/instrumentation/aws_sdk/lib/opentelemetry/instrumentation/aws_sdk/instrumentation.rb index 55eee315c..3dd310206 100644 --- a/instrumentation/aws_sdk/lib/opentelemetry/instrumentation/aws_sdk/instrumentation.rb +++ b/instrumentation/aws_sdk/lib/opentelemetry/instrumentation/aws_sdk/instrumentation.rb @@ -13,7 +13,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base install do |_config| require_dependencies - patch if telemetry_plugin? + patch_telemetry_plugin if telemetry_plugin? add_plugins(Seahorse::Client::Base, *loaded_service_clients) end @@ -61,10 +61,13 @@ def supports_telemetry_plugin?(klass) end def telemetry_plugin? - ::Aws.const_defined?('Plugins::Telemetry') + ::Aws::Plugins.const_defined?(:Telemetry) end - def patch + # Patches AWS SDK V3's telemetry plugin for integration + # This patch supports configuration set by this gem and + # additional span attributes that was not provided by the plugin + def patch_telemetry_plugin ::Aws::Plugins::Telemetry::Handler.prepend(Patches::Handler) end