Skip to content

Commit 76b02e4

Browse files
authored
Ecs observer - Add Relabel Config to Prometheus Receiver Translator (#1828)
Add Relabel Config to the Prometheus Receiver Translator when ECS Observer is enabled. The purpose of this change is to modify the Prometheus File-based service discovery labels collected by OTel ECS Observer to maintain parity with the existing EcsServicediscovery telegraf plugin Authored-by: Akansha Agarwal <agarakan@users.noreply.github.com>
1 parent e2d47d2 commit 76b02e4

6 files changed

Lines changed: 978 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[agent]
2+
collection_jitter = "0s"
3+
debug = false
4+
flush_interval = "1s"
5+
flush_jitter = "0s"
6+
hostname = ""
7+
interval = "60s"
8+
logfile = "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
9+
logtarget = "lumberjack"
10+
metric_batch_size = 1000
11+
metric_buffer_limit = 10000
12+
omit_hostname = false
13+
precision = ""
14+
quiet = false
15+
round_interval = false
16+
17+
[outputs]
18+
19+
[[outputs.cloudwatch]]
20+
21+
[[outputs.cloudwatchlogs]]
22+
endpoint_override = "https://fake_endpoint"
23+
force_flush_interval = "30s"
24+
log_stream_name = "i-UNKNOWN"
25+
mode = "EC2"
26+
region = "us-west-2"
27+
region_type = "ACJ"
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
{
2+
"agent": {
3+
"region": "us-west-2"
4+
},
5+
"metrics": {
6+
"metrics_destinations": {
7+
"cloudwatch": {},
8+
"amp": {
9+
"workspace_id": "ws-12345"
10+
}
11+
},
12+
"metrics_collected": {
13+
"prometheus": {
14+
"prometheus_config_path": "{prometheusFileName}"
15+
}
16+
}
17+
},
18+
"logs": {
19+
"metrics_collected": {
20+
"prometheus": {
21+
"cluster_name": "TestCluster",
22+
"log_group_name": "/aws/ecs/containerinsights/TestCluster/prometheus",
23+
"prometheus_config_path": "{prometheusFileName}",
24+
"ecs_service_discovery": {
25+
"docker_label": {
26+
"sd_job_name_label": "ECS_PROMETHEUS_JOB_NAME_1",
27+
"sd_metrics_path_label": "ECS_PROMETHEUS_METRICS_PATH",
28+
"sd_port_label": "ECS_PROMETHEUS_EXPORTER_PORT_SUBSET"
29+
},
30+
"task_definition_list": [
31+
{
32+
"sd_job_name": "task_def_1",
33+
"sd_metrics_path": "/stats/metrics",
34+
"sd_metrics_ports": "9901",
35+
"sd_task_definition_arn_pattern": ".*task_def_1:[0-9]+"
36+
},
37+
{
38+
"sd_container_name_pattern": "^envoy$",
39+
"sd_metrics_ports": "9902",
40+
"sd_task_definition_arn_pattern": "task_def_2"
41+
}
42+
],
43+
"service_name_list_for_tasks": [
44+
{
45+
"sd_job_name": "service_name_1",
46+
"sd_metrics_path": "/metrics",
47+
"sd_metrics_ports": "9113",
48+
"sd_service_name_pattern": ".*-application-stack",
49+
"sd_container_name_pattern": "nginx-prometheus-exporter"
50+
},
51+
{
52+
"sd_metrics_path":"/stats/metrics",
53+
"sd_metrics_ports": "9114",
54+
"sd_service_name_pattern": "run-application-stack"
55+
}
56+
],
57+
"sd_cluster_region": "us-west-2",
58+
"sd_frequency": "1m",
59+
"sd_result_file": "{ecsSdFileName}",
60+
"sd_target_cluster": "ecs-cluster-a"
61+
},
62+
"emf_processor": {
63+
"metric_declaration_dedup": true,
64+
"metric_namespace": "CustomizedNamespace",
65+
"metric_unit": {
66+
"nginx_request_count": "Count"
67+
},
68+
"metric_declaration": [
69+
{
70+
"dimensions": [["Service"]],
71+
"label_matcher": "nginx.*",
72+
"label_separator": ";",
73+
"metric_selectors": ["^nginx_request_count$"],
74+
"source_labels": ["Service"]
75+
},
76+
{
77+
"label_matcher": "default",
78+
"metric_selectors": [".*"],
79+
"source_labels": ["Namespace"]
80+
},
81+
{
82+
"source_labels":["name"],
83+
"dimensions":[
84+
["name"]
85+
],
86+
"metric_selectors": ["^.*$"]
87+
},
88+
{
89+
"source_labels":["name"],
90+
"dimensions":[
91+
["name"]
92+
],
93+
"metric_selectors": ["^node_cpu_guest_seconds_total$"]
94+
}
95+
]
96+
}
97+
}
98+
},
99+
"force_flush_interval": 30,
100+
"endpoint_override":"https://fake_endpoint"
101+
}
102+
}

0 commit comments

Comments
 (0)