Skip to content

Commit 3e09af7

Browse files
committed
Move ObservabilityOtelMetrics to SmithySdkFeature and add default as_any() implementation
1 parent 30648d2 commit 3e09af7

File tree

7 files changed

+9
-15
lines changed

7 files changed

+9
-15
lines changed

aws/rust-runtime/aws-inlineable/src/observability_feature.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
use aws_runtime::sdk_feature::AwsSdkFeature;
6+
use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature;
77
use aws_smithy_runtime_api::{
88
box_error::BoxError,
99
client::interceptors::{context::BeforeSerializationInterceptorContextRef, Intercept},
1010
};
1111
use aws_smithy_types::config_bag::ConfigBag;
1212

13-
// Interceptor that tracks AWS SDK features for observability (tracing/metrics).
13+
// Interceptor that tracks Smithy SDK features for observability (tracing/metrics).
1414
#[derive(Debug, Default)]
1515
pub(crate) struct ObservabilityFeatureTrackerInterceptor;
1616

@@ -35,7 +35,7 @@ impl Intercept for ObservabilityFeatureTrackerInterceptor {
3535
.downcast_ref::<aws_smithy_observability_otel::meter::OtelMeterProvider>(
3636
) {
3737
cfg.interceptor_state()
38-
.store_append(AwsSdkFeature::ObservabilityOtelMetrics);
38+
.store_append(SmithySdkFeature::ObservabilityOtelMetrics);
3939
}
4040
}
4141

aws/rust-runtime/aws-runtime/src/sdk_feature.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ pub enum AwsSdkFeature {
2424
SsoLoginDevice,
2525
/// Calling an SSO-OIDC operation as part of the SSO login flow, when using the OAuth2.0 authorization code grant
2626
SsoLoginAuth,
27-
/// Indicates that an AWS SDK client has been configured with an OpenTelemetry metrics provider
28-
ObservabilityOtelMetrics,
2927
}
3028

3129
impl Storable for AwsSdkFeature {

aws/rust-runtime/aws-runtime/src/user_agent/metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ impl ProvideBusinessMetric for SmithySdkFeature {
210210
FlexibleChecksumsResWhenRequired => {
211211
Some(BusinessMetric::FlexibleChecksumsResWhenRequired)
212212
}
213+
ObservabilityOtelMetrics => Some(BusinessMetric::ObservabilityOtelMetrics),
213214
otherwise => {
214215
// This may occur if a customer upgrades only the `aws-smithy-runtime-api` crate
215216
// while continuing to use an outdated version of an SDK crate or the `aws-runtime`
@@ -234,7 +235,6 @@ impl ProvideBusinessMetric for AwsSdkFeature {
234235
S3Transfer => Some(BusinessMetric::S3Transfer),
235236
SsoLoginDevice => Some(BusinessMetric::SsoLoginDevice),
236237
SsoLoginAuth => Some(BusinessMetric::SsoLoginAuth),
237-
ObservabilityOtelMetrics => Some(BusinessMetric::ObservabilityOtelMetrics),
238238
}
239239
}
240240
}

rust-runtime/aws-smithy-observability-otel/src/meter.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,6 @@ impl ProvideMeter for OtelMeterProvider {
286286
fn get_meter(&self, scope: &'static str, _attributes: Option<&Attributes>) -> Meter {
287287
Meter::new(Arc::new(MeterWrap(self.meter_provider.meter(scope))))
288288
}
289-
290-
fn as_any(&self) -> &dyn std::any::Any {
291-
self
292-
}
293289
}
294290

295291
#[cfg(test)]

rust-runtime/aws-smithy-observability/src/meter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ pub trait ProvideMeter: Send + Sync + Debug {
1919
fn get_meter(&self, scope: &'static str, attributes: Option<&Attributes>) -> Meter;
2020

2121
/// Returns a reference to `self` as `&dyn Any` for downcasting.
22-
fn as_any(&self) -> &dyn std::any::Any;
22+
fn as_any(&self) -> &dyn std::any::Any {
23+
self
24+
}
2325
}
2426

2527
/// The entry point to creating instruments. A grouping of related metrics.

rust-runtime/aws-smithy-observability/src/noop.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ impl ProvideMeter for NoopMeterProvider {
2424
fn get_meter(&self, _scope: &'static str, _attributes: Option<&Attributes>) -> Meter {
2525
Meter::new(Arc::new(NoopMeter))
2626
}
27-
28-
fn as_any(&self) -> &dyn std::any::Any {
29-
self
30-
}
3127
}
3228

3329
#[derive(Debug)]

rust-runtime/aws-smithy-runtime/src/client/sdk_feature.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ pub enum SmithySdkFeature {
2323
FlexibleChecksumsReqWhenRequired,
2424
FlexibleChecksumsResWhenSupported,
2525
FlexibleChecksumsResWhenRequired,
26+
/// Indicates that a Smithy SDK client has been configured with an OpenTelemetry metrics provider
27+
ObservabilityOtelMetrics,
2628
}
2729

2830
impl Storable for SmithySdkFeature {

0 commit comments

Comments
 (0)