Skip to content

Commit 2bac9e1

Browse files
Merge pull request #96 from martin-helmich/task/update-promclient
Update to recent prometheus/client_golang version
2 parents f65d69e + 0654c3d commit 2bac9e1

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

go.mod

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,37 @@
11
module github.com/martin-helmich/prometheus-nginxlog-exporter
22

33
require (
4+
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d // indirect
45
github.com/armon/go-radix v1.0.0 // indirect
5-
github.com/beorn7/perks v0.0.0-20160229213445-3ac7bf7a47d1 // indirect
6+
github.com/creack/pty v1.1.9 // indirect
67
github.com/fsnotify/fsnotify v1.4.7 // indirect
7-
github.com/golang/protobuf v0.0.0-20160614223140-0c1f6d65b5a1 // indirect
8+
github.com/go-logfmt/logfmt v0.5.0 // indirect
9+
github.com/golang/protobuf v1.3.3 // indirect
10+
github.com/google/gofuzz v1.1.0 // indirect
811
github.com/hashicorp/consul v0.0.0-20150921174127-de080672fee9
912
github.com/hashicorp/go-msgpack v0.5.3 // indirect
1013
github.com/hashicorp/golang-lru v0.5.1 // indirect
1114
github.com/hashicorp/hcl v1.0.0
1215
github.com/hpcloud/tail v1.0.0
13-
github.com/kr/pretty v0.1.0 // indirect
14-
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
15-
github.com/prometheus/client_golang v0.0.0-20160916180340-5636dc67ae77
16-
github.com/prometheus/client_model v0.0.0-20150212101744-fa8ad6fec335 // indirect
17-
github.com/prometheus/common v0.0.0-20160623151427-4402f4e5ea79 // indirect
18-
github.com/prometheus/procfs v0.0.0-20160411190841-abf152e5f3e9 // indirect
16+
github.com/julienschmidt/httprouter v1.3.0 // indirect
17+
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
18+
github.com/kr/pretty v0.2.0 // indirect
19+
github.com/kr/pty v1.1.8 // indirect
20+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
21+
github.com/modern-go/reflect2 v1.0.1 // indirect
22+
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
23+
github.com/pkg/errors v0.9.1 // indirect
24+
github.com/prometheus/client_golang v1.4.0
1925
github.com/satyrius/gonx v1.3.1-0.20180709120835-47c52b995fe5
2026
github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff // indirect
27+
github.com/stretchr/objx v0.2.0 // indirect
2128
github.com/stretchr/testify v1.4.0
22-
golang.org/x/sys v0.0.0-20161023150541-c200b10b5d5e // indirect
23-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
29+
golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72 // indirect
30+
golang.org/x/mod v0.2.0 // indirect
31+
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
32+
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
33+
golang.org/x/text v0.3.2 // indirect
34+
golang.org/x/tools v0.0.0-20200205141839-4abfd4a1628e // indirect
2435
gopkg.in/fsnotify.v1 v1.4.7 // indirect
2536
gopkg.in/mcuadros/go-syslog.v2 v2.3.0
2637
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect

main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"github.com/martin-helmich/prometheus-nginxlog-exporter/relabeling"
3535
"github.com/martin-helmich/prometheus-nginxlog-exporter/tail"
3636
"github.com/prometheus/client_golang/prometheus"
37+
"github.com/prometheus/client_golang/prometheus/promhttp"
3738
"github.com/satyrius/gonx"
3839
)
3940

@@ -76,9 +77,10 @@ func (m *Metrics) Init(cfg *config.NamespaceConfig) {
7677
}, labels)
7778

7879
m.upstreamSeconds = prometheus.NewSummaryVec(prometheus.SummaryOpts{
79-
Namespace: cfg.Name,
80-
Name: "http_upstream_time_seconds",
81-
Help: "Time needed by upstream servers to handle requests",
80+
Namespace: cfg.Name,
81+
Name: "http_upstream_time_seconds",
82+
Help: "Time needed by upstream servers to handle requests",
83+
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
8284
}, labels)
8385

8486
m.upstreamSecondsHist = prometheus.NewHistogramVec(prometheus.HistogramOpts{
@@ -186,7 +188,7 @@ func main() {
186188
listenAddr := fmt.Sprintf("%s:%d", cfg.Listen.Address, cfg.Listen.Port)
187189
fmt.Printf("running HTTP server on address %s\n", listenAddr)
188190

189-
http.Handle("/metrics", prometheus.Handler())
191+
http.Handle("/metrics", promhttp.Handler())
190192

191193
if err := http.ListenAndServe(listenAddr, nil); err != nil {
192194
fmt.Printf("error while starting HTTP server: %s", err.Error())

0 commit comments

Comments
 (0)