52
52
}, []string {"datasource_type" , "secure_socks_ds_proxy_enabled" , "endpoint" },
53
53
)
54
54
55
+ datasourceResponseGauge = promauto .NewGaugeVec (
56
+ prometheus.GaugeOpts {
57
+ Namespace : "plugins" ,
58
+ Name : "datasource_response_size" ,
59
+ Help : "gauge of data source response sizes returned to Grafana in bytes" ,
60
+ }, []string {"datasource_type" , "secure_socks_ds_proxy_enabled" , "endpoint" },
61
+ )
62
+
55
63
datasourceRequestsInFlight = promauto .NewGaugeVec (
56
64
prometheus.GaugeOpts {
57
65
Namespace : "plugins" ,
@@ -128,6 +136,7 @@ func executeMiddleware(next http.RoundTripper, datasourceType string, secureSock
128
136
requestHistogram := datasourceRequestHistogram .MustCurryWith (labels )
129
137
requestInFlight := datasourceRequestsInFlight .With (labels )
130
138
responseSizeHistogram := datasourceResponseHistogram .With (labels )
139
+ responseSizeGauge := datasourceResponseGauge .With (labels )
131
140
132
141
res , err := promhttp .InstrumentRoundTripperDuration (requestHistogram ,
133
142
promhttp .InstrumentRoundTripperCounter (requestCounter ,
@@ -140,6 +149,7 @@ func executeMiddleware(next http.RoundTripper, datasourceType string, secureSock
140
149
if res != nil && res .StatusCode != http .StatusSwitchingProtocols {
141
150
res .Body = CountBytesReader (res .Body , func (bytesRead int64 ) {
142
151
responseSizeHistogram .Observe (float64 (bytesRead ))
152
+ responseSizeGauge .Set (float64 (bytesRead ))
143
153
})
144
154
}
145
155
0 commit comments