Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: "2"
linters:
enable:
- sloglint
- revive
settings:
errcheck:
exclude-functions:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Consul Exporter

[![CircleCI](https://circleci.com/gh/prometheus/consul_exporter/tree/master.svg?style=shield)][circleci]
[![Build Status](https://github.com/prometheus/consul_exporter/actions/workflows/ci.yml/badge.svg)](https://github.com/prometheus/consul_exporter/actions/workflows/ci.yml)
[![Docker Repository on Quay](https://quay.io/repository/prometheus/consul-exporter/status)][quay]
[![Docker Pulls](https://img.shields.io/docker/pulls/prom/consul-exporter.svg?maxAge=604800)][hub]

Expand Down Expand Up @@ -133,6 +133,5 @@ To use TLS and/or basic authentication, you need to pass a configuration file
using the `--web.config.file` parameter. The format of the file is described
[in the exporter-toolkit repository](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md).

[circleci]: https://circleci.com/gh/prometheus/consul_exporter
[hub]: https://hub.docker.com/r/prom/consul-exporter/
[quay]: https://quay.io/repository/prometheus/consul-exporter
10 changes: 5 additions & 5 deletions cmd/consul_exporter/consul_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func main() {
}
prometheus.MustRegister(exporter)

queryOptionsJson, err := json.MarshalIndent(queryOptions, "", " ")
queryOptionsJSON, err := json.MarshalIndent(queryOptions, "", " ")
if err != nil {
logger.Error("Error marshaling query options", "err", err)
os.Exit(1)
Expand All @@ -108,25 +108,25 @@ func main() {
),
),
)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.HandleFunc("/", func(w http.ResponseWriter, _ *http.Request) {
w.Write([]byte(`<html>
<head><title>Consul Exporter</title></head>
<body>
<h1>Consul Exporter</h1>
<p><a href='` + *metricsPath + `'>Metrics</a></p>
<h2>Options</h2>
<pre>` + string(queryOptionsJson) + `</pre>
<pre>` + string(queryOptionsJSON) + `</pre>
</dl>
<h2>Build</h2>
<pre>` + version.Info() + ` ` + version.BuildContext() + `</pre>
</body>
</html>`))
})
http.HandleFunc("/-/healthy", func(w http.ResponseWriter, r *http.Request) {
http.HandleFunc("/-/healthy", func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "OK")
})
http.HandleFunc("/-/ready", func(w http.ResponseWriter, r *http.Request) {
http.HandleFunc("/-/ready", func(w http.ResponseWriter, _ *http.Request) {
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, "OK")
})
Expand Down
1 change: 0 additions & 1 deletion pkg/exporter/consul_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"fmt"
"log/slog"
"net/http"
_ "net/http/pprof"
"net/url"
"regexp"
"strconv"
Expand Down