Skip to content

Conversation

@j15e
Copy link
Contributor

@j15e j15e commented May 4, 2025

This PR updates the AWS SDK documentation example to use the SDK v3 as discussed in #1470

It pretty much now implement the suggested example in the README itself:

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 open-telemetry provider and pass to client config
otel_provider = Aws::Telemetry::OTelProvider.new
client = Aws::S3::Client.new(telemetry_provider: otel_provider)
```

And I added the version restriction in the example Gemfile to avoid any confusion on the SDK version used.

I also added rexml, because starting from Ruby 3.0 it isn't shipped with Ruby core, but aws-sdk-core needs an XML parser. It works on the AWS SDK CI without specifying rexml, because webmock requires rexml, but we don't have this gem in the example.

If you run for example AWS_ACCESS_KEY_ID=123 AWS_SECRET_ACCESS_KEY=qwer AWS_REGION=us-east-1 ruby trace_demonstration.rb you will now get the example trace working :

image

@j15e j15e force-pushed the aws-sdk-v3-example branch from da899ff to e945c2b Compare May 4, 2025 15:50
@kaylareopelle
Copy link
Contributor

cc @jterapin @alextwoods

Copy link
Contributor

@jterapin jterapin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thank you for the contribution! Much appreciated.

@kaylareopelle kaylareopelle merged commit ffa9e49 into open-telemetry:main May 8, 2025
62 checks passed
yiyuan-he pushed a commit to yiyuan-he/opentelemetry-ruby-contrib that referenced this pull request May 14, 2025
* docs: Use AWS SDK v3 in example

* Update instrumentation/aws_sdk/example/Gemfile

Co-authored-by: Juli Tera <[email protected]>

---------

Co-authored-by: Kayla Reopelle <[email protected]>
Co-authored-by: Juli Tera <[email protected]>
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.

3 participants