Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AggregatedHistogram metrics to the AWS CloudWatch Sink #21895

Open
mkwan-amzn opened this issue Nov 26, 2024 · 0 comments
Open
Labels
sink: aws_cloudwatch_metrics Anything `aws_cloudwatch_metrics` sink related type: feature A value-adding code addition that introduce new functionality.

Comments

@mkwan-amzn
Copy link

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Use Cases

The end goal is for the AWS CloudWatch sink to support sending AggregatedHistogram MetricValue types to CloudWatch. An example such metric is http_client_rtt_seconds, which right now when attempting to send through the CloudWatch Sink is dropped, with no error messages or logging to reveal why.

Attempted Solutions

I have not attempted to solve this. It may be possible by attempting to restructure the emitted metric in a transform step but I'm not sure and have not tested it.

Proposal

We need to add support for that MetricValue type here:

match event.value() {
MetricValue::Counter { value } => Some(
MetricDatum::builder()
.metric_name(metric_name)
.value(*value)
.set_timestamp(timestamp)
.set_dimensions(dimensions)
.build(),
),
MetricValue::Distribution {
samples,
statistic: _,
} => Some(
MetricDatum::builder()
.metric_name(metric_name)
.set_values(Some(samples.iter().map(|s| s.value).collect()))
.set_counts(Some(samples.iter().map(|s| s.rate as f64).collect()))
.set_timestamp(timestamp)
.set_dimensions(dimensions)
.build(),
),
MetricValue::Set { values } => Some(
MetricDatum::builder()
.metric_name(metric_name)
.value(values.len() as f64)
.set_timestamp(timestamp)
.set_dimensions(dimensions)
.build(),
),
MetricValue::Gauge { value } => Some(
MetricDatum::builder()
.metric_name(metric_name)
.value(*value)
.set_timestamp(timestamp)
.set_dimensions(dimensions)
.build(),
),
_ => None,

Stealing from @jszwedko as we discussed here: #21851

It should probably log a warning or something when dropping those metrics. I agree it should support them; probably by converting each bucket into a separate counter.

References

This was discussed here: #21851

Version

0.37.1

@mkwan-amzn mkwan-amzn added the type: feature A value-adding code addition that introduce new functionality. label Nov 26, 2024
@pront pront added the sink: aws_cloudwatch_metrics Anything `aws_cloudwatch_metrics` sink related label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sink: aws_cloudwatch_metrics Anything `aws_cloudwatch_metrics` sink related type: feature A value-adding code addition that introduce new functionality.
Projects
None yet
Development

No branches or pull requests

2 participants