From 250640736e8a8de97a6204851add6ea2110dfc5b Mon Sep 17 00:00:00 2001 From: Jason Gin Date: Wed, 25 Feb 2026 17:29:26 -0500 Subject: [PATCH 1/6] Add success metric to default metrics --- .../snapshots/metrics_test__metrics_content_via_tcp.snap | 6 +++--- .../aws-smithy-http-server-metrics/src/default.rs | 7 +++++-- rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs | 8 ++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/pokemon-service/tests/snapshots/metrics_test__metrics_content_via_tcp.snap b/examples/pokemon-service/tests/snapshots/metrics_test__metrics_content_via_tcp.snap index 72108aae4e..ca41b0879f 100644 --- a/examples/pokemon-service/tests/snapshots/metrics_test__metrics_content_via_tcp.snap +++ b/examples/pokemon-service/tests/snapshots/metrics_test__metrics_content_via_tcp.snap @@ -2,6 +2,6 @@ source: pokemon-service/tests/metrics_test.rs expression: metrics_output --- -{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"found"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"found":1,"outstanding_requests":1,"http_status_code":200,"error":0,"fault":0,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","requested_pokemon_name":"pikachu","service":"PokemonService","service_version":"2024-03-18","operation":"GetPokemonSpecies","request_id":"[request_id]} -{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"authenticated"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"authenticated":0,"outstanding_requests":1,"http_status_code":401,"error":1,"fault":0,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","user":"ash","service":"PokemonService","service_version":"2024-03-18","operation":"GetStorage","request_id":"[request_id]} -{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"supported_region"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"supported_region":0,"outstanding_requests":1,"http_status_code":500,"error":0,"fault":1,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","requested_region":"trigger500","service":"PokemonService","service_version":"2024-03-18","operation":"CapturePokemon","request_id":"[request_id]} +{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"found"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"success"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"found":1,"outstanding_requests":1,"http_status_code":200,"success":1,"error":0,"fault":0,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","requested_pokemon_name":"pikachu","service":"PokemonService","service_version":"2024-03-18","operation":"GetPokemonSpecies","request_id":"[request_id]} +{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"authenticated"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"success"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"authenticated":0,"outstanding_requests":1,"http_status_code":401,"success":0,"error":1,"fault":0,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","user":"ash","service":"PokemonService","service_version":"2024-03-18","operation":"GetStorage","request_id":"[request_id]} +{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"supported_region"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"success"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"supported_region":0,"outstanding_requests":1,"http_status_code":500,"success":0,"error":0,"fault":1,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","requested_region":"trigger500","service":"PokemonService","service_version":"2024-03-18","operation":"CapturePokemon","request_id":"[request_id]} diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/default.rs b/rust-runtime/aws-smithy-http-server-metrics/src/default.rs index 011e21b18f..5429b03656 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/default.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/default.rs @@ -75,10 +75,12 @@ pub struct DefaultRequestMetrics { #[derive(Default, Debug)] pub struct DefaultResponseMetrics { pub(crate) http_status_code: Option, + /// Success indicator (1 if 2xx status code, 0 otherwise) + pub(crate) success: Option, /// Client error indicator (1 if 4xx status code, 0 otherwise) - pub(crate) error: Option, + pub(crate) error: Option, /// Server fault indicator (1 if 5xx status code, 0 otherwise) - pub(crate) fault: Option, + pub(crate) fault: Option, /// Wallclock time from pre-deserialization of the model input to post-serialization of the model output pub(crate) operation_time: Option, } @@ -103,6 +105,7 @@ pub struct DefaultRequestMetricsConfig { pub struct DefaultResponseMetricsConfig { pub(crate) disable_all: bool, pub(crate) disable_http_status_code: bool, + pub(crate) disable_success: bool, pub(crate) disable_error: bool, pub(crate) disable_fault: bool, pub(crate) disable_operation_time: bool, diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs b/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs index ac4d1ab334..d5abd83308 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs @@ -309,6 +309,12 @@ fn get_default_response_metrics( let status = res.status(); let status_code = status.as_u16(); + let success = if (200..300).contains(&status_code) { + Some(1) + } else { + Some(0) + }; + let error = if (400..500).contains(&status_code) { Some(1) } else { @@ -319,6 +325,7 @@ fn get_default_response_metrics( DefaultResponseMetrics { http_status_code: Some(status_code), + success, error, fault, operation_time, @@ -361,6 +368,7 @@ fn configure_default_response_metrics( http_status_code: metrics .http_status_code .filter(|_| !config.disable_http_status_code), + success: metrics.success.filter(|_| !config.disable_success), error: metrics.error.filter(|_| !config.disable_error), fault: metrics.fault.filter(|_| !config.disable_fault), operation_time: metrics From 7bb2c1ff674276714c6d5967c97f6b05fa9f806b Mon Sep 17 00:00:00 2001 From: Jason Gin Date: Wed, 25 Feb 2026 18:19:55 -0500 Subject: [PATCH 2/6] Add method to disable default outstanding_requests metric --- rust-runtime/Cargo.lock | 14 ++++---- .../src/layer/builder.rs | 34 +++++++++++++------ 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/rust-runtime/Cargo.lock b/rust-runtime/Cargo.lock index cc7414dbcc..c7f3df8dfe 100644 --- a/rust-runtime/Cargo.lock +++ b/rust-runtime/Cargo.lock @@ -381,7 +381,7 @@ dependencies = [ name = "aws-smithy-checksums" version = "0.64.5" dependencies = [ - "aws-smithy-http 0.63.5", + "aws-smithy-http 0.63.6", "aws-smithy-types 1.4.5", "bytes", "bytes-utils", @@ -471,7 +471,7 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.63.5" +version = "0.63.6" dependencies = [ "async-stream", "aws-smithy-eventstream", @@ -569,7 +569,7 @@ name = "aws-smithy-http-server" version = "0.66.2" dependencies = [ "aws-smithy-cbor 0.61.5", - "aws-smithy-http 0.63.5", + "aws-smithy-http 0.63.6", "aws-smithy-json 0.62.4", "aws-smithy-runtime-api 1.11.5", "aws-smithy-types 1.4.5", @@ -635,7 +635,7 @@ dependencies = [ name = "aws-smithy-http-server-python" version = "0.67.0" dependencies = [ - "aws-smithy-http 0.63.5", + "aws-smithy-http 0.63.6", "aws-smithy-json 0.62.4", "aws-smithy-legacy-http-server", "aws-smithy-types 1.4.5", @@ -810,7 +810,7 @@ version = "1.10.2" dependencies = [ "approx", "aws-smithy-async 1.2.13", - "aws-smithy-http 0.63.5", + "aws-smithy-http 0.63.6", "aws-smithy-http-client", "aws-smithy-observability", "aws-smithy-runtime-api 1.11.5", @@ -941,7 +941,7 @@ dependencies = [ name = "aws-smithy-wasm" version = "0.1.9" dependencies = [ - "aws-smithy-http 0.63.5", + "aws-smithy-http 0.63.6", "aws-smithy-runtime-api 1.11.5", "aws-smithy-types 1.4.5", "bytes", @@ -2389,7 +2389,7 @@ version = "0.1.0" dependencies = [ "aws-smithy-cbor 0.61.5", "aws-smithy-compression", - "aws-smithy-http 0.63.5", + "aws-smithy-http 0.63.6", "aws-smithy-json 0.62.4", "aws-smithy-runtime", "aws-smithy-runtime-api 1.11.5", diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/layer/builder.rs b/rust-runtime/aws-smithy-http-server-metrics/src/layer/builder.rs index 52389f57c7..2669747baa 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/layer/builder.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/layer/builder.rs @@ -44,50 +44,62 @@ macro_rules! impl_disable_methods { self } - /// Disable the `request_id` metric + /// Disable the default `outstanding_requests` metric + pub fn disable_default_outstanding_requests_metric(mut self) -> Self { + self.default_req_metrics_config.disable_outstanding_requests = true; + self + } + + /// Disable the default `request_id` metric pub fn disable_default_request_id_metric(mut self) -> Self { self.default_req_metrics_config.disable_request_id = true; self } - /// Disable the `operation_name` metric + /// Disable the default `operation_name` metric pub fn disable_default_operation_metric(mut self) -> Self { self.default_req_metrics_config.disable_operation = true; self } - /// Disable the `service_name` metric + /// Disable the default `service_name` metric pub fn disable_default_service_metric(mut self) -> Self { self.default_req_metrics_config.disable_service = true; self } - /// Disable the `service_version` metric + /// Disable the default `service_version` metric pub fn disable_default_service_version_metric(mut self) -> Self { self.default_req_metrics_config.disable_service_version = true; self } - /// Disable the `http_status_code` metric + /// Disable the default `http_status_code` metric pub fn disable_default_http_status_code_metric(mut self) -> Self { self.default_res_metrics_config.disable_http_status_code = true; self } - /// Disable the `error` metric - pub fn disable_error_metric(mut self) -> Self { + /// Disable the default `success` metric + pub fn disable_default_success_metric(mut self) -> Self { + self.default_res_metrics_config.disable_success = true; + self + } + + /// Disable the default `error` metric + pub fn disable_default_error_metric(mut self) -> Self { self.default_res_metrics_config.disable_error = true; self } - /// Disable the `fault` metric - pub fn disable_fault_metric(mut self) -> Self { + /// Disable the default `fault` metric + pub fn disable_default_fault_metric(mut self) -> Self { self.default_res_metrics_config.disable_fault = true; self } - /// Disable the `operation_time` metric - pub fn disable_operation_time_metric(mut self) -> Self { + /// Disable the default `operation_time` metric + pub fn disable_default_operation_time_metric(mut self) -> Self { self.default_res_metrics_config.disable_operation_time = true; self } From 27f7c95e51b1b9bc49be30d64432642e913eb8f5 Mon Sep 17 00:00:00 2001 From: Jason Gin Date: Thu, 26 Feb 2026 09:44:31 -0500 Subject: [PATCH 3/6] Use bool over u8 --- .../aws-smithy-http-server-metrics/src/default.rs | 6 +++--- .../aws-smithy-http-server-metrics/src/plugin.rs | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/default.rs b/rust-runtime/aws-smithy-http-server-metrics/src/default.rs index 5429b03656..d4fc7de7de 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/default.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/default.rs @@ -76,11 +76,11 @@ pub struct DefaultRequestMetrics { pub struct DefaultResponseMetrics { pub(crate) http_status_code: Option, /// Success indicator (1 if 2xx status code, 0 otherwise) - pub(crate) success: Option, + pub(crate) success: Option, /// Client error indicator (1 if 4xx status code, 0 otherwise) - pub(crate) error: Option, + pub(crate) error: Option, /// Server fault indicator (1 if 5xx status code, 0 otherwise) - pub(crate) fault: Option, + pub(crate) fault: Option, /// Wallclock time from pre-deserialization of the model input to post-serialization of the model output pub(crate) operation_time: Option, } diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs b/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs index d5abd83308..87bd4ba597 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs @@ -310,18 +310,22 @@ fn get_default_response_metrics( let status_code = status.as_u16(); let success = if (200..300).contains(&status_code) { - Some(1) + Some(true) } else { - Some(0) + Some(false) }; let error = if (400..500).contains(&status_code) { - Some(1) + Some(true) } else { - Some(0) + Some(false) }; - let fault = if status_code >= 500 { Some(1) } else { Some(0) }; + let fault = if status_code >= 500 { + Some(true) + } else { + Some(false) + }; DefaultResponseMetrics { http_status_code: Some(status_code), From 9a692ca8bdd6cc7cbeeceac222acfc853743ccf8 Mon Sep 17 00:00:00 2001 From: Jason Gin Date: Thu, 26 Feb 2026 14:31:31 -0500 Subject: [PATCH 4/6] Update status code --- .../src/default.rs | 12 +++++------ .../src/layer/builder.rs | 12 +++++------ .../aws-smithy-http-server-metrics/src/lib.rs | 4 ++-- .../src/plugin.rs | 21 +++++++++++-------- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/default.rs b/rust-runtime/aws-smithy-http-server-metrics/src/default.rs index d4fc7de7de..805c6be234 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/default.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/default.rs @@ -74,13 +74,13 @@ pub struct DefaultRequestMetrics { #[metrics] #[derive(Default, Debug)] pub struct DefaultResponseMetrics { - pub(crate) http_status_code: Option, + pub(crate) http_status_code: Option, /// Success indicator (1 if 2xx status code, 0 otherwise) pub(crate) success: Option, /// Client error indicator (1 if 4xx status code, 0 otherwise) - pub(crate) error: Option, - /// Server fault indicator (1 if 5xx status code, 0 otherwise) - pub(crate) fault: Option, + pub(crate) client_error: Option, + /// Server error indicator (1 if 5xx status code, 0 otherwise) + pub(crate) server_error: Option, /// Wallclock time from pre-deserialization of the model input to post-serialization of the model output pub(crate) operation_time: Option, } @@ -106,8 +106,8 @@ pub struct DefaultResponseMetricsConfig { pub(crate) disable_all: bool, pub(crate) disable_http_status_code: bool, pub(crate) disable_success: bool, - pub(crate) disable_error: bool, - pub(crate) disable_fault: bool, + pub(crate) disable_client_error: bool, + pub(crate) disable_server_error: bool, pub(crate) disable_operation_time: bool, } diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/layer/builder.rs b/rust-runtime/aws-smithy-http-server-metrics/src/layer/builder.rs index 2669747baa..4b49759222 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/layer/builder.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/layer/builder.rs @@ -86,15 +86,15 @@ macro_rules! impl_disable_methods { self } - /// Disable the default `error` metric - pub fn disable_default_error_metric(mut self) -> Self { - self.default_res_metrics_config.disable_error = true; + /// Disable the default `client_error` metric + pub fn disable_default_client_error_metric(mut self) -> Self { + self.default_res_metrics_config.disable_client_error = true; self } - /// Disable the default `fault` metric - pub fn disable_default_fault_metric(mut self) -> Self { - self.default_res_metrics_config.disable_fault = true; + /// Disable the default `server_error` metric + pub fn disable_default_server_error_metric(mut self) -> Self { + self.default_res_metrics_config.disable_server_error = true; self } diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/lib.rs b/rust-runtime/aws-smithy-http-server-metrics/src/lib.rs index de8cf0835e..8527055ee0 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/lib.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/lib.rs @@ -173,8 +173,8 @@ //! | Metric | Description | //! |--------|-------------| //! | `http_status_code` | HTTP status code of the response | -//! | `error` | Client error indicator (4xx status code) | -//! | `fault` | Server fault indicator (5xx status code) | +//! | `client_error` | Client error indicator (4xx status code) | +//! | `server_error` | Server error indicator (5xx status code) | //! | `operation_time` | Timestamp that denotes operation time from pre-deserialization to post-serialization | //! //! # Platform support diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs b/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs index 87bd4ba597..b448e27ca9 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/plugin.rs @@ -307,31 +307,30 @@ fn get_default_response_metrics( operation_time: Option, ) -> DefaultResponseMetrics { let status = res.status(); - let status_code = status.as_u16(); - let success = if (200..300).contains(&status_code) { + let success = if status.is_success() { Some(true) } else { Some(false) }; - let error = if (400..500).contains(&status_code) { + let client_error = if status.is_client_error() { Some(true) } else { Some(false) }; - let fault = if status_code >= 500 { + let server_error = if status.is_server_error() { Some(true) } else { Some(false) }; DefaultResponseMetrics { - http_status_code: Some(status_code), + http_status_code: Some(status.as_str().into()), success, - error, - fault, + client_error, + server_error, operation_time, } } @@ -373,8 +372,12 @@ fn configure_default_response_metrics( .http_status_code .filter(|_| !config.disable_http_status_code), success: metrics.success.filter(|_| !config.disable_success), - error: metrics.error.filter(|_| !config.disable_error), - fault: metrics.fault.filter(|_| !config.disable_fault), + client_error: metrics + .client_error + .filter(|_| !config.disable_client_error), + server_error: metrics + .server_error + .filter(|_| !config.disable_server_error), operation_time: metrics .operation_time .filter(|_| !config.disable_operation_time), From 795ea948e15d8a17a9d8812520849c48065d774a Mon Sep 17 00:00:00 2001 From: Jason Gin Date: Thu, 26 Feb 2026 15:51:47 -0500 Subject: [PATCH 5/6] Update snapshot and docs --- .../snapshots/metrics_test__metrics_content_via_tcp.snap | 6 +++--- rust-runtime/aws-smithy-http-server-metrics/src/lib.rs | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/pokemon-service/tests/snapshots/metrics_test__metrics_content_via_tcp.snap b/examples/pokemon-service/tests/snapshots/metrics_test__metrics_content_via_tcp.snap index ca41b0879f..05bb93a71d 100644 --- a/examples/pokemon-service/tests/snapshots/metrics_test__metrics_content_via_tcp.snap +++ b/examples/pokemon-service/tests/snapshots/metrics_test__metrics_content_via_tcp.snap @@ -2,6 +2,6 @@ source: pokemon-service/tests/metrics_test.rs expression: metrics_output --- -{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"found"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"success"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"found":1,"outstanding_requests":1,"http_status_code":200,"success":1,"error":0,"fault":0,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","requested_pokemon_name":"pikachu","service":"PokemonService","service_version":"2024-03-18","operation":"GetPokemonSpecies","request_id":"[request_id]} -{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"authenticated"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"success"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"authenticated":0,"outstanding_requests":1,"http_status_code":401,"success":0,"error":1,"fault":0,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","user":"ash","service":"PokemonService","service_version":"2024-03-18","operation":"GetStorage","request_id":"[request_id]} -{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"supported_region"},{"Name":"outstanding_requests"},{"Name":"http_status_code"},{"Name":"success"},{"Name":"error"},{"Name":"fault"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"supported_region":0,"outstanding_requests":1,"http_status_code":500,"success":0,"error":0,"fault":1,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","requested_region":"trigger500","service":"PokemonService","service_version":"2024-03-18","operation":"CapturePokemon","request_id":"[request_id]} +{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"found"},{"Name":"outstanding_requests"},{"Name":"success"},{"Name":"client_error"},{"Name":"server_error"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"found":1,"outstanding_requests":1,"success":1,"client_error":0,"server_error":0,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","requested_pokemon_name":"pikachu","service":"PokemonService","service_version":"2024-03-18","operation":"GetPokemonSpecies","request_id":"[request_id],"http_status_code":"200"} +{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"authenticated"},{"Name":"outstanding_requests"},{"Name":"success"},{"Name":"client_error"},{"Name":"server_error"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"authenticated":0,"outstanding_requests":1,"success":0,"client_error":1,"server_error":0,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","user":"ash","service":"PokemonService","service_version":"2024-03-18","operation":"GetStorage","request_id":"[request_id],"http_status_code":"401"} +{"_aws":{"CloudWatchMetrics":[{"Namespace":"Ns","Dimensions":[[]],"Metrics":[{"Name":"supported_region"},{"Name":"outstanding_requests"},{"Name":"success"},{"Name":"client_error"},{"Name":"server_error"},{"Name":"operation_time","Unit":"Milliseconds"}]}],"Timestamp":"[timestamp]},"supported_region":0,"outstanding_requests":1,"success":0,"client_error":0,"server_error":1,"operation_time":"[operation_time],"test_request_metric":"test request metric","test_response_metric":"test response metric","requested_region":"trigger500","service":"PokemonService","service_version":"2024-03-18","operation":"CapturePokemon","request_id":"[request_id],"http_status_code":"500"} diff --git a/rust-runtime/aws-smithy-http-server-metrics/src/lib.rs b/rust-runtime/aws-smithy-http-server-metrics/src/lib.rs index 8527055ee0..6815d6b096 100644 --- a/rust-runtime/aws-smithy-http-server-metrics/src/lib.rs +++ b/rust-runtime/aws-smithy-http-server-metrics/src/lib.rs @@ -173,6 +173,7 @@ //! | Metric | Description | //! |--------|-------------| //! | `http_status_code` | HTTP status code of the response | +//! | `success` | Success indicator (2xx status code) | //! | `client_error` | Client error indicator (4xx status code) | //! | `server_error` | Server error indicator (5xx status code) | //! | `operation_time` | Timestamp that denotes operation time from pre-deserialization to post-serialization | From beb943b2140382ebdff9e6d17b0bc9ba67500be2 Mon Sep 17 00:00:00 2001 From: Jason Gin Date: Fri, 27 Feb 2026 10:25:54 -0500 Subject: [PATCH 6/6] Update CODEOWNERS for aws-smithy-http-server-metrics --- CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CODEOWNERS b/CODEOWNERS index 25e1e00101..b262e11f9c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -5,6 +5,8 @@ /codegen-server/ @smithy-lang/smithy-rs-server /rust-runtime/aws-smithy-http-server/ @smithy-lang/smithy-rs-server /rust-runtime/aws-smithy-legacy-http-server/ @smithy-lang/smithy-rs-server +/rust-runtime/aws-smithy-http-server-metrics @smithy-lang/smithy-rs-server +/rust-runtime/aws-smithy-http-server-metrics-macro @smithy-lang/smithy-rs-server # Python Server /codegen-server-test/python/ @smithy-lang/smithy-rs-server