Skip to content

Add aws-smithy-observability and aws-smithy-observability-otel crates #4003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Feb 14, 2025

Conversation

landonxjames
Copy link
Contributor

Motivation and Context

This PR is an updated version of #3912 and #3986 moving back to the dyn Trait based implementation since some issues came up in the review of the Associated Types based implementation

Description

Add two new crates

  • aws-smithy-observability - contains traits for our observability solution and a global module for managing the global telemetry provider
  • aws-smithy-observability-otel - contains an OpenTelemetry based implementation of the traits

Testing

Various unit tests in both new crates.

Checklist

Note: leaving out a changelog entry for now since these crates won't offer much value until we instrument our runtime crates in some subsequent PRs


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

landonxjames and others added 30 commits December 3, 2024 12:07
Also fix all warnings in both observability crates
The updates caused CI to fail since it depended on the newly added
crates, but those were not yet present in the main lockfile that is
copied around for tests
* Update some clippy style issues
* Config the aws-smithy-observability-otel crate to not compile on powerpc
* Run tests for global module serially so they don't poison the RwLock
Pin version of value-bag in otel crate

Powerpc dep updates

Pin more transitive deps
Aligns with standard introduced in #3065

Update doc comments

External types updates
Remove non-public type from docs
@landonxjames landonxjames changed the title Landonxjames/obs Add aws-smithy-observability and aws-smithy-observability-otel crates Feb 10, 2025
@landonxjames landonxjames marked this pull request as ready for review February 10, 2025 02:18
@landonxjames landonxjames requested review from a team as code owners February 10, 2025 02:18
Copy link
Contributor

@aajtodd aajtodd left a comment

Choose a reason for hiding this comment

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

First pass, couple questions, comments, and suggestions.

/// The entry point to creating instruments. A grouping of related metrics.
pub trait Meter: Send + Sync + Debug {
/// Create a new Gauge.
#[allow(clippy::type_complexity)]
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't care about the type complexity here but I do wonder if we shouldn't try to turn this into a builder as the return type such that we can evolve and expand the options you can set over time if needed.

This appears to be what otel is doing as well.

Copy link
Contributor Author

@landonxjames landonxjames Feb 14, 2025

Choose a reason for hiding this comment

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

Moved to builder pattern in f52f43c. This did introduce one rough edge in that I was unable to make the lifetimes of the callback function workout without making that field pub on the builder:

// Implementation note: I could not make the lifetimes work out in the impl ProvideInstrument
// in aws-smithy-observability-otel without making this field pub
/// The callback function for this AsyncInstrumentBuilder.
#[allow(clippy::type_complexity)]
pub callback: Arc<dyn Fn(&dyn AsyncMeasure<Value = M>) + Send + Sync>,
Otel gets around this by having all of the fields on the builder be pub. If we have one field pub we might as well have the rest be, but that doesn't seem to be a pattern we really do in our codebase, so wanted to bring it up for discussion.

Make Meter a concrete type wrapping a ProvideInstrument trait objecct

Accept Into<Cow<&str>> as input types

Remove AwsSdk from AwsSdkOtelMeterProvider type name

Re-expose the global:: namespace instead of re-exporting the functions
And some small changes to support that. Mostly moving the Arc wrapping
of the ProvideMeter object outside of the constructor so the user can
clone the Arc before the TelemetryProvider takes ownership of it
@smithy-lang smithy-lang deleted a comment from github-actions bot Feb 14, 2025
@smithy-lang smithy-lang deleted a comment from github-actions bot Feb 14, 2025
@smithy-lang smithy-lang deleted a comment from github-actions bot Feb 14, 2025
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@smithy-lang smithy-lang deleted a comment from github-actions bot Feb 14, 2025
Remove some no-longer-useful ErrorKinds

Accept a non-Arced callback and do the wrapping ourselves
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

@landonxjames landonxjames added this pull request to the merge queue Feb 14, 2025
Merged via the queue into main with commit 61f4ed0 Feb 14, 2025
44 of 45 checks passed
@landonxjames landonxjames deleted the landonxjames/obs branch February 14, 2025 21:21
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.

2 participants