mirror of https://github.com/status-im/consul.git
pre register new rpc metric, rename metric (#12582)
This commit is contained in:
parent
69c10dfcba
commit
e5ebc47a94
|
@ -92,7 +92,7 @@ func TestAgent_NewRPCMetrics(t *testing.T) {
|
|||
respRec := httptest.NewRecorder()
|
||||
recordPromMetrics(t, a, respRec)
|
||||
|
||||
assertMetricExists(t, respRec, metricsPrefix+"_rpc_server_request")
|
||||
assertMetricExists(t, respRec, metricsPrefix+"_rpc_server_call")
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/armon/go-metrics"
|
||||
"github.com/armon/go-metrics/prometheus"
|
||||
"github.com/hashicorp/consul-net-rpc/net/rpc"
|
||||
"github.com/hashicorp/go-hclog"
|
||||
)
|
||||
|
@ -19,9 +20,16 @@ import (
|
|||
// used for this historically is "RPC", so we continue to use that here.
|
||||
const RPCTypeInternal = "internal"
|
||||
|
||||
var metricRPCRequest = []string{"rpc", "server", "request"}
|
||||
var metricRPCRequest = []string{"rpc", "server", "call"}
|
||||
var requestLogName = "rpc.server.request"
|
||||
|
||||
var NewRPCCounters = []prometheus.CounterDefinition{
|
||||
{
|
||||
Name: metricRPCRequest,
|
||||
Help: "Increments when a server makes an RPC service call. The labels on the metric have more information",
|
||||
},
|
||||
}
|
||||
|
||||
type RequestRecorder struct {
|
||||
Logger hclog.Logger
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
@ -264,6 +265,7 @@ func getPrometheusDefs(cfg lib.TelemetryConfig, isServer bool) ([]prometheus.Gau
|
|||
grpc.StatsCounters,
|
||||
local.StateCounters,
|
||||
raftCounters,
|
||||
middleware.NewRPCCounters,
|
||||
}
|
||||
// Flatten definitions
|
||||
// NOTE(kit): Do we actually want to create a set here so we can ensure definition names are unique?
|
||||
|
|
Loading…
Reference in New Issue