fix bad oss sync, use gauges not counters (#12611)
This commit is contained in:
parent
d9f31345e0
commit
560f8cbc89
|
@ -94,30 +94,6 @@ func TestAgent_NewRPCMetrics(t *testing.T) {
|
|||
|
||||
assertMetricExists(t, respRec, metricsPrefix+"_rpc_server_call")
|
||||
})
|
||||
|
||||
t.Run("Check that new rpc metrics can be filtered out", func(t *testing.T) {
|
||||
metricsPrefix := "new_rpc_metrics_2"
|
||||
hcl := fmt.Sprintf(`
|
||||
telemetry = {
|
||||
prometheus_retention_time = "5s"
|
||||
disable_hostname = true
|
||||
metrics_prefix = "%s"
|
||||
prefix_filter = ["-%s.rpc.server.call"]
|
||||
}
|
||||
`, metricsPrefix, metricsPrefix)
|
||||
|
||||
a := StartTestAgent(t, TestAgent{HCL: hcl})
|
||||
defer a.Shutdown()
|
||||
|
||||
var out struct{}
|
||||
err := a.RPC("Status.Ping", struct{}{}, &out)
|
||||
require.NoError(t, err)
|
||||
|
||||
respRec := httptest.NewRecorder()
|
||||
recordPromMetrics(t, a, respRec)
|
||||
|
||||
assertMetricNotExists(t, respRec, metricsPrefix+"_rpc_server_call")
|
||||
})
|
||||
}
|
||||
|
||||
// TestHTTPHandlers_AgentMetrics_ConsulAutopilot_Prometheus adds testing around
|
||||
|
|
|
@ -24,7 +24,7 @@ const RPCTypeNetRPC = "net/rpc"
|
|||
var metricRPCRequest = []string{"rpc", "server", "call"}
|
||||
var requestLogName = "rpc.server.request"
|
||||
|
||||
var NewRPCCounters = []prometheus.CounterDefinition{
|
||||
var NewRPCGauges = []prometheus.GaugeDefinition{
|
||||
{
|
||||
Name: metricRPCRequest,
|
||||
Help: "Increments when a server makes an RPC service call. The labels on the metric have more information",
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/hashicorp/consul/agent/local"
|
||||
"github.com/hashicorp/consul/agent/pool"
|
||||
"github.com/hashicorp/consul/agent/router"
|
||||
"github.com/hashicorp/consul/agent/rpc/middleware"
|
||||
"github.com/hashicorp/consul/agent/submatview"
|
||||
"github.com/hashicorp/consul/agent/token"
|
||||
"github.com/hashicorp/consul/agent/xds"
|
||||
|
@ -214,6 +215,7 @@ func getPrometheusDefs(cfg lib.TelemetryConfig, isServer bool) ([]prometheus.Gau
|
|||
CertExpirationGauges,
|
||||
Gauges,
|
||||
raftGauges,
|
||||
middleware.NewRPCGauges,
|
||||
}
|
||||
|
||||
// TODO(ffmmm): conditionally add only leader specific metrics to gauges, counters, summaries, etc
|
||||
|
|
Loading…
Reference in New Issue