Client library for embedded metric format logs #660
Replies: 6 comments 2 replies
-
Not at the moment. We'd definitely accept contributions if anyone wants to build one. |
Beta Was this translation helpful? Give feedback.
-
I'm working on one that uses the metrics crate as a front end. Will share when I get to a minimum viable product. |
Beta Was this translation helpful? Give feedback.
-
Alright, I have a thing that works, figuring out how to get this on github, etc. Example
OutputSTART RequestId: 6d01b155-a8e7-4903-934f-8f4c9b524552 Version: $LATEST |
Beta Was this translation helpful? Give feedback.
-
Alright that was less painful than I thought... https://github.com/BMorinDrifter/metrics-cloudwatch-embedded |
Beta Was this translation helpful? Give feedback.
-
It's on crates.io now |
Beta Was this translation helpful? Give feedback.
-
Added some lambda specific integration to provide some of the metrics features found in Lambda Power Tools for other runtimes. Under the hood Exampleuse 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
} Output
|
Beta Was this translation helpful? Give feedback.
-
Are there any plans on a Rust library for embedded metric format logs, adding to the list here?
Beta Was this translation helpful? Give feedback.
All reactions