pub struct Manager { /* private fields */ }
Expand description

Implements AWS CloudWatch manager.

Implementations§

Posts CloudWatch metrics.

ref. https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_PutMetricData.html ref. https://docs.rs/aws-sdk-cloudwatch/latest/aws_sdk_cloudwatch/struct.Client.html#method.put_metric_data

Can batch up to 1,000 data point. ref. https://aws.amazon.com/about-aws/whats-new/2022/08/amazon-cloudwatch-metrics-increases-throughput/

“If a single piece of data must be accessible from more than one task concurrently, then it must be shared using synchronization primitives such as Arc.” ref. https://tokio.rs/tokio/tutorial/spawning

Examples found in repository?
src/cloudwatch.rs (line 238)
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
pub async fn spawn_put_metric_data(
    cw_manager: Manager,
    namespace: &str,
    data: Vec<MetricDatum>,
) -> Result<()> {
    let cw_manager_arc = Arc::new(cw_manager);
    let namespace_arc = Arc::new(namespace.to_string());
    tokio::spawn(async move {
        cw_manager_arc
            .put_metric_data(namespace_arc, Arc::new(data))
            .await
    })
    .await
    .expect("failed spawn await")
}

Creates a CloudWatch log group. ref. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html

Deletes a CloudWatch log group. ref. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more