Skip to content

Commit d773108

Browse files
authored
Merge pull request #240 from qonto/improve-doc-tagging
docs: enhance tagging filter documentation
2 parents c2f7f90 + 5888caa commit d773108

File tree

3 files changed

+91
-50
lines changed

3 files changed

+91
-50
lines changed

README.md

Lines changed: 74 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -90,37 +90,37 @@ It collects key metrics about:
9090
<details>
9191
<summary>Standard Go and Prometheus metrics are also available</summary>
9292

93-
| Name | Labels | Description |
94-
| ------ | -------| ----------- |
95-
| go_gc_duration_seconds | `quantile` | A summary of the pause duration of garbage collection cycles. |
96-
| go_goroutines | | Number of goroutines that currently exist. |
97-
| go_info | `version` | Information about the Go environment. |
98-
| go_memstats_alloc_bytes | | Number of bytes allocated and still in use. |
99-
| go_memstats_alloc_bytes_total | | Total number of bytes allocated, even if freed. |
100-
| go_memstats_buck_hash_sys_bytes | | Number of bytes used by the profiling bucket hash table. |
101-
| go_memstats_frees_total | | Total number of frees. |
102-
| go_memstats_gc_sys_bytes | | Number of bytes used for garbage collection system metadata. |
103-
| go_memstats_heap_alloc_bytes | | Number of heap bytes allocated and still in use. |
104-
| go_memstats_heap_idle_bytes | | Number of heap bytes waiting to be used. |
105-
| go_memstats_heap_inuse_bytes | | Number of heap bytes that are in use. |
106-
| go_memstats_heap_objects | | Number of allocated objects. |
107-
| go_memstats_heap_released_bytes | | Number of heap bytes released to OS. |
108-
| go_memstats_heap_sys_bytes | | Number of heap bytes obtained from system. |
109-
| go_memstats_last_gc_time_seconds | | Number of seconds since 1970 of last garbage collection. |
110-
| go_memstats_lookups_total | | Total number of pointer lookups. |
111-
| go_memstats_mallocs_total | | Total number of mallocs. |
112-
| go_memstats_mcache_inuse_bytes | | Number of bytes in use by mcache structures. |
113-
| go_memstats_mcache_sys_bytes | | Number of bytes used for mcache structures obtained from system. |
114-
| go_memstats_mspan_inuse_bytes | | Number of bytes in use by mspan structures. |
115-
| go_memstats_mspan_sys_bytes | | Number of bytes used for mspan structures obtained from system. |
116-
| go_memstats_next_gc_bytes | | Number of heap bytes when next garbage collection will take place. |
117-
| go_memstats_other_sys_bytes | | Number of bytes used for other system allocations. |
118-
| go_memstats_stack_inuse_bytes | | Number of bytes in use by the stack allocator. |
119-
| go_memstats_stack_sys_bytes | | Number of bytes obtained from system for stack allocator. |
120-
| go_memstats_sys_bytes | | Number of bytes obtained from system. |
121-
| go_threads | | Number of OS threads created. |
122-
| promhttp_metric_handler_requests_in_flight | | Current number of scrapes being served. |
123-
| promhttp_metric_handler_requests_total | `code` | Total number of scrapes by HTTP status code. |
93+
| Name | Labels | Description |
94+
| ------------------------------------------ | ---------- | ------------------------------------------------------------------ |
95+
| go_gc_duration_seconds | `quantile` | A summary of the pause duration of garbage collection cycles. |
96+
| go_goroutines | | Number of goroutines that currently exist. |
97+
| go_info | `version` | Information about the Go environment. |
98+
| go_memstats_alloc_bytes | | Number of bytes allocated and still in use. |
99+
| go_memstats_alloc_bytes_total | | Total number of bytes allocated, even if freed. |
100+
| go_memstats_buck_hash_sys_bytes | | Number of bytes used by the profiling bucket hash table. |
101+
| go_memstats_frees_total | | Total number of frees. |
102+
| go_memstats_gc_sys_bytes | | Number of bytes used for garbage collection system metadata. |
103+
| go_memstats_heap_alloc_bytes | | Number of heap bytes allocated and still in use. |
104+
| go_memstats_heap_idle_bytes | | Number of heap bytes waiting to be used. |
105+
| go_memstats_heap_inuse_bytes | | Number of heap bytes that are in use. |
106+
| go_memstats_heap_objects | | Number of allocated objects. |
107+
| go_memstats_heap_released_bytes | | Number of heap bytes released to OS. |
108+
| go_memstats_heap_sys_bytes | | Number of heap bytes obtained from system. |
109+
| go_memstats_last_gc_time_seconds | | Number of seconds since 1970 of last garbage collection. |
110+
| go_memstats_lookups_total | | Total number of pointer lookups. |
111+
| go_memstats_mallocs_total | | Total number of mallocs. |
112+
| go_memstats_mcache_inuse_bytes | | Number of bytes in use by mcache structures. |
113+
| go_memstats_mcache_sys_bytes | | Number of bytes used for mcache structures obtained from system. |
114+
| go_memstats_mspan_inuse_bytes | | Number of bytes in use by mspan structures. |
115+
| go_memstats_mspan_sys_bytes | | Number of bytes used for mspan structures obtained from system. |
116+
| go_memstats_next_gc_bytes | | Number of heap bytes when next garbage collection will take place. |
117+
| go_memstats_other_sys_bytes | | Number of bytes used for other system allocations. |
118+
| go_memstats_stack_inuse_bytes | | Number of bytes in use by the stack allocator. |
119+
| go_memstats_stack_sys_bytes | | Number of bytes obtained from system for stack allocator. |
120+
| go_memstats_sys_bytes | | Number of bytes obtained from system. |
121+
| go_threads | | Number of OS threads created. |
122+
| promhttp_metric_handler_requests_in_flight | | Current number of scrapes being served. |
123+
| promhttp_metric_handler_requests_total | `code` | Total number of scrapes by HTTP status code. |
124124

