Skip to content

Commit 1fcff09

Browse files
committed
Apply rustfmt and bump aws-smithy-observability to 0.1.6
1 parent e7f0f5c commit 1fcff09

File tree

6 files changed

+30
-14
lines changed

6 files changed

+30
-14
lines changed

aws/sdk/integration-tests/dynamodb/tests/observability-metrics.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ mod mock_otel {
7575
&self,
7676
_builder: aws_smithy_observability::instruments::AsyncInstrumentBuilder<
7777
'_,
78-
std::sync::Arc<dyn aws_smithy_observability::instruments::AsyncMeasure<Value = f64>>,
78+
std::sync::Arc<
79+
dyn aws_smithy_observability::instruments::AsyncMeasure<Value = f64>,
80+
>,
7981
f64,
8082
>,
8183
) -> std::sync::Arc<dyn aws_smithy_observability::instruments::AsyncMeasure<Value = f64>>
@@ -97,7 +99,9 @@ mod mock_otel {
9799
&self,
98100
_builder: aws_smithy_observability::instruments::AsyncInstrumentBuilder<
99101
'_,
100-
std::sync::Arc<dyn aws_smithy_observability::instruments::AsyncMeasure<Value = i64>>,
102+
std::sync::Arc<
103+
dyn aws_smithy_observability::instruments::AsyncMeasure<Value = i64>,
104+
>,
101105
i64,
102106
>,
103107
) -> std::sync::Arc<dyn aws_smithy_observability::instruments::AsyncMeasure<Value = i64>>
@@ -119,7 +123,9 @@ mod mock_otel {
119123
&self,
120124
_builder: aws_smithy_observability::instruments::AsyncInstrumentBuilder<
121125
'_,
122-
std::sync::Arc<dyn aws_smithy_observability::instruments::AsyncMeasure<Value = u64>>,
126+
std::sync::Arc<
127+
dyn aws_smithy_observability::instruments::AsyncMeasure<Value = u64>,
128+
>,
123129
u64,
124130
>,
125131
) -> std::sync::Arc<dyn aws_smithy_observability::instruments::AsyncMeasure<Value = u64>>
@@ -198,7 +204,10 @@ async fn observability_metrics_in_user_agent() {
198204
let (client, http_client) = test_client(std::convert::identity);
199205
call_operation(client).await;
200206
let req = http_client.actual_requests().last().expect("request");
201-
let user_agent = req.headers().get("x-amz-user-agent").expect("user-agent header");
207+
let user_agent = req
208+
.headers()
209+
.get("x-amz-user-agent")
210+
.expect("user-agent header");
202211

203212
// Should NOT contain observability metrics when using noop provider
204213
assert!(!user_agent.contains("m/7")); // OBSERVABILITY_OTEL_METRICS = "7"
@@ -210,13 +219,13 @@ async fn observability_metrics_in_user_agent() {
210219

211220
// Create mock OTel meter provider
212221
let sdk_mp = Arc::new(OtelMeterProvider);
213-
222+
214223
// Debug: Check what the type name actually is
215224
let type_name = std::any::type_name_of_val(&sdk_mp);
216225
eprintln!("Mock OTel provider Arc type name: {}", type_name);
217226
let type_name2 = std::any::type_name_of_val(sdk_mp.as_ref());
218227
eprintln!("Mock OTel provider as_ref type name: {}", type_name2);
219-
228+
220229
let sdk_tp = TelemetryProvider::builder().meter_provider(sdk_mp).build();
221230

222231
// Set global telemetry provider
@@ -225,7 +234,10 @@ async fn observability_metrics_in_user_agent() {
225234
let (client, http_client) = test_client(std::convert::identity);
226235
call_operation(client).await;
227236
let req = http_client.actual_requests().last().expect("request");
228-
let user_agent = req.headers().get("x-amz-user-agent").expect("user-agent header");
237+
let user_agent = req
238+
.headers()
239+
.get("x-amz-user-agent")
240+
.expect("user-agent header");
229241

230242
eprintln!("User-Agent: {}", user_agent);
231243

codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/CargoDependency.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ data class CargoDependency(
413413
fun smithyMocks(runtimeConfig: RuntimeConfig) =
414414
runtimeConfig.smithyRuntimeCrate("smithy-mocks", scope = DependencyScope.Dev)
415415

416-
fun smithyObservability(runtimeConfig: RuntimeConfig) =
417-
runtimeConfig.smithyRuntimeCrate("smithy-observability")
416+
fun smithyObservability(runtimeConfig: RuntimeConfig) = runtimeConfig.smithyRuntimeCrate("smithy-observability")
418417

419418
fun smithyObservabilityOtel(runtimeConfig: RuntimeConfig) =
420419
runtimeConfig.smithyRuntimeCrate("smithy-observability-otel")

rust-runtime/Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust-runtime/aws-smithy-observability-otel/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ rust-version = "1.88"
1313
[dependencies]
1414
aws-smithy-observability = { path = "../aws-smithy-observability" }
1515
opentelemetry = {version = "0.26.0", features = ["metrics"]}
16-
thiserror = "2.0" # Required by opentelemetry 0.26.0 but not declared
1716
# The following dependencies are transitive and pinned for build
1817
# compatability purposes
1918
value-bag = "1.10.0"

rust-runtime/aws-smithy-observability/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "aws-smithy-observability"
3-
version = "0.1.5"
3+
version = "0.1.6"
44
authors = [
55
"AWS Rust SDK Team <[email protected]>",
66
]
@@ -23,3 +23,4 @@ targets = ["x86_64-unknown-linux-gnu"]
2323
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]
2424
rustdoc-args = ["--cfg", "docsrs"]
2525
# End of docs.rs metadata
26+

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ 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+
///
23+
/// The default implementation returns a reference to the unit type,
24+
/// which will fail any downcast attempts. Implementations should override
25+
/// this to return `self` for proper type inspection.
26+
fn as_any(&self) -> &dyn std::any::Any {
27+
&()
28+
}
2329

2430
/// Returns the name of this provider implementation.
2531
/// This is used for feature tracking without requiring type imports.

0 commit comments

Comments
 (0)