Skip to content

Commit

Permalink
Fix compilation issues do name clashing
Browse files Browse the repository at this point in the history
  • Loading branch information
marctc committed Oct 5, 2023
1 parent 8db82b9 commit 9fe3bad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions mysqld_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func init() {
prometheus.MustRegister(version.NewCollector("mysqld_exporter"))
}

func newHandler(scrapers []collector.Scraper, logger log.Logger, cfg collector.Config) http.HandlerFunc {
func newHandler(scrapers []collector.Scraper, logger log.Logger, config collector.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var dsn string
var err error
Expand Down Expand Up @@ -179,7 +179,7 @@ func newHandler(scrapers []collector.Scraper, logger log.Logger, cfg collector.C
filteredScrapers := filterScrapers(scrapers, collect)

registry := prometheus.NewRegistry()
registry.MustRegister(collector.New(ctx, dsn, filteredScrapers, logger, cfg))
registry.MustRegister(collector.New(ctx, dsn, filteredScrapers, logger, config))

gatherers := prometheus.Gatherers{
prometheus.DefaultGatherer,
Expand Down Expand Up @@ -260,7 +260,7 @@ func main() {
}
http.Handle("/", landingPage)
}
http.HandleFunc("/probe", handleProbe(enabledScrapers, logger))
http.HandleFunc("/probe", handleProbe(enabledScrapers, logger, collectorConfig))
http.HandleFunc("/-/reload", func(w http.ResponseWriter, r *http.Request) {
if err = c.ReloadConfig(*configMycnf, *mysqldAddress, *mysqldUser, *tlsInsecureSkipVerify, logger); err != nil {
level.Warn(logger).Log("msg", "Error reloading host config", "file", *configMycnf, "error", err)
Expand Down
4 changes: 2 additions & 2 deletions probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/prometheus/mysqld_exporter/collector"
)

func handleProbe(scrapers []collector.Scraper, logger log.Logger) http.HandlerFunc {
func handleProbe(scrapers []collector.Scraper, logger log.Logger, config collector.Config) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
params := r.URL.Query()
Expand Down Expand Up @@ -57,7 +57,7 @@ func handleProbe(scrapers []collector.Scraper, logger log.Logger) http.HandlerFu
filteredScrapers := filterScrapers(scrapers, collectParams)

registry := prometheus.NewRegistry()
registry.MustRegister(collector.New(ctx, dsn, filteredScrapers, logger))
registry.MustRegister(collector.New(ctx, dsn, filteredScrapers, logger, config))

h := promhttp.HandlerFor(registry, promhttp.HandlerOpts{})
h.ServeHTTP(w, r)
Expand Down

0 comments on commit 9fe3bad

Please sign in to comment.