Skip to content

Commit 3979910

Browse files
authored
Fix: collector failing to scrape targets (#174)
* Move external labels to resource attributes * Avoid DDoS with using 0.0.0.0 * Pre-commit
1 parent 9b6b234 commit 3979910

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

modules/eks-monitoring/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ See examples using this Terraform modules in the **Amazon EKS** section of [this
113113
| <a name="input_tags"></a> [tags](#input\_tags) | Additional tags (e.g. `map('BusinessUnit`,`XYZ`) | `map(string)` | `{}` | no |
114114
| <a name="input_target_secret_name"></a> [target\_secret\_name](#input\_target\_secret\_name) | Target secret in Kubernetes to store the Grafana API Key Secret | `string` | `"grafana-admin-credentials"` | no |
115115
| <a name="input_target_secret_namespace"></a> [target\_secret\_namespace](#input\_target\_secret\_namespace) | Target namespace of secret in Kubernetes to store the Grafana API Key Secret | `string` | `"grafana-operator"` | no |
116-
| <a name="input_tracing_config"></a> [tracing\_config](#input\_tracing\_config) | Configuration object for traces collection to AWS X-Ray | <pre>object({<br> otlp_grpc_endpoint = string<br> otlp_http_endpoint = string<br> send_batch_size = number<br> timeout = string<br> })</pre> | <pre>{<br> "otlp_grpc_endpoint": "0.0.0.0:4317",<br> "otlp_http_endpoint": "0.0.0.0:4318",<br> "send_batch_size": 50,<br> "timeout": "30s"<br>}</pre> | no |
116+
| <a name="input_tracing_config"></a> [tracing\_config](#input\_tracing\_config) | Configuration object for traces collection to AWS X-Ray | <pre>object({<br> otlp_grpc_endpoint = string<br> otlp_http_endpoint = string<br> send_batch_size = number<br> timeout = string<br> })</pre> | <pre>{<br> "otlp_grpc_endpoint": "localhost:4317",<br> "otlp_http_endpoint": "localhost:4318",<br> "send_batch_size": 50,<br> "timeout": "30s"<br>}</pre> | no |
117117

118118
## Outputs
119119

modules/eks-monitoring/otel-config/templates/opentelemetrycollector.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ spec:
3636
global:
3737
scrape_interval: {{ .Values.globalScrapeInterval }}
3838
scrape_timeout: {{ .Values.globalScrapeTimeout }}
39-
external_labels:
40-
cluster: {{ .Values.ekscluster }}
41-
region: {{ .Values.region }}
4239
scrape_configs:
4340
- job_name: 'kubernetes-kubelet'
4441
scrape_interval: {{ .Values.globalScrapeInterval }}
@@ -1775,6 +1772,8 @@ spec:
17751772
endpoint: {{ .Values.ampurl }}
17761773
auth:
17771774
authenticator: sigv4auth
1775+
resource_to_telemetry_conversion:
1776+
enabled: true
17781777
logging:
17791778
loglevel: warn
17801779
extensions:
@@ -1790,6 +1789,17 @@ spec:
17901789
batch/metrics:
17911790
timeout: 30s
17921791
send_batch_size: 500
1792+
attributes/metrics:
1793+
actions:
1794+
- key: cluster
1795+
action: upsert
1796+
value: {{ .Values.ekscluster }}
1797+
- key: region
1798+
action: upsert
1799+
value: {{ .Values.region }}
1800+
- key: account_id
1801+
action: upsert
1802+
value: {{ .Values.accountId }}
17931803
{{ if .Values.enableTracing }}
17941804
batch/traces:
17951805
timeout: {{ .Values.tracingTimeout }}
@@ -1800,7 +1810,7 @@ spec:
18001810
pipelines:
18011811
metrics:
18021812
receivers: [prometheus, otlp]
1803-
processors: [batch/metrics]
1813+
processors: [batch/metrics, attributes/metrics]
18041814
exporters: [logging, prometheusremotewrite]
18051815
{{ if .Values.enableTracing }}
18061816
traces:

modules/eks-monitoring/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ variable "tracing_config" {
210210
})
211211

212212
default = {
213-
otlp_grpc_endpoint = "0.0.0.0:4317"
214-
otlp_http_endpoint = "0.0.0.0:4318"
213+
otlp_grpc_endpoint = "localhost:4317"
214+
otlp_http_endpoint = "localhost:4318"
215215
send_batch_size = 50
216216
timeout = "30s"
217217
}

0 commit comments

Comments
 (0)