Skip to content

Commit 87e24e4

Browse files
committed
feat(publisher): add pprof to enable profiling
1 parent 13bd5f2 commit 87e24e4

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

publisher/image/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM alpine:3.1
22

3+
# install curl in the image so it is possible to get the runtime
4+
# profiling information without any additional package installation.
5+
RUN apk add --update-cache curl && rm -rf /var/cache/apk/*
6+
37
ADD bin/publisher /usr/local/bin/publisher
48
ENTRYPOINT ["/usr/local/bin/publisher"]
59

publisher/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package main
33
import (
44
"flag"
55
"log"
6+
"net/http"
7+
_ "net/http/pprof"
68
"time"
79

810
"github.com/coreos/go-etcd/etcd"
@@ -44,6 +46,10 @@ func main() {
4446

4547
go server.Listen(*etcdTTL)
4648

49+
go func() {
50+
log.Println(http.ListenAndServe("localhost:6060", nil))
51+
}()
52+
4753
for {
4854
go server.Poll(*etcdTTL)
4955
time.Sleep(*refreshDuration)

0 commit comments

Comments
 (0)