Running bind_exporter throws the following error and the service dies when trying to get out to the URL
(root@test:~)# ./bind_exporter
{"level":"info","msg":"Starting Server: :9109","time":"2015-10-01T10:33:23-04:00"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x55336d]
goroutine 24 [running]:
github.com/prometheus/client_golang/prometheus.(_CounterVec).WithLabelValues(0x0, 0xc8202d9c08, 0x1, 0x1, 0x0, 0x0)
/root/go/src/github.com/prometheus/client_golang/prometheus/counter.go:141 +0xbd
main.(_Exporter).Collect(0xc820018840, 0xc82017a120)
/root/go/src/github.com/digitalocean/bind_exporter/bind_exporter.go:211 +0xb46
github.com/prometheus/client_golang/prometheus.(_registry).writePB.func2(0xc82016a1c0, 0xc82017a120, 0x2b88bba77df8, 0xc820018840)
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:413 +0x58
created by github.com/prometheus/client_golang/prometheus.(_registry).writePB
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:414 +0x343
goroutine 1 [IO wait]:
net.runtime_pollWait(0x2b88bba77b48, 0x72, 0xc82000a240)
/usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(_pollDesc).Wait(0xc820120d80, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(_pollDesc).WaitRead(0xc820120d80, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(_netFD).accept(0xc820120d20, 0x0, 0x2b88bba78120, 0xc8201760a0)
/usr/local/go/src/net/fd_unix.go:408 +0x27c
net.(_TCPListener).AcceptTCP(0xc820028158, 0x455ec0, 0x0, 0x0)
/usr/local/go/src/net/tcpsock_posix.go:254 +0x4d
net/http.tcpKeepAliveListener.Accept(0xc820028158, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2135 +0x41
net/http.(_Server).Serve(0xc820018c00, 0x2b88bba780e8, 0xc820028158, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1887 +0xb3
net/http.(_Server).ListenAndServe(0xc820018c00, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1877 +0x136
net/http.ListenAndServe(0x8d03a8, 0x5, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:1967 +0x8f
main.main()
/root/go/src/github.com/digitalocean/bind_exporter/bind_exporter.go:285 +0x3d6
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1696 +0x1
goroutine 18 [IO wait]:
net.runtime_pollWait(0x2b88bba77a88, 0x72, 0xc82000a240)
/usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(_pollDesc).Wait(0xc82016e060, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(_pollDesc).WaitRead(0xc82016e060, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(_netFD).Read(0xc82016e000, 0xc82017c000, 0x1000, 0x1000, 0x0, 0x2b88bba72050, 0xc82000a240)
/usr/local/go/src/net/fd_unix.go:232 +0x23a
net.(_conn).Read(0xc820172000, 0xc82017c000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:172 +0xe4
net/http.(_liveSwitchReader).Read(0xc820174048, 0xc82017c000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:219 +0xa4
io.(_LimitedReader).Read(0xc820176020, 0xc82017c000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/io/io.go:427 +0xbd
bufio.(_Reader).fill(0xc82017a000)
/usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(_Reader).ReadSlice(0xc82017a000, 0xc81fff3d0a, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:328 +0x21a
bufio.(_Reader).ReadLine(0xc82017a000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:357 +0x53
net/textproto.(_Reader).readLineSlice(0xc820170150, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/textproto/reader.go:55 +0x81
net/textproto.(_Reader).ReadLine(0xc820170150, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/textproto/reader.go:36 +0x40
net/http.ReadRequest(0xc82017a000, 0xc8201840e0, 0x0, 0x0)
/usr/local/go/src/net/http/request.go:653 +0xb6
net/http.(_conn).readRequest(0xc820174000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:633 +0x32f
net/http.(_conn).serve(0xc820174000)
/usr/local/go/src/net/http/server.go:1319 +0x727
created by net/http.(_Server).Serve
/usr/local/go/src/net/http/server.go:1910 +0x3f6
goroutine 19 [chan receive]:
github.com/prometheus/client_golang/prometheus.(_registry).writePB(0xc8200186c0, 0x2b88bd8b5390, 0xc820176480, 0x0, 0x0)
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:425 +0x3fd
github.com/prometheus/client_golang/prometheus.(_registry).ServeHTTP(0xc8200186c0, 0x2b88bd8b5280, 0xc820172010, 0xc820184000)
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:373 +0x173
net/http.(Handler).ServeHTTP-fm(0x2b88bd8b5280, 0xc820172010, 0xc820184000)
/root/go/src/github.com/prometheus/client_golang/prometheus/http.go:61 +0x50
github.com/prometheus/client_golang/prometheus.InstrumentHandlerFuncWithOpts.func1(0x2b88bd8b5180, 0xc820174160, 0xc820184000)
/root/go/src/github.com/prometheus/client_golang/prometheus/http.go:158 +0x335
net/http.HandlerFunc.ServeHTTP(0xc820079180, 0x2b88bd8b5180, 0xc820174160, 0xc820184000)
/usr/local/go/src/net/http/server.go:1422 +0x3a
net/http.(_ServeMux).ServeHTTP(0xc820010a50, 0x2b88bd8b5180, 0xc820174160, 0xc820184000)
/usr/local/go/src/net/http/server.go:1699 +0x17d
net/http.serverHandler.ServeHTTP(0xc820018c00, 0x2b88bd8b5180, 0xc820174160, 0xc820184000)
/usr/local/go/src/net/http/server.go:1862 +0x19e
net/http.(_conn).serve(0xc8201740b0)
/usr/local/go/src/net/http/server.go:1361 +0xbee
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:1910 +0x3f6
goroutine 20 [chan send]:
github.com/prometheus/client_golang/prometheus.computeApproximateRequestSize(0xc820184000, 0xc82017a0c0, 0x144f)
/root/go/src/github.com/prometheus/client_golang/prometheus/http.go:187 +0x1b6
created by github.com/prometheus/client_golang/prometheus.InstrumentHandlerFuncWithOpts.func1
/root/go/src/github.com/prometheus/client_golang/prometheus/http.go:146 +0x18c
goroutine 21 [runnable]:
sync.runtime_Semacquire(0xc82016a1cc)
/usr/local/go/src/runtime/sema.go:43 +0x26
sync.(_WaitGroup).Wait(0xc82016a1c0)
/usr/local/go/src/sync/waitgroup.go:126 +0xb4
github.com/prometheus/client_golang/prometheus.(_registry).writePB.func1(0xc82016a1c0, 0xc82017a120)
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:407 +0x21
created by github.com/prometheus/client_golang/prometheus.(*registry).writePB
/root/go/src/github.com/prometheus/client_golang/prometheus/registry.go:409 +0x26c
goroutine 32 [IO wait]:
net.runtime_pollWait(0x2b88bba77908, 0x72, 0xc82000a240)
/usr/local/go/src/runtime/netpoll.go:157 +0x60
net.(_pollDesc).Wait(0xc82016e370, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(_pollDesc).WaitRead(0xc82016e370, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(_netFD).Read(0xc82016e310, 0xc8201ca000, 0x1000, 0x1000, 0x0, 0x2b88bba72050, 0xc82000a240)
/usr/local/go/src/net/fd_unix.go:232 +0x23a
net.(_conn).Read(0xc8201720a8, 0xc8201ca000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x2b88bd8b5088, 0xc8201720a8, 0xc820174318, 0xc8201ca000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/http/transport.go:1370 +0x67
net/http.(_noteEOFReader).Read(0xc820176820, 0xc8201ca000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
:126 +0xd0
bufio.(_Reader).fill(0xc82017a960)
/usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(_Reader).Peek(0xc82017a960, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(_persistConn).readLoop(0xc8201742c0)
/usr/local/go/src/net/http/transport.go:876 +0xf7
created by net/http.(*Transport).dialConn
/usr/local/go/src/net/http/transport.go:685 +0xc78
goroutine 33 [select]:
net/http.(_persistConn).writeLoop(0xc8201742c0)
/usr/local/go/src/net/http/transport.go:1009 +0x40c
created by net/http.(_Transport).dialConn
/usr/local/go/src/net/http/transport.go:686 +0xc9d
(root@test:~)#