soto-core icon indicating copy to clipboard operation
soto-core copied to clipboard

Add support for tracing

Open 0xTim opened this issue 3 years ago • 3 comments

Draft PR to see what things have been added that allowed us to support tracing with Soto.

This will be ongoing as we add more service support and missing pieces

0xTim avatar May 27 '21 11:05 0xTim

@adam-fowler Setting span attributes is going to be tricky in Soto.

As you can see in the OpenTelemetry spec there are tons of attributes that are recommended for an AWS SDK not only dependent on the service but also on the exact operation: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/instrumentation/aws-sdk.md. DynamoDB.BatchGetItem e.g. are expected to add an attribute defining all table names (aws.dynamodb.table_names). Granted, these highly specific attributes are not required, though might provide useful insights.

Passing the attributes through Baggage was definitely a last-minute hack and in my opinion, not an ideal solution, as it required us to still make changes to the generated code in the Soto fork: https://github.com/brokenhandsio/soto/commit/6ce0b658944785649c5cced805cab7f0c3bc5c7e

Do you have an idea on how to make this happen while still auto-generating the services? What I thought about roughly would be to have the generated code delegate retrieving span attributes to some object that could be extended for specific use-cases, like DynamoDB batch requests. These extensions would then live alongside the generated code much like the Codable extensions for DynamoDB.

slashmo avatar May 28 '21 17:05 slashmo

@adam-fowler Setting span attributes is going to be tricky in Soto.

I had a look through the other SDKs to see what they were doing and basically none of the SDKs seem to be have any support for tracing. What they have instead is a separate module that wraps the SDKs and is used to setup spans etc . I'm not sure exactly how it works. I'm going to investigate a little further.

adam-fowler avatar Jun 01 '21 16:06 adam-fowler

Codecov Report

Merging #443 (af1dbd3) into main (56f009d) will decrease coverage by 0.10%. The diff coverage is 85.71%.

:exclamation: Current head af1dbd3 differs from pull request most recent head 2d4afc0. Consider uploading reports for the commit 2d4afc0 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##             main     #443      +/-   ##
==========================================
- Coverage   76.41%   76.30%   -0.11%     
==========================================
  Files          65       66       +1     
  Lines        5241     5272      +31     
==========================================
+ Hits         4005     4023      +18     
- Misses       1236     1249      +13     
Impacted Files Coverage Δ
...urces/SotoCore/Credential/CredentialProvider.swift 97.91% <ø> (ø)
Sources/SotoCore/HTTP/AWSHTTPClient.swift 71.42% <0.00%> (ø)
Sources/SotoCore/Tracing/Baggage+ServiceName.swift 0.00% <0.00%> (ø)
Sources/SotoCore/AWSClient+Paginate.swift 48.80% <50.00%> (ø)
Sources/SotoCore/AWSClient.swift 91.21% <83.60%> (-2.40%) :arrow_down:
Sources/SotoCore/AWSService.swift 95.65% <100.00%> (ø)
Sources/SotoCore/Credential/ConfigFileLoader.swift 99.28% <100.00%> (ø)
...toCore/Credential/CredentialProviderSelector.swift 100.00% <100.00%> (+6.66%) :arrow_up:
...toCore/Credential/DeferredCredentialProvider.swift 81.48% <100.00%> (ø)
...toCore/Credential/MetaDataCredentialProvider.swift 95.78% <100.00%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 56f009d...2d4afc0. Read the comment docs.

codecov[bot] avatar Aug 04 '21 10:08 codecov[bot]

closing. Solution is available on 7.x.x branch

adam-fowler avatar Aug 02 '23 22:08 adam-fowler