Skip to content
This repository was archived by the owner on Mar 12, 2026. It is now read-only.

Commit 57ffa27

Browse files
austinceaknysh
authored andcommitted
feat: add ability to exclude dimensions per-metric (#28)
1 parent 2087b3a commit 57ffa27

File tree

4 files changed

+148
-66
lines changed

4 files changed

+148
-66
lines changed

README.md

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,23 @@ __NOTE__: The module accepts parameters as command-line arguments or as ENV vari
5252
Command-line arguments take precedence over ENV vars
5353

5454

55-
| Command-line argument | ENV var | Description |
56-
|:-----------------------------|:-----------------------------|:------------------------------------------------------------------------------|
57-
| aws_access_key_id | AWS_ACCESS_KEY_ID | AWS access key Id with permissions to publish CloudWatch metrics |
58-
| aws_secret_access_key | AWS_SECRET_ACCESS_KEY | AWS secret access key with permissions to publish CloudWatch metrics |
59-
| cloudwatch_namespace | CLOUDWATCH_NAMESPACE | CloudWatch Namespace |
60-
| cloudwatch_region | CLOUDWATCH_REGION | CloudWatch AWS Region |
61-
| cloudwatch_publish_timeout | CLOUDWATCH_PUBLISH_TIMEOUT | CloudWatch publish timeout in seconds |
62-
| prometheus_scrape_interval | PROMETHEUS_SCRAPE_INTERVAL | Prometheus scrape interval in seconds |
63-
| prometheus_scrape_url | PROMETHEUS_SCRAPE_URL | The URL to scrape Prometheus metrics from |
64-
| cert_path | CERT_PATH | Path to SSL Certificate file (when using SSL for `prometheus_scrape_url`) |
65-
| keyPath | KEY_PATH | Path to Key file (when using SSL for `prometheus_scrape_url`) |
66-
| accept_invalid_cert | ACCEPT_INVALID_CERT | Accept any certificate during TLS handshake. Insecure, use only for testing |
67-
| additional_dimension | ADDITIONAL_DIMENSION | Additional dimension specified by NAME=VALUE |
68-
| replace_dimensions | REPLACE_DIMENSIONS | Replace dimensions specified by NAME=VALUE,... |
69-
| include_metrics | INCLUDE_METRICS | Only publish the specified metrics (comma-separated list of glob patterns) |
70-
| exclude_metrics | EXCLUDE_METRICS | Never publish the specified metrics (comma-separated list of glob patterns) |
55+
| Command-line argument | ENV var | Description |
56+
|--------------------------------|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
57+
| aws_access_key_id | AWS_ACCESS_KEY_ID | AWS access key Id with permissions to publish CloudWatch metrics |
58+
| aws_secret_access_key | AWS_SECRET_ACCESS_KEY | AWS secret access key with permissions to publish CloudWatch metrics |
59+
| cloudwatch_namespace | CLOUDWATCH_NAMESPACE | CloudWatch Namespace |
60+
| cloudwatch_region | CLOUDWATCH_REGION | CloudWatch AWS Region |
61+
| cloudwatch_publish_timeout | CLOUDWATCH_PUBLISH_TIMEOUT | CloudWatch publish timeout in seconds |
62+
| prometheus_scrape_interval | PROMETHEUS_SCRAPE_INTERVAL | Prometheus scrape interval in seconds |
63+
| prometheus_scrape_url | PROMETHEUS_SCRAPE_URL | The URL to scrape Prometheus metrics from |
64+
| cert_path | CERT_PATH | Path to SSL Certificate file (when using SSL for `prometheus_scrape_url`) |
65+
| keyPath | KEY_PATH | Path to Key file (when using SSL for `prometheus_scrape_url`) |
66+
| accept_invalid_cert | ACCEPT_INVALID_CERT | Accept any certificate during TLS handshake. Insecure, use only for testing |
67+
| additional_dimension | ADDITIONAL_DIMENSION | Additional dimension specified by NAME=VALUE |
68+
| replace_dimensions | REPLACE_DIMENSIONS | Replace dimensions specified by NAME=VALUE,... |
69+
| include_metrics | INCLUDE_METRICS | Only publish the specified metrics (comma-separated list of glob patterns) |
70+
| exclude_metrics | EXCLUDE_METRICS | Never publish the specified metrics (comma-separated list of glob patterns) |
71+
| exclude_dimensions_for_metrics | EXCLUDE_DIMENSIONS_FOR_METRICS | Dimensions to exclude for metrics (semi-colon-separated key values of comma-separated dimensions of METRIC=dim1,dim2;, e.g. 'flink_jobmanager=job,host;zk_up=host,pod;') |
7172

7273

7374
__NOTE__: If AWS credentials are not provided in the command-line arguments (`aws_access_key_id` and `aws_secret_access_key`)
@@ -106,6 +107,7 @@ export ACCEPT_INVALID_CERT=true
106107
# Optionally, restrict the subset of metrics to be exported to CloudWatch
107108
# export INCLUDE_METRICS='jvm_*'
108109
# export EXCLUDE_METRICS='jvm_memory_*,jvm_buffer_*'
110+
# export EXCLUDE_DIMENSIONS_FOR_METRICS='jvm_memory_*=pod;jvm_buffer=job,pod'
109111

110112
./dist/bin/prometheus-to-cloudwatch
111113
```
@@ -136,6 +138,7 @@ docker run -i --rm \
136138
-e ACCEPT_INVALID_CERT=true \
137139
-e INCLUDE_METRICS="" \
138140
-e EXCLUDE_METRICS="" \
141+
-e EXCLUDE_DIMENSIONS_FOR_METRICS="" \
139142
prometheus-to-cloudwatch
140143
```
141144

@@ -316,19 +319,21 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
316319

317320
### Contributors
318321

319-
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![yufukui-m][yufukui-m_avatar]][yufukui-m_homepage]<br/>[yufukui-m][yufukui-m_homepage] | [![Satadru Biswas][sbiswas-suplari_avatar]][sbiswas-suplari_homepage]<br/>[Satadru Biswas][sbiswas-suplari_homepage] |
320-
|---|---|---|---|---|
322+
| [![Erik Osterman][osterman_avatar]][osterman_homepage]<br/>[Erik Osterman][osterman_homepage] | [![Andriy Knysh][aknysh_avatar]][aknysh_homepage]<br/>[Andriy Knysh][aknysh_homepage] | [![Igor Rodionov][goruha_avatar]][goruha_homepage]<br/>[Igor Rodionov][goruha_homepage] | [![yufukui-m][yufukui-m_avatar]][yufukui-m_homepage]<br/>[yufukui-m][yufukui-m_homepage] | [![Satadru Biswas][sbiswas-suplari_avatar]][sbiswas-suplari_homepage]<br/>[Satadru Biswas][sbiswas-suplari_homepage] | [![Austin ce][austince_avatar]][austince_homepage]<br/>[Austin ce][austince_homepage] |
323+
|---|---|---|---|---|---|
321324

