Datasources: Enable native histograms for datasource response size metric (#87962)

This commit is contained in:
Marcus Efraimsson 2024-05-16 13:48:51 +02:00 committed by GitHub
parent c46c0c9eb9
commit 961272a76d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View File

@ -7,6 +7,7 @@
command: > command: >
--enable-feature=remote-write-receiver --enable-feature=remote-write-receiver
--enable-feature=exemplar-storage --enable-feature=exemplar-storage
--enable-feature=native-histograms
--config.file=/etc/prometheus/prometheus.yml --config.file=/etc/prometheus/prometheus.yml
--storage.tsdb.path=/prometheus --storage.tsdb.path=/prometheus
volumes: volumes:
@ -45,7 +46,7 @@
- --server.http.listen-addr=0.0.0.0:12345 - --server.http.listen-addr=0.0.0.0:12345
- /etc/agent/config.river - /etc/agent/config.river
volumes: volumes:
- ./docker/blocks/self-instrumentation/agent.flow:/etc/agent/config.river - ./docker/blocks/self-instrumentation/agent.flow:/etc/agent/config.river
ports: ports:
- "12345:12345" - "12345:12345"
- "12347:12347" - "12347:12347"

View File

@ -4,6 +4,7 @@ global:
scrape_configs: scrape_configs:
- job_name: grafana - job_name: grafana
scrape_classic_histograms: true
static_configs: static_configs:
- targets: - targets:
- host.docker.internal:3000 - host.docker.internal:3000

View File

@ -3,6 +3,7 @@ package httpclientprovider
import ( import (
"net/http" "net/http"
"strconv" "strconv"
"time"
sdkhttpclient "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient" sdkhttpclient "github.com/grafana/grafana-plugin-sdk-go/backend/httpclient"
"github.com/grafana/grafana/pkg/infra/httpclient" "github.com/grafana/grafana/pkg/infra/httpclient"
@ -33,10 +34,13 @@ var (
datasourceResponseHistogram = promauto.NewHistogramVec( datasourceResponseHistogram = promauto.NewHistogramVec(
prometheus.HistogramOpts{ prometheus.HistogramOpts{
Namespace: "grafana", Namespace: "grafana",
Name: "datasource_response_size_bytes", Name: "datasource_response_size_bytes",
Help: "histogram of data source response sizes returned to Grafana", Help: "histogram of data source response sizes returned to Grafana",
Buckets: []float64{128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576}, Buckets: []float64{128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576},
NativeHistogramBucketFactor: 1.1,
NativeHistogramMaxBucketNumber: 100,
NativeHistogramMinResetDuration: time.Hour,
}, []string{"datasource", "datasource_type", "secure_socks_ds_proxy_enabled"}, }, []string{"datasource", "datasource_type", "secure_socks_ds_proxy_enabled"},
) )