mirror of
https://github.com/storytold/terraform-aws-observability-accelerator.git
synced 2026-10-09 00:09:43 +00:00
Extend configuration for customMetrics (#202)
This commit is contained in:
+8
-5
@@ -170,11 +170,14 @@ In the module `module "workloads_infra" {` add the following config (make sure t
|
|||||||
enable_custom_metrics = true
|
enable_custom_metrics = true
|
||||||
|
|
||||||
custom_metrics_config = {
|
custom_metrics_config = {
|
||||||
# list of applications ports (example)
|
custom_app_1 = {
|
||||||
ports = [8000, 8080]
|
enableBasicAuth = true
|
||||||
|
path = "/metrics"
|
||||||
# list of series prefixes you want to discard from ingestion
|
basicAuthUsername = "username"
|
||||||
dropped_series_prefixes = ["go_gcc"]
|
basicAuthPassword = "password"
|
||||||
|
ports = ".*:(8080)$"
|
||||||
|
droppedSeriesPrefixes = "(unspecified.*)$"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this
|
|||||||
| Name | Description | Type | Default | Required |
|
| Name | Description | Type | Default | Required |
|
||||||
|------|-------------|------|---------|:--------:|
|
|------|-------------|------|---------|:--------:|
|
||||||
| <a name="input_adot_loglevel"></a> [adot\_loglevel](#input\_adot\_loglevel) | Verbosity level for ADOT collector logs | `string` | `"warn"` | no |
|
| <a name="input_adot_loglevel"></a> [adot\_loglevel](#input\_adot\_loglevel) | Verbosity level for ADOT collector logs | `string` | `"warn"` | no |
|
||||||
| <a name="input_custom_metrics_config"></a> [custom\_metrics\_config](#input\_custom\_metrics\_config) | Configuration object to enable custom metrics collection | <pre>object({<br> ports = list(number)<br> # paths = optional(list(string), ["/metrics"])<br> # list of samples to be dropped by label prefix, ex: go_ -> discards go_.*<br> dropped_series_prefixes = list(string)<br> })</pre> | <pre>{<br> "dropped_series_prefixes": [<br> "unspecified"<br> ],<br> "ports": []<br>}</pre> | no |
|
| <a name="input_custom_metrics_config"></a> [custom\_metrics\_config](#input\_custom\_metrics\_config) | Configuration object to enable custom metrics collection | <pre>map(object({<br> enableBasicAuth = bool<br> path = string<br> basicAuthUsername = string<br> basicAuthPassword = string<br> ports = string<br> droppedSeriesPrefixes = string<br> }))</pre> | `null` | no |
|
||||||
| <a name="input_eks_cluster_id"></a> [eks\_cluster\_id](#input\_eks\_cluster\_id) | EKS Cluster Id | `string` | n/a | yes |
|
| <a name="input_eks_cluster_id"></a> [eks\_cluster\_id](#input\_eks\_cluster\_id) | EKS Cluster Id | `string` | n/a | yes |
|
||||||
| <a name="input_enable_alerting_rules"></a> [enable\_alerting\_rules](#input\_enable\_alerting\_rules) | Enables or disables Managed Prometheus alerting rules | `bool` | `true` | no |
|
| <a name="input_enable_alerting_rules"></a> [enable\_alerting\_rules](#input\_enable\_alerting\_rules) | Enables or disables Managed Prometheus alerting rules | `bool` | `true` | no |
|
||||||
| <a name="input_enable_amazon_eks_adot"></a> [enable\_amazon\_eks\_adot](#input\_enable\_amazon\_eks\_adot) | Enables the ADOT Operator on the EKS Cluster | `bool` | `true` | no |
|
| <a name="input_enable_amazon_eks_adot"></a> [enable\_amazon\_eks\_adot](#input\_enable\_amazon\_eks\_adot) | Enables the ADOT Operator on the EKS Cluster | `bool` | `true` | no |
|
||||||
|
|||||||
@@ -138,12 +138,8 @@ module "helm_addon" {
|
|||||||
value = var.enable_custom_metrics
|
value = var.enable_custom_metrics
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "customMetricsPorts"
|
name = "custom_metrics"
|
||||||
value = format(".*:(%s)$", join("|", var.custom_metrics_config.ports))
|
value = yamlencode(var.custom_metrics_config)
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "customMetricsDroppedSeriesPrefixes"
|
|
||||||
value = format("(%s.*)$", join(".*|", var.custom_metrics_config.dropped_series_prefixes))
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name = "enableJava"
|
name = "enableJava"
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ apiVersion: v2
|
|||||||
name: opentelemetry
|
name: opentelemetry
|
||||||
description: A Helm chart to install otel operator
|
description: A Helm chart to install otel operator
|
||||||
type: application
|
type: application
|
||||||
version: 0.6.0
|
version: 0.7.0
|
||||||
appVersion: 0.6.0
|
appVersion: 0.7.0
|
||||||
|
|||||||
@@ -1464,13 +1464,21 @@ spec:
|
|||||||
regex: $K8S_NODE_NAME
|
regex: $K8S_NODE_NAME
|
||||||
source_labels: [__meta_kubernetes_endpoint_node_name]
|
source_labels: [__meta_kubernetes_endpoint_node_name]
|
||||||
{{ end }}
|
{{ end }}
|
||||||
- job_name: "custom-metrics"
|
{{ if .Values.enableCustomMetrics }}
|
||||||
|
{{- range $k, $v := fromYaml .Values.customMetrics }}
|
||||||
|
- job_name: "{{ $k }}"
|
||||||
kubernetes_sd_configs:
|
kubernetes_sd_configs:
|
||||||
- role: pod
|
- role: pod
|
||||||
|
metrics_path: '{{ $v.path }}'
|
||||||
|
{{ if $v.enableBasicAuth }}
|
||||||
|
basic_auth:
|
||||||
|
username: '{{ $v.basicAuthUsername }}'
|
||||||
|
password: '{{ $v.basicAuthPassword }}'
|
||||||
|
{{ end }}
|
||||||
relabel_configs:
|
relabel_configs:
|
||||||
- source_labels: [ __address__ ]
|
- source_labels: [ __address__ ]
|
||||||
action: keep
|
action: keep
|
||||||
regex: '{{ .Values.customMetricsPorts }}'
|
regex: '{{ $v.ports }}'
|
||||||
- action: replace
|
- action: replace
|
||||||
source_labels: [__meta_kubernetes_pod_node_name]
|
source_labels: [__meta_kubernetes_pod_node_name]
|
||||||
target_label: nodename
|
target_label: nodename
|
||||||
@@ -1486,16 +1494,17 @@ spec:
|
|||||||
- action: replace
|
- action: replace
|
||||||
source_labels: [__meta_kubernetes_pod_controller_kind]
|
source_labels: [__meta_kubernetes_pod_controller_kind]
|
||||||
target_label: pod_controller_kind
|
target_label: pod_controller_kind
|
||||||
{{ if .Values.enableTracing }}
|
{{ if $.Values.enableTracing }}
|
||||||
- action: keep
|
- action: keep
|
||||||
regex: $K8S_NODE_NAME
|
regex: $K8S_NODE_NAME
|
||||||
source_labels: [__meta_kubernetes_pod_node_name]
|
source_labels: [__meta_kubernetes_pod_node_name]
|
||||||
{{ end }}
|
{{ end }}
|
||||||
metric_relabel_configs:
|
metric_relabel_configs:
|
||||||
- source_labels: [ __name__ ]
|
- source_labels: [ __name__ ]
|
||||||
regex: '{{ .Values.customMetricsDroppedSeriesPrefixes }}'
|
regex: '{{ $v.droppedSeriesPrefixes }}'
|
||||||
action: drop
|
action: drop
|
||||||
|
{{- end }}
|
||||||
|
{{ end }}
|
||||||
{{ if .Values.enableJava }}
|
{{ if .Values.enableJava }}
|
||||||
- job_name: 'kubernetes-java-jmx'
|
- job_name: 'kubernetes-java-jmx'
|
||||||
sample_limit: {{ .Values.javaScrapeSampleLimit }}
|
sample_limit: {{ .Values.javaScrapeSampleLimit }}
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ tracingTimeout: ${tracing_timeout}
|
|||||||
tracingSendBatchSize: ${tracing_send_batch_size}
|
tracingSendBatchSize: ${tracing_send_batch_size}
|
||||||
|
|
||||||
enableCustomMetrics: ${enable_custom_metrics}
|
enableCustomMetrics: ${enable_custom_metrics}
|
||||||
customMetricsPorts: ${custom_metrics_ports}
|
customMetrics: ${custom_metrics}
|
||||||
customMetricsDroppedSeriesPrefixes: ${custom_metrics_dropped_series_prefixes}
|
|
||||||
|
|
||||||
enableJava: ${enable_java}
|
enableJava: ${enable_java}
|
||||||
javaScrapeSampleLimit: ${java_scrape_sample_limit}
|
javaScrapeSampleLimit: ${java_scrape_sample_limit}
|
||||||
|
|||||||
@@ -232,17 +232,16 @@ variable "enable_custom_metrics" {
|
|||||||
|
|
||||||
variable "custom_metrics_config" {
|
variable "custom_metrics_config" {
|
||||||
description = "Configuration object to enable custom metrics collection"
|
description = "Configuration object to enable custom metrics collection"
|
||||||
type = object({
|
type = map(object({
|
||||||
ports = list(number)
|
enableBasicAuth = bool
|
||||||
# paths = optional(list(string), ["/metrics"])
|
path = string
|
||||||
# list of samples to be dropped by label prefix, ex: go_ -> discards go_.*
|
basicAuthUsername = string
|
||||||
dropped_series_prefixes = list(string)
|
basicAuthPassword = string
|
||||||
})
|
ports = string
|
||||||
|
droppedSeriesPrefixes = string
|
||||||
|
}))
|
||||||
|
|
||||||
default = {
|
default = null
|
||||||
ports = []
|
|
||||||
dropped_series_prefixes = ["unspecified"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "enable_java" {
|
variable "enable_java" {
|
||||||
|
|||||||
Reference in New Issue
Block a user