Open michaelbrewer opened 2 years ago
I assume @nmoutschen you are already running this and have a crate (namespace)
I assume @nmoutschen you are already running this and have a crate (namespace)
Yep! I've reserved the lambda-powertools crate and am working on a DX proposal at the moment.
Any chance of re-opening this ticket?
@ZackKanter thanks for the nudge!
As of now, we don't have plans to create Lambda Powertools for Rust due to skill set (@nmoutschen left) and staffing (not planned in the foreseeable future for Rust) -- We'll happily update this issue if that changes it.
Not sure if anything has changed, but wanted to say this would be welcome
I'm doing some work to close the gap a bit, at least for metrics.
https://crates.io/crates/metrics_cloudwatch_embedded
use lambda_runtime::{Error, LambdaEvent};
use metrics_cloudwatch_embedded::lambda::handler::run;
use serde::{Deserialize, Serialize};
#[derive(Deserialize)]
struct Request {}
#[derive(Serialize)]
struct Response {
}
async fn function_handler(event: LambdaEvent<Request>) -> Result<Response, Error> {
metrics::increment_counter!("requests", "Method" => "Default");
Ok(Response {})
}
#[tokio::main]
async fn main() -> Result<(), Error> {
tracing_subscriber::fmt()
.with_env_filter(tracing_subscriber::filter::EnvFilter::from_default_env())
.with_target(false)
.without_time()
.compact()
.init();
let metrics = metrics_cloudwatch_embedded::Builder::new()
.cloudwatch_namespace("MetricsExample")
.with_dimension("Function", std::env::var("AWS_LAMBDA_FUNCTION_NAME").unwrap())
.lambda_cold_start_metric("ColdStart")
.with_lambda_request_id("RequestId")
.init()
.unwrap();
run(metrics, function_handler).await
}
START RequestId: 4bd2d365-3792-46c8-9b6c-6132f9630fbb Version: $LATEST
{"_aws":{"Timestamp":1687947426188,"CloudWatchMetrics":[{"Namespace":"MetricsTest","Dimensions":[["Function"]],"Metrics":[{"Name":"ColdStart","Unit":"Count"}]}]},"Function":"MetricsTest","RequestId":"4bd2d365-3792-46c8-9b6c-6132f9630fbb","ColdStart":1}
{"_aws":{"Timestamp":1687947426188,"CloudWatchMetrics":[{"Namespace":"MetricsTest","Dimensions":[["Function","Method"]],"Metrics":[{"Name":"requests"}]}]},"Function":"MetricsTest","Method":"Default","RequestId":"4bd2d365-3792-46c8-9b6c-6132f9630fbb","requests":1}
END RequestId: 4bd2d365-3792-46c8-9b6c-6132f9630fbb
REPORT RequestId: 4bd2d365-3792-46c8-9b6c-6132f9630fbb Duration: 1.28 ms Billed Duration: 22 ms Memory Size: 128 MB Max Memory Used: 14 MB Init Duration: 20.02 ms
Under the hood tower::Service
is used to hook up decoration before the handler (or inner service) and to flush metrics after the handler.
Is there an update on this? @nmoutschen
Is there an update on this? @nmoutschen
I no longer work at AWS, so unfortunately, I do not know
Powertools team here — no updates on Rust for 2024 given investments are tight atm. Focus remain on current feature parity between TypeScript (2nd most popular language), Java, and .NET
On Mon, 11 Dec 2023 at 16:46, Nicolas Moutschen @.***> wrote:
Is there an update on this? @nmoutschen https://github.com/nmoutschen
I no longer work at AWS, so unfortunately, I do not know
— Reply to this email directly, view it on GitHub https://github.com/aws-powertools/powertools-lambda/issues/37#issuecomment-1850344561, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZPQBGUABYNVPSP7WM3E23YI4TFJAVCNFSM5H3QRFUKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBVGAZTINBVGYYQ . You are receiving this because you modified the open/close state.Message ID: @.***>
Too bad i was hoping after the rust sdk v1 release this might come too.
Runtime: Rust
Is your feature request related to a problem? Please describe In the Serverless Lens for the Well Architected Framework, we suggest several best practices for observability such as structured logging, distributed tracing, and monitoring of metrics. The suite of utilities of the AWS Lambda Powertools help developers with the adoption of best practices. Today, AWS Lambda Powertools is available for the Python and Java runtimes.
In addition to the powertools the crate, the documentation site can help people new to Rust and AWS Lambda to get up in running
Describe the solution you'd like AWS Lambda Powertools available for
Provided
runtimes, written in Rust.Describe alternatives you've considered There is almost no alternatives or guidance that i have seen so far.
If you provide guidance, is this something you'd like to contribute? Absolutely yes.
Additional context The Rust Powertools will follow the same tenets as the other languages, and folks can expect the same core utilities/ functionalities being supported.