Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: redundant registration for prometheus collector metrics #21156

Merged
merged 1 commit into from Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,7 @@ v1.9.0 [unreleased]

### Bugfixes

- [#21156](https://github.com/influxdata/influxdb/pull/21156): fix: redundant registration for prometheus collector metrics
- [#21052](https://github.com/influxdata/influxdb/pull/21052): fix: help text for influx_inspect
- [#20889](https://github.com/influxdata/influxdb/pull/20889): fix: Add back flux CLI (#20889)
- [#20802](https://github.com/influxdata/influxdb/pull/20802): fix(tsm1): fix data race and validation in cache ring
Expand Down
14 changes: 0 additions & 14 deletions services/httpd/handler.go
Expand Up @@ -41,7 +41,6 @@ import (
"github.com/influxdata/influxdb/tsdb"
"github.com/influxdata/influxdb/uuid"
"github.com/influxdata/influxql"
prom "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/prometheus/prompb"
"go.uber.org/zap"
Expand Down Expand Up @@ -134,7 +133,6 @@ type Handler struct {
// Flux services
Controller Controller
CompilerMappings flux.CompilerMappings
registered bool

Config *Config
Logger *zap.Logger
Expand Down Expand Up @@ -332,11 +330,6 @@ func (h *Handler) Open() {
if h.Config.AuthEnabled && h.Config.SharedSecret == "" {
h.Logger.Info("Auth is enabled but shared-secret is blank. BearerAuthentication is disabled.")
}

if h.Config.FluxEnabled {
h.registered = true
prom.MustRegister(h.Controller.PrometheusCollectors()...)
}
}

func (h *Handler) Close() {
Expand All @@ -349,13 +342,6 @@ func (h *Handler) Close() {
h.accessLog = nil
h.accessLogFilters = nil
}

if h.registered {
for _, col := range h.Controller.PrometheusCollectors() {
prom.Unregister(col)
}
h.registered = false
}
}

// Statistics maintains statistics for the httpd service.
Expand Down