Fix open connections metric
Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
parent
598a257ae1
commit
7c2af10bbd
17 changed files with 126 additions and 236 deletions
|
@ -24,17 +24,17 @@ const (
|
|||
metricConfigPrefix = MetricNamePrefix + "config_"
|
||||
configReloadsTotalName = metricConfigPrefix + "reloads_total"
|
||||
configLastReloadSuccessName = metricConfigPrefix + "last_reload_success"
|
||||
openConnectionsName = MetricNamePrefix + "open_connections"
|
||||
|
||||
// TLS.
|
||||
metricsTLSPrefix = MetricNamePrefix + "tls_"
|
||||
tlsCertsNotAfterTimestamp = metricsTLSPrefix + "certs_not_after"
|
||||
metricsTLSPrefix = MetricNamePrefix + "tls_"
|
||||
tlsCertsNotAfterTimestampName = metricsTLSPrefix + "certs_not_after"
|
||||
|
||||
// entry point.
|
||||
metricEntryPointPrefix = MetricNamePrefix + "entrypoint_"
|
||||
entryPointReqsTotalName = metricEntryPointPrefix + "requests_total"
|
||||
entryPointReqsTLSTotalName = metricEntryPointPrefix + "requests_tls_total"
|
||||
entryPointReqDurationName = metricEntryPointPrefix + "request_duration_seconds"
|
||||
entryPointOpenConnsName = metricEntryPointPrefix + "open_connections"
|
||||
entryPointReqsBytesTotalName = metricEntryPointPrefix + "requests_bytes_total"
|
||||
entryPointRespsBytesTotalName = metricEntryPointPrefix + "responses_bytes_total"
|
||||
|
||||
|
@ -43,7 +43,6 @@ const (
|
|||
routerReqsTotalName = metricRouterPrefix + "requests_total"
|
||||
routerReqsTLSTotalName = metricRouterPrefix + "requests_tls_total"
|
||||
routerReqDurationName = metricRouterPrefix + "request_duration_seconds"
|
||||
routerOpenConnsName = metricRouterPrefix + "open_connections"
|
||||
routerReqsBytesTotalName = metricRouterPrefix + "requests_bytes_total"
|
||||
routerRespsBytesTotalName = metricRouterPrefix + "responses_bytes_total"
|
||||
|
||||
|
@ -52,7 +51,6 @@ const (
|
|||
serviceReqsTotalName = metricServicePrefix + "requests_total"
|
||||
serviceReqsTLSTotalName = metricServicePrefix + "requests_tls_total"
|
||||
serviceReqDurationName = metricServicePrefix + "request_duration_seconds"
|
||||
serviceOpenConnsName = metricServicePrefix + "open_connections"
|
||||
serviceRetriesTotalName = metricServicePrefix + "retries_total"
|
||||
serviceServerUpName = metricServicePrefix + "server_up"
|
||||
serviceReqsBytesTotalName = metricServicePrefix + "requests_bytes_total"
|
||||
|
@ -121,14 +119,19 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
Help: "Last config reload success",
|
||||
}, []string{})
|
||||
tlsCertsNotAfterTimestamp := newGaugeFrom(stdprometheus.GaugeOpts{
|
||||
Name: tlsCertsNotAfterTimestamp,
|
||||
Name: tlsCertsNotAfterTimestampName,
|
||||
Help: "Certificate expiration timestamp",
|
||||
}, []string{"cn", "serial", "sans"})
|
||||
openConnections := newGaugeFrom(stdprometheus.GaugeOpts{
|
||||
Name: openConnectionsName,
|
||||
Help: "How many open connections exist, by entryPoint and protocol",
|
||||
}, []string{"entrypoint", "protocol"})
|
||||
|
||||
promState.vectors = []vector{
|
||||
configReloads.cv,
|
||||
lastConfigReloadSuccess.gv,
|
||||
tlsCertsNotAfterTimestamp.gv,
|
||||
openConnections.gv,
|
||||
}
|
||||
|
||||
reg := &standardRegistry{
|
||||
|
@ -138,6 +141,7 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
configReloadsCounter: configReloads,
|
||||
lastConfigReloadSuccessGauge: lastConfigReloadSuccess,
|
||||
tlsCertsNotAfterTimestampGauge: tlsCertsNotAfterTimestamp,
|
||||
openConnectionsGauge: openConnections,
|
||||
}
|
||||
|
||||
if config.AddEntryPointsLabels {
|
||||
|
@ -154,10 +158,6 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
Help: "How long it took to process the request on an entrypoint, partitioned by status code, protocol, and method.",
|
||||
Buckets: buckets,
|
||||
}, []string{"code", "method", "protocol", "entrypoint"})
|
||||
entryPointOpenConns := newGaugeFrom(stdprometheus.GaugeOpts{
|
||||
Name: entryPointOpenConnsName,
|
||||
Help: "How many open connections exist on an entrypoint, partitioned by method and protocol.",
|
||||
}, []string{"method", "protocol", "entrypoint"})
|
||||
entryPointReqsBytesTotal := newCounterFrom(stdprometheus.CounterOpts{
|
||||
Name: entryPointReqsBytesTotalName,
|
||||
Help: "The total size of requests in bytes handled by an entrypoint, partitioned by status code, protocol, and method.",
|
||||
|
@ -171,7 +171,6 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
entryPointReqs.cv,
|
||||
entryPointReqsTLS.cv,
|
||||
entryPointReqDurations.hv,
|
||||
entryPointOpenConns.gv,
|
||||
entryPointReqsBytesTotal.cv,
|
||||
entryPointRespsBytesTotal.cv,
|
||||
)
|
||||
|
@ -179,7 +178,6 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
reg.entryPointReqsCounter = entryPointReqs
|
||||
reg.entryPointReqsTLSCounter = entryPointReqsTLS
|
||||
reg.entryPointReqDurationHistogram, _ = NewHistogramWithScale(entryPointReqDurations, time.Second)
|
||||
reg.entryPointOpenConnsGauge = entryPointOpenConns
|
||||
reg.entryPointReqsBytesCounter = entryPointReqsBytesTotal
|
||||
reg.entryPointRespsBytesCounter = entryPointRespsBytesTotal
|
||||
}
|
||||
|
@ -198,10 +196,6 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
Help: "How long it took to process the request on a router, partitioned by service, status code, protocol, and method.",
|
||||
Buckets: buckets,
|
||||
}, []string{"code", "method", "protocol", "router", "service"})
|
||||
routerOpenConns := newGaugeFrom(stdprometheus.GaugeOpts{
|
||||
Name: routerOpenConnsName,
|
||||
Help: "How many open connections exist on a router, partitioned by service, method, and protocol.",
|
||||
}, []string{"method", "protocol", "router", "service"})
|
||||
routerReqsBytesTotal := newCounterFrom(stdprometheus.CounterOpts{
|
||||
Name: routerReqsBytesTotalName,
|
||||
Help: "The total size of requests in bytes handled by a router, partitioned by service, status code, protocol, and method.",
|
||||
|
@ -215,14 +209,12 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
routerReqs.cv,
|
||||
routerReqsTLS.cv,
|
||||
routerReqDurations.hv,
|
||||
routerOpenConns.gv,
|
||||
routerReqsBytesTotal.cv,
|
||||
routerRespsBytesTotal.cv,
|
||||
)
|
||||
reg.routerReqsCounter = routerReqs
|
||||
reg.routerReqsTLSCounter = routerReqsTLS
|
||||
reg.routerReqDurationHistogram, _ = NewHistogramWithScale(routerReqDurations, time.Second)
|
||||
reg.routerOpenConnsGauge = routerOpenConns
|
||||
reg.routerReqsBytesCounter = routerReqsBytesTotal
|
||||
reg.routerRespsBytesCounter = routerRespsBytesTotal
|
||||
}
|
||||
|
@ -241,10 +233,6 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
Help: "How long it took to process the request on a service, partitioned by status code, protocol, and method.",
|
||||
Buckets: buckets,
|
||||
}, []string{"code", "method", "protocol", "service"})
|
||||
serviceOpenConns := newGaugeFrom(stdprometheus.GaugeOpts{
|
||||
Name: serviceOpenConnsName,
|
||||
Help: "How many open connections exist on a service, partitioned by method and protocol.",
|
||||
}, []string{"method", "protocol", "service"})
|
||||
serviceRetries := newCounterFrom(stdprometheus.CounterOpts{
|
||||
Name: serviceRetriesTotalName,
|
||||
Help: "How many request retries happened on a service.",
|
||||
|
@ -266,7 +254,6 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
serviceReqs.cv,
|
||||
serviceReqsTLS.cv,
|
||||
serviceReqDurations.hv,
|
||||
serviceOpenConns.gv,
|
||||
serviceRetries.cv,
|
||||
serviceServerUp.gv,
|
||||
serviceReqsBytesTotal.cv,
|
||||
|
@ -276,7 +263,6 @@ func initStandardRegistry(config *types.Prometheus) Registry {
|
|||
reg.serviceReqsCounter = serviceReqs
|
||||
reg.serviceReqsTLSCounter = serviceReqsTLS
|
||||
reg.serviceReqDurationHistogram, _ = NewHistogramWithScale(serviceReqDurations, time.Second)
|
||||
reg.serviceOpenConnsGauge = serviceOpenConns
|
||||
reg.serviceRetriesCounter = serviceRetries
|
||||
reg.serviceServerUpGauge = serviceServerUp
|
||||
reg.serviceReqsBytesCounter = serviceReqsBytesTotal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue