@@ -50,6 +50,117 @@ prometheus.relabel "system_labels" {
5050 }
5151}
5252
53+ // ========== MySQL Exporter (DB 내부 지표) ==========
54+ prometheus.exporter.mysql "rds_mysql" {
55+ data_source_name = sys.env("DB_USER") + ":" + sys.env("DB_PASSWORD") + "@tcp(ddingdong-dev.c8bj0rlp6aer.ap-northeast-2.rds.amazonaws.com:3306)/"
56+ }
57+
58+ // ========== CloudWatch Exporter (RDS 리소스 지표) ==========
59+ prometheus.exporter.cloudwatch "rds_cw" {
60+ sts_region = "ap-northeast-2"
61+
62+ static "rds"{
63+ namespace = "AWS/RDS"
64+ regions = ["ap-northeast-2"]
65+
66+ dimensions = {
67+ DBInstanceIdentifier = "ddingdong-dev",
68+ }
69+
70+ metric {
71+ name = "CPUUtilization"
72+ statistics = ["Average"]
73+ period = "30s"
74+ length = "5m"
75+ }
76+
77+ metric {
78+ name = "FreeableMemory"
79+ statistics = ["Average"]
80+ period = "30s"
81+ length = "5m"
82+ }
83+
84+ metric {
85+ name = "FreeStorageSpace"
86+ statistics = ["Average"]
87+ period = "30s"
88+ length = "5m"
89+ }
90+
91+ metric {
92+ name = "DatabaseConnections"
93+ statistics = ["Average"]
94+ period = "30s"
95+ length = "5m"
96+ }
97+
98+ metric {
99+ name = "ReadIOPS"
100+ statistics = ["Average"]
101+ period = "30s"
102+ length = "5m"
103+ }
104+
105+ metric {
106+ name = "WriteIOPS"
107+ statistics = ["Average"]
108+ period = "30s"
109+ length = "5m"
110+ }
111+
112+ metric {
113+ name = "ReadLatency"
114+ statistics = ["Average"]
115+ period = "30s"
116+ length = "5m"
117+ }
118+
119+ metric {
120+ name = "WriteLatency"
121+ statistics = ["Average"]
122+ period = "30s"
123+ length = "5m"
124+ }
125+
126+ metric {
127+ name = "ReplicaLag"
128+ statistics = ["Average"]
129+ period = "30s"
130+ length = "5m"
131+ }
132+
133+ // ===== 추가된 Throughput 메트릭 =====
134+ metric {
135+ name = "ReadThroughput"
136+ statistics = ["Average"]
137+ period = "30s"
138+ length = "5m"
139+ }
140+
141+ metric {
142+ name = "WriteThroughput"
143+ statistics = ["Average"]
144+ period = "30s"
145+ length = "5m"
146+ }
147+ }
148+ }
149+
150+ prometheus.scrape "mysql_scrape" {
151+ targets = prometheus.exporter.mysql.rds_mysql.targets
152+ scrape_interval = "30s"
153+ scrape_timeout = "10s"
154+ forward_to = [prometheus.remote_write.central.receiver]
155+ }
156+
157+ // CloudWatch 스크래핑
158+ prometheus.scrape "cloudwatch_scrape" {
159+ targets = prometheus.exporter.cloudwatch.rds_cw.targets
160+ scrape_interval = "60s"
161+ scrape_timeout = "30s"
162+ forward_to = [prometheus.remote_write.central.receiver]
163+ }
53164
54165prometheus.remote_write "central" {
55166 endpoint {
@@ -69,3 +180,21 @@ prometheus.remote_write "central" {
69180 max_keepalive_time = "8h"
70181 }
71182}
183+
184+ otelcol.receiver.otlp "default" {
185+ grpc {
186+ endpoint = "0.0.0.0:4317"
187+ }
188+ output {
189+ traces = [otelcol.exporter.otlphttp.tempo.input]
190+ }
191+ }
192+
193+ otelcol.exporter.otlphttp "tempo" {
194+ client {
195+ endpoint = "http://3.39.151.102:4317/tempo/otlp"
196+ tls {
197+ insecure = true
198+ }
199+ }
200+ }
0 commit comments