125125
</details>
126126

@@ -172,25 +172,25 @@ Prometheus RDS exporter</br>
172172

173173
Configuration could be defined in [prometheus-rds-exporter.yaml](https://github.com/qonto/prometheus-rds-exporter/blob/main/configs/prometheus-rds-exporter/prometheus-rds-exporter.yaml) or environment variables (format `PROMETHEUS_RDS_EXPORTER_<PARAMETER_NAME>`).
174174

175-
| Parameter | Description | Default |
176-
|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------|
177-
| aws-assume-role-arn | AWS IAM ARN role to assume to fetch metrics | |
178-
| aws-assume-role-session | AWS assume role session name | prometheus-rds-exporter |
179-
| collect-instance-metrics | Collect AWS instances metrics (AWS Cloudwatch API) | true |
180-
| collect-instance-tags | Collect AWS RDS tags | true |
181-
| collect-instance-types | Collect AWS instance types information (AWS EC2 API) | true |
182-
| collect-logs-size | Collect AWS instances logs size (AWS RDS API) | true |
183-
| collect-maintenances | Collect AWS instances maintenances (AWS RDS API) | true |
184-
| collect-quotas | Collect AWS RDS quotas (AWS quotas API) | true |
185-
| collect-usages | Collect AWS RDS usages (AWS Cloudwatch API) | true |
186-
| tag-selections | Tags to select database instances with. See [configuration on TagFilters field](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html#resourcegrouptagging-GetResources-request-TagFilters) | |
187-
| debug | Enable debug mode | |
188-
| enable-otel-traces | Enable OpenTelemetry traces. See [configuration](https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/) | false |
189-
| listen-address | Address to listen on for web interface | :9043 |
190-
| log-format | Log format (`text` or `json`) | json |
191-
| metrics-path | Path under which to expose metrics | /metrics |
192-
| tls-cert-path | Path to TLS certificate | |
193-
| tls-key-path | Path to private key for TLS | |
175+
|Parameter | Description | Default |
176+
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
177+
| aws-assume-role-arn | AWS IAM ARN role to assume to fetch metrics | |
178+
| aws-assume-role-session | AWS assume role session name | prometheus-rds-exporter |
179+
| collect-instance-metrics | Collect AWS instances metrics (AWS Cloudwatch API) | true |
180+
| collect-instance-tags | Collect AWS RDS tags | true |
181+
| collect-instance-types | Collect AWS instance types information (AWS EC2 API) | true |
182+
| collect-logs-size | Collect AWS instances logs size (AWS RDS API) | true |
183+
| collect-maintenances | Collect AWS instances maintenances (AWS RDS API) | true |
184+
| collect-quotas | Collect AWS RDS quotas (AWS quotas API) | true |
185+
| collect-usages | Collect AWS RDS usages (AWS Cloudwatch API) | true |
186+
| tag-selections | Tags to select database instances with. Refer to [dedicated section on tag configuration](#tag-configuration) | |
187+
| debug | Enable debug mode | |
188+
| enable-otel-traces | Enable OpenTelemetry traces. See [configuration](https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/) | false |
189+
| listen-address | Address to listen on for web interface | :9043 |
190+
| log-format | Log format (`text` or `json`) | json |
191+
| metrics-path | Path under which to expose metrics | /metrics |
192+
| tls-cert-path | Path to TLS certificate | |
193+
| tls-key-path | Path to private key for TLS | |
194194

195195
Configuration parameters priorities:
196196

@@ -199,6 +199,22 @@ Configuration parameters priorities:
199199
3. Environment variables
200200
4. Command line flags
201201

202+
### Tag configuration
203+
204+
In your chart, add:
205+
206+
```yaml
207+
config:
208+
tag-selections:
209+
ExampleKey:
210+
- examplevalue
211+
```
212+
213+
_Refer to [AWS configuration on TagFilters field](https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/API_GetResources.html#resourcegrouptagging-GetResources-request-TagFilters)_
214+
215+
> [!IMPORTANT]
216+
> Tag selection cannot be setup using environment variables configuration.
217+
202218
### AWS authentication
203219
204220
Prometheus RDS exporter needs read-only AWS IAM permissions to fetch metrics from AWS RDS, CloudWatch, EC2 and ServiceQuota AWS APIs.
@@ -264,6 +280,14 @@ If you are running on [AWS EKS](https://aws.amazon.com/eks/), we strongly recomm
264280
"ec2:DescribeInstanceTypes"
265281
],
266282
"Resource": "*"
283+
},
284+
{
285+
"Sid": "AllowInstanceFilterByTags",
286+
"Effect": "Allow",
287+
"Action": [
288+
"tag:GetResources"
289+
],
290+
"Resource": "*"
267291
}
268292
]
269293
}

configs/aws/policy.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@
5959
"ec2:DescribeInstanceTypes"
6060
],
6161
"Resource": "*"
62+
},
63+
{
64+
"Sid": "AllowInstanceFilterByTag",
65+
"Effect": "Allow",
66+
"Action": [
67+
"tag:GetResources"
68+
],
69+
"Resource": "*"
6270
}
6371
]
6472
}

configs/terraform/main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,13 @@ data "aws_iam_policy_document" "prometheus-rds-exporter" {
8080
]
8181
resources = ["*"]
8282
}
83+
84+
statement {
85+
sid = "AllowInstanceFilterByTag"
86+
effect = "Allow"
87+
actions = [
88+
"tag:GetResources",
89+
]
90+
resources = ["*"]
91+
}
8392
}

0 commit comments

Comments
 (0)