322325
[osterman_homepage]: https://github.com/osterman
323-
[osterman_avatar]: https://github.com/osterman.png?size=150
326+
[osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png
324327
[aknysh_homepage]: https://github.com/aknysh
325-
[aknysh_avatar]: https://github.com/aknysh.png?size=150
328+
[aknysh_avatar]: https://img.cloudposse.com/150x150/https://github.com/aknysh.png
326329
[goruha_homepage]: https://github.com/goruha
327-
[goruha_avatar]: https://github.com/goruha.png?size=150
330+
[goruha_avatar]: https://img.cloudposse.com/150x150/https://github.com/goruha.png
328331
[yufukui-m_homepage]: https://github.com/yufukui-m
329-
[yufukui-m_avatar]: https://github.com/yufukui-m.png?size=150
332+
[yufukui-m_avatar]: https://img.cloudposse.com/150x150/https://github.com/yufukui-m.png
330333
[sbiswas-suplari_homepage]: https://github.com/sbiswas-suplari
331-
[sbiswas-suplari_avatar]: https://github.com/sbiswas-suplari.png?size=150
334+
[sbiswas-suplari_avatar]: https://img.cloudposse.com/150x150/https://github.com/sbiswas-suplari.png
335+
[austince_homepage]: https://github.com/austince
336+
[austince_avatar]: https://img.cloudposse.com/150x150/https://github.com/austince.png
332337

333338

334339

README.yaml

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,23 @@ usage: |-
4646
Command-line arguments take precedence over ENV vars
4747
4848
49-
| Command-line argument | ENV var | Description |
50-
|:-----------------------------|:-----------------------------|:------------------------------------------------------------------------------|
51-
| aws_access_key_id | AWS_ACCESS_KEY_ID | AWS access key Id with permissions to publish CloudWatch metrics |
52-
| aws_secret_access_key | AWS_SECRET_ACCESS_KEY | AWS secret access key with permissions to publish CloudWatch metrics |
53-
| cloudwatch_namespace | CLOUDWATCH_NAMESPACE | CloudWatch Namespace |
54-
| cloudwatch_region | CLOUDWATCH_REGION | CloudWatch AWS Region |
55-
| cloudwatch_publish_timeout | CLOUDWATCH_PUBLISH_TIMEOUT | CloudWatch publish timeout in seconds |
56-
| prometheus_scrape_interval | PROMETHEUS_SCRAPE_INTERVAL | Prometheus scrape interval in seconds |
57-
| prometheus_scrape_url | PROMETHEUS_SCRAPE_URL | The URL to scrape Prometheus metrics from |
58-
| cert_path | CERT_PATH | Path to SSL Certificate file (when using SSL for `prometheus_scrape_url`) |
59-
| keyPath | KEY_PATH | Path to Key file (when using SSL for `prometheus_scrape_url`) |
60-
| accept_invalid_cert | ACCEPT_INVALID_CERT | Accept any certificate during TLS handshake. Insecure, use only for testing |
61-
| additional_dimension | ADDITIONAL_DIMENSION | Additional dimension specified by NAME=VALUE |
62-
| replace_dimensions | REPLACE_DIMENSIONS | Replace dimensions specified by NAME=VALUE,... |
63-
| include_metrics | INCLUDE_METRICS | Only publish the specified metrics (comma-separated list of glob patterns) |
64-
| exclude_metrics | EXCLUDE_METRICS | Never publish the specified metrics (comma-separated list of glob patterns) |
49+
| Command-line argument | ENV var | Description |
50+
|--------------------------------|--------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
51+
| aws_access_key_id | AWS_ACCESS_KEY_ID | AWS access key Id with permissions to publish CloudWatch metrics |
52+
| aws_secret_access_key | AWS_SECRET_ACCESS_KEY | AWS secret access key with permissions to publish CloudWatch metrics |
53+
| cloudwatch_namespace | CLOUDWATCH_NAMESPACE | CloudWatch Namespace |
54+
| cloudwatch_region | CLOUDWATCH_REGION | CloudWatch AWS Region |
55+
| cloudwatch_publish_timeout | CLOUDWATCH_PUBLISH_TIMEOUT | CloudWatch publish timeout in seconds |
56+
| prometheus_scrape_interval | PROMETHEUS_SCRAPE_INTERVAL | Prometheus scrape interval in seconds |
57+
| prometheus_scrape_url | PROMETHEUS_SCRAPE_URL | The URL to scrape Prometheus metrics from |
58+
| cert_path | CERT_PATH | Path to SSL Certificate file (when using SSL for `prometheus_scrape_url`) |
59+
| keyPath | KEY_PATH | Path to Key file (when using SSL for `prometheus_scrape_url`) |
60+
| accept_invalid_cert | ACCEPT_INVALID_CERT | Accept any certificate during TLS handshake. Insecure, use only for testing |
61+
| additional_dimension | ADDITIONAL_DIMENSION | Additional dimension specified by NAME=VALUE |
62+
| replace_dimensions | REPLACE_DIMENSIONS | Replace dimensions specified by NAME=VALUE,... |
63+
| include_metrics | INCLUDE_METRICS | Only publish the specified metrics (comma-separated list of glob patterns) |
64+
| exclude_metrics | EXCLUDE_METRICS | Never publish the specified metrics (comma-separated list of glob patterns) |
65+
| exclude_dimensions_for_metrics | EXCLUDE_DIMENSIONS_FOR_METRICS | Dimensions to exclude for metrics (semi-colon-separated key values of comma-separated dimensions of METRIC=dim1,dim2;, e.g. 'flink_jobmanager=job,host;zk_up=host,pod;') |
6566
6667
6768
__NOTE__: If AWS credentials are not provided in the command-line arguments (`aws_access_key_id` and `aws_secret_access_key`)
@@ -96,6 +97,7 @@ examples: |-
9697
# Optionally, restrict the subset of metrics to be exported to CloudWatch
9798
# export INCLUDE_METRICS='jvm_*'
9899
# export EXCLUDE_METRICS='jvm_memory_*,jvm_buffer_*'
100+
# export EXCLUDE_DIMENSIONS_FOR_METRICS='jvm_memory_*=pod;jvm_buffer=job,pod'
99101
100102
./dist/bin/prometheus-to-cloudwatch
101103
```
@@ -126,6 +128,7 @@ examples: |-
126128
-e ACCEPT_INVALID_CERT=true \
127129
-e INCLUDE_METRICS="" \
128130
-e EXCLUDE_METRICS="" \
131+
-e EXCLUDE_DIMENSIONS_FOR_METRICS="" \
129132
prometheus-to-cloudwatch
130133
```
131134
@@ -191,3 +194,5 @@ contributors:
191194
github: "yufukui-m"
192195
- name: "Satadru Biswas"
193196
github: "sbiswas-suplari"
197+
- name: "Austin ce"
198+
github: "austince"

0 commit comments

Comments
 (0)