-
Notifications
You must be signed in to change notification settings - Fork 1
/
amp-ecs.config.yaml
110 lines (103 loc) · 3.23 KB
/
amp-ecs.config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
grafana_iam_policies:
amplist:
action:
- "aps:ListWorkspaces"
ampread:
action:
- "aps:DescribeWorkspace"
- "aps:QueryMetrics"
- "aps:GetLabels"
- "aps:GetSeries"
- "aps:GetMetricMetadata"
resource:
- Ref: APSWorkspace
aot_ecs_observer:
docker_labels:
- port_label: ECS_PROMETHEUS_EXPORTER_PORT
- port_label: ECS_PROMETHEUS_EXPORTER_PORT_V2
metrics_path_label: ECS_PROMETHEUS_EXPORTER_METRICS_PATH
default_aot_config_content:
extensions:
sigv4auth:
service: "aps"
region: "${AWS::Region}"
ecs_observer:
refresh_interval: 60s # format is https://golang.org/pkg/time/#ParseDuration
cluster_name: '${EnvironmentName}-services' # cluster name need manual config
cluster_region: '${AWS::Region}' # region can be configured directly or use AWS_REGION env var
result_file: '/etc/ecs_sd_targets.yaml' # the directory for file must already exists
receivers:
prometheus:
config:
scrape_configs:
- job_name: "ecssd"
file_sd_configs:
- files:
- '/etc/ecs_sd_targets.yaml'
relabel_configs:
- source_labels: [ __meta_ecs_cluster_name ] # ClusterName
action: replace
target_label: ClusterName
- source_labels: [ __meta_ecs_service_name ] # ServiceName
action: replace
target_label: ServiceName
- source_labels: [ __meta_ecs_task_definition_family ] # TaskDefinitionFamily
action: replace
target_label: TaskDefinitionFamily
- source_labels: [ __meta_ecs_container_name ] # container_name
action: replace
target_label: container_name
- action: labelmap # docker labels
regex: ^__meta_ecs_container_labels_(.+)$
replacement: '$$1'
processors:
batch: {}
exporters:
prometheusremotewrite:
endpoint: ${APSWorkspace.PrometheusEndpoint}api/v1/remote_write
auth:
authenticator: sigv4auth
logging:
loglevel: info
service:
extensions: [ ecs_observer, sigv4auth ]
pipelines:
metrics:
receivers: [ prometheus ]
processors: [ batch ]
exporters: [ prometheusremotewrite ]
components:
exporter:
config:
platform_version: '1.4.0'
cpu:
Ref: Cpu
memory:
Ref: Memory
task_definition:
otelexport:
repo: ghcr.io
image: base2services/aws-ecs-otel-collector
tag: v0.41.0
env_vars:
ENVIRONMENT_NAME:
Fn::Sub: ${EnvironmentName}
AWS_REGION:
Fn::Sub: ${AWS::Region}
secrets:
ssm:
AOT_CONFIG_CONTENT: /${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT
iam_policies:
ecsscan:
action:
- ecs:ListTasks
- ecs:ListServices
- ecs:DescribeContainerInstances
- ecs:DescribeServices
- ecs:DescribeTasks
- ecs:DescribeTaskDefinition
ampwrite:
action:
- aps:RemoteWrite
resource:
- Ref: APSWorkspace