Skip to content

Commit e932b67

Browse files
authored
fix: enable native histogram metrics for all deployments (#372)
1 parent 2cfcd30 commit e932b67

File tree

8 files changed

+72
-12
lines changed

8 files changed

+72
-12
lines changed

compose.grafana-local-stack.microservices.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,16 @@ services:
164164
- "3100:3100"
165165

166166
prometheus:
167-
image: prom/prometheus:v3.2.1
167+
image: prom/prometheus:v3.9.1
168168
container_name: prometheus
169169
labels:
170170
- "service.type=instrumentation"
171+
volumes:
172+
- ./deployments/docker-compose/grafana-local-stack/prometheus.yaml:/etc/prometheus.yaml
171173
command:
172174
- --web.enable-remote-write-receiver
173175
- --enable-feature=exemplar-storage
174-
- --enable-feature=native-histograms
175-
- --config.file=/etc/prometheus/prometheus.yml
176+
- --config.file=/etc/prometheus.yaml
176177
ports:
177178
- "9090:9090"
178179

compose.grafana-local-stack.monolithic.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,16 @@ services:
8787
- "3100:3100"
8888

8989
prometheus:
90-
image: prom/prometheus:v3.2.1
90+
image: prom/prometheus:v3.9.1
9191
container_name: prometheus
9292
labels:
9393
- "service.type=instrumentation"
94+
volumes:
95+
- ./deployments/docker-compose/grafana-local-stack/prometheus.yaml:/etc/prometheus.yaml
9496
command:
9597
- --web.enable-remote-write-receiver
9698
- --enable-feature=exemplar-storage
97-
- --enable-feature=native-histograms
98-
- --config.file=/etc/prometheus/prometheus.yml
99+
- --config.file=/etc/prometheus.yaml
99100
ports:
100101
- "9090:9090"
101102

deployments/docker-compose/grafana-cloud/config.alloy

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,24 @@ discovery.relabel "app_containers" {
7171
targets = discovery.docker.all_containers.targets
7272
}
7373

74-
// Metrics
74+
// Use explicit remote_write to enable native histograms
75+
// (grafana_cloud.stack.receivers.metrics doesn't support send_native_histograms )
76+
prometheus.remote_write "grafana_cloud" {
77+
endpoint {
78+
url = grafana_cloud.stack.receivers.info["hmInstancePromUrl"] + "/api/prom/push"
79+
basic_auth {
80+
username = grafana_cloud.stack.receivers.info["hmInstancePromId"]
81+
password = env("GRAFANA_CLOUD_TOKEN")
82+
}
83+
send_native_histograms = true
84+
}
85+
}
86+
7587
prometheus.scrape "app_containers" {
7688
scrape_interval = "10s"
89+
scrape_native_histograms = true
7790
targets = concat(discovery.relabel.app_containers.output, discovery.relabel.database_observability_postgres_quickpizza.output)
78-
forward_to = [grafana_cloud.stack.receivers.metrics]
91+
forward_to = [prometheus.remote_write.grafana_cloud.receiver]
7992
}
8093
// Logs
8194
loki.source.docker "app_containers" {

deployments/docker-compose/grafana-local-stack/config.alloy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ prometheus.remote_write "local" {
9999
}
100100
prometheus.scrape "app_containers" {
101101
scrape_interval = "10s"
102+
scrape_native_histograms = true
102103
targets = concat(discovery.relabel.app_containers.output, discovery.relabel.postgres.output)
103104
forward_to = [prometheus.remote_write.local.receiver]
104105
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
global:
3+
scrape_native_histograms: true
4+
storage:
5+
tsdb:
6+
out_of_order_time_window: 10m

deployments/kubernetes/cloud-testing/config/config.alloy

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,23 @@ discovery.relabel "application_pods" {
6161
targets = discovery.kubernetes.application_pods.targets
6262
}
6363

64+
// Use explicit remote_write to enable native histograms
65+
// (grafana_cloud.stack.receivers.metrics doesn't support send_native_histograms )
66+
prometheus.remote_write "grafana_cloud" {
67+
endpoint {
68+
url = grafana_cloud.stack.receivers.info["hmInstancePromUrl"] + "/api/prom/push"
69+
basic_auth {
70+
username = grafana_cloud.stack.receivers.info["hmInstancePromId"]
71+
password = env("GRAFANA_CLOUD_TOKEN")
72+
}
73+
send_native_histograms = true
74+
}
75+
}
6476
// Metrics: application pods
6577
prometheus.scrape "application_pods" {
6678
scrape_interval = "10s"
67-
forward_to = [grafana_cloud.stack.receivers.metrics]
79+
scrape_native_histograms = true
80+
forward_to = [prometheus.remote_write.grafana_cloud.receiver]
6881
targets = discovery.relabel.application_pods.output
6982
}
7083

deployments/kubernetes/cloud/config/config.alloy

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,23 @@ discovery.relabel "application_pods" {
6767
targets = discovery.kubernetes.application_pods.targets
6868
}
6969

70-
70+
// Use explicit remote_write to enable native histograms
71+
// (grafana_cloud.stack.receivers.metrics doesn't support send_native_histograms )
72+
prometheus.remote_write "grafana_cloud" {
73+
endpoint {
74+
url = grafana_cloud.stack.receivers.info["hmInstancePromUrl"] + "/api/prom/push"
75+
basic_auth {
76+
username = grafana_cloud.stack.receivers.info["hmInstancePromId"]
77+
password = env("GRAFANA_CLOUD_TOKEN")
78+
}
79+
send_native_histograms = true
80+
}
81+
}
7182
// Metrics: application pods
7283
prometheus.scrape "application_pods" {
7384
scrape_interval = "10s"
74-
forward_to = [grafana_cloud.stack.receivers.metrics]
85+
scrape_native_histograms = true
86+
forward_to = [prometheus.remote_write.grafana_cloud.receiver]
7587
targets = discovery.relabel.application_pods.output
7688
}
7789

deployments/terraform/alloy/config.alloy

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,25 @@ discovery.relabel "application_pods" {
8080
targets = discovery.kubernetes.application_pods.targets
8181
}
8282

83+
// Use explicit remote_write to enable native histograms
84+
// (grafana_cloud.stack.receivers.metrics doesn't support send_native_histograms )
85+
prometheus.remote_write "grafana_cloud" {
86+
endpoint {
87+
url = grafana_cloud.stack.receivers.info["hmInstancePromUrl"] + "/api/prom/push"
88+
basic_auth {
89+
username = grafana_cloud.stack.receivers.info["hmInstancePromId"]
90+
password = env("GRAFANA_CLOUD_TOKEN")
91+
}
92+
send_native_histograms = true
93+
}
94+
}
8395

8496
// Metrics: application pods
8597
prometheus.scrape "application_pods" {
8698
scrape_interval = "10s"
99+
scrape_native_histograms = true
100+
forward_to = [prometheus.remote_write.grafana_cloud.receiver]
87101
targets = concat(discovery.relabel.application_pods.output, discovery.relabel.database_observability_postgres_quickpizza.output)
88-
forward_to = [grafana_cloud.stack.receivers.metrics]
89102
}
90103

91104
// Logs: application pods

0 commit comments

Comments
 (0)