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

Commit 69a11e0

Browse files
austinceaknysh
authored andcommitted
feat: add ability to include dimensions per-metric (#29)
* feat: add ability to include dimensions per-metric * docs: regenerate readme * fix: invert inclusion list order * style: spacing * docs: make include/exclude dimension logic more clear
1 parent 57ffa27 commit 69a11e0

File tree

5 files changed

+135
-80
lines changed

5 files changed

+135
-80
lines changed

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,24 @@ __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) |
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;') |
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+
| include_dimensions_for_metrics | INCLUDE_DIMENSIONS_FOR_METRICS | Only publish the specified dimensions for metrics (semi-colon-separated key values of comma-separated dimensions of METRIC=dim1,dim2;, e.g. 'flink_jobmanager=job_id') |
72+
| exclude_dimensions_for_metrics | EXCLUDE_DIMENSIONS_FOR_METRICS | Never publish the specified dimensions 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;') |
7273

7374

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

112114
./dist/bin/prometheus-to-cloudwatch
@@ -138,6 +140,7 @@ docker run -i --rm \
138140
-e ACCEPT_INVALID_CERT=true \
139141
-e INCLUDE_METRICS="" \
140142
-e EXCLUDE_METRICS="" \
143+
-e INCLUDE_DIMENSIONS_FOR_METRICS="" \
141144
-e EXCLUDE_DIMENSIONS_FOR_METRICS="" \
142145
prometheus-to-cloudwatch
143146
```

README.yaml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,24 @@ 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) |
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;') |
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+
| include_dimensions_for_metrics | INCLUDE_DIMENSIONS_FOR_METRICS | Only publish the specified dimensions for metrics (semi-colon-separated key values of comma-separated dimensions of METRIC=dim1,dim2;, e.g. 'flink_jobmanager=job_id') |
66+
| exclude_dimensions_for_metrics | EXCLUDE_DIMENSIONS_FOR_METRICS | Never publish the specified dimensions 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;') |
6667
6768
6869
__NOTE__: If AWS credentials are not provided in the command-line arguments (`aws_access_key_id` and `aws_secret_access_key`)
@@ -97,6 +98,7 @@ examples: |-
9798
# Optionally, restrict the subset of metrics to be exported to CloudWatch
9899
# export INCLUDE_METRICS='jvm_*'
99100
# export EXCLUDE_METRICS='jvm_memory_*,jvm_buffer_*'
101+
# export INCLUDE_DIMENSIONS_FOR_METRICS='jvm_memory_*=pod_id'
100102
# export EXCLUDE_DIMENSIONS_FOR_METRICS='jvm_memory_*=pod;jvm_buffer=job,pod'
101103
102104
./dist/bin/prometheus-to-cloudwatch
@@ -128,6 +130,7 @@ examples: |-
128130
-e ACCEPT_INVALID_CERT=true \
129131
-e INCLUDE_METRICS="" \
130132
-e EXCLUDE_METRICS="" \
133+
-e INCLUDE_DIMENSIONS_FOR_METRICS="" \
131134
-e EXCLUDE_DIMENSIONS_FOR_METRICS="" \
132135
prometheus-to-cloudwatch
133136
```

chart/templates/NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ env:
1212
# Optionally:
1313
- INCLUDE_METRICS
1414
- EXCLUDE_METRICS
15+
- INCLUDE_DIMENSIONS_FOR_METRICS
16+
- EXCLUDE_DIMENSIONS_FOR_METRICS
1517

1618
secrets:
1719
- AWS_ACCESS_KEY_ID

0 commit comments

Comments
 (0)