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

Graph Annotations Do Not Work With CloudWatch Dynamic Lables #493

Open
JCKortlang opened this issue Feb 2, 2024 · 0 comments
Open

Graph Annotations Do Not Work With CloudWatch Dynamic Lables #493

JCKortlang opened this issue Feb 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JCKortlang
Copy link

JCKortlang commented Feb 2, 2024

Version

7.6.0

Steps and/or minimal code example to reproduce

    public static MonitoringFacade MonitorApplicationLoadBalancer(this MonitoringFacade monitoringFacade, ApplicationLoadBalancer alb, string region = "us-west-2")
    {
        ArgumentException.ThrowIfNullOrWhiteSpace(region, nameof(region));
        var albDimensions = new Dictionary<string, string>
        {
            { "LoadBalancer", alb.LoadBalancerFullName}
        };
       //Note that the label inclucdes CloudWatch dynamic lables -- https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html
        var target5xx = (Metric) metricFactory.CreateMetric("HTTPCode_Target_5XX_Count", MetricStatistic.SUM, "${LABEL} [avg: ${AVG}, min: ${MIN}, max: ${MAX}]", albDimensions, default, AwsAlbNamespace);
        var target5xxMetricWithAlarm = new CustomMetricWithAlarm
        {
            AddAlarm = new Dictionary<string, ICustomThreshold>
            {
                { "critical", new CustomThreshold
                    {
                        Threshold = 1,
                        ComparisonOperator = ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
                        //We do not have sufficient traffic to treat as breaching
                        TreatMissingDataOverride = TreatMissingData.NOT_BREACHING
                    }
                }
            },
            AlarmFriendlyName = "5xx-alarm",
            Metric = target5xx
        };

        return monitoringFacade
            .MonitorCustom(new CustomMonitoringProps
            {
                //Each "CustomMetricGroup" is a CloudWatch graph. Each graph is composed of [1..n] metrics
                MetricGroups =
                [
                    new CustomMetricGroup
                    {
                        Metrics = [target5xxMetricWithAlarm],
                        Title = "HTTP 5XXs"
                    },
                ],
                AlarmFriendlyName = "alb",
                HumanReadableName = $"Application Load Balancer [{alb.LoadBalancerName}](https://{region}.console.aws.amazon.com/ec2/home?region={region}#LoadBalancer:loadBalancerArn={alb.LoadBalancerArn})"
            });
    }

Note that the output graph annotations contains the dynamic label placeholders.

derp

Expected behavior

Expect that the output annotation does not contain the dynamic labels. e.g. Contains the metric and thresholds being monitored.

e.g. "HTTPCode_Target_5XX_Count > 1 for 5 minutes"

Actual behavior

The output annotation contains the dynamic labels placeholders. .e.g "${LABEL} [avg: ${AVG}, min: ${MIN}, max: ${MAX}]"

derp

Other details

See https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/graph-dynamic-labels.html

@JCKortlang JCKortlang added the bug Something isn't working label Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant