Skip to content

The parameter logs.metrics_collected.prometheus.emf_processor.metric_declaration.metric_selectors without any function #1544

Open
@eugen-eugen

Description

@eugen-eugen

Describe the bug
I whant to use the parameter logs.metrics_collected.prometheus.emf_processor.metric_declaration.metric_selectors in order to send only metrics I whant to AWS Cloud Watch, as described in https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/ContainerInsights-Prometheus-Setup-configure.html:

_metric_declaration— are sections that specify the array of logs with embedded metric format to be generated. There are metric_declaration sections for each Prometheus source that the CloudWatch agent imports from by default. These sections each include the following fields:

label_matcher is a regular expression that checks the value of the labels listed in source_labels. The metrics that match are enabled for inclusion in the embedded metric format sent to CloudWatch.

If you have multiple labels specified in source_labels, we recommend that you do not use ^ or $ characters in the regular expression for label_matcher.

source_labels specifies the value of the labels that are checked by the label_matcher line.

label_separator specifies the separator to be used in the label_matcher line if multiple source_labels are specified. The default is ;. You can see this default used in the label_matcher line in the following example.

metric_selectors is a regular expression that specifies the metrics to be collected and sent to CloudWatch.

dimensions is the list of labels to be used as CloudWatch dimensions for each selected metric._

====================================================================================
But no matter how i set metric_selectors, it doesn't have any effect: all scrapped metrics are sent to Cloud Watch.

Steps to reproduce
Set metric_selectors to any existing metric name

What did you expect to see?
Only this metric in Cloud Watch

What did you see instead?
All metrics which prometheus had scrapped from my application

What version did you use?
1.300051.0b992

What config did you use?

....
"emf_processor": {
              "metric_declaration": [
                {
                  "source_labels": ["*"],
                  "label_matcher": "*spring*",
                  "dimensions": [["ClusterName","Namespace", "Endpoint"]],
                  "metric_selectors": [
                    "^spring_data_repository_invocations_seconds_max$"
                  ]
                }
              ]
            }
...

Environment
OS: Ubuntu

Additional context
I've researched in the code of cw agent here on github and i didn't find any usage of the variable MetricSeclector, which is set by the parameter metric_selctor.
My cloud watch agent runs inside of a EKS-Cluster in the same AWS-Account as Cloud Watch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions