Skip to content

Commit c5642b7

Browse files
authored
Expose Prometheus metrics for tracegen (#2932)
1 parent 0c5d2f5 commit c5642b7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Diff for: cmd/tracegen/main.go

+6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ package main
1616

1717
import (
1818
"flag"
19+
"net/http"
1920
"time"
2021

2122
"github.com/opentracing/opentracing-go"
23+
"github.com/prometheus/client_golang/prometheus/promhttp"
2224
jaegerConfig "github.com/uber/jaeger-client-go/config"
2325
jaegerZap "github.com/uber/jaeger-client-go/log/zap"
2426
"github.com/uber/jaeger-lib/metrics/prometheus"
@@ -61,6 +63,10 @@ func main() {
6163
opentracing.InitGlobalTracer(tracer)
6264
logger.Info("Initialized global tracer")
6365

66+
http.Handle("/metrics", promhttp.Handler())
67+
go http.ListenAndServe(":2112", nil)
68+
logger.Info("Initialized Prometheus endpoint at 2112")
69+
6470
tracegen.Run(cfg, logger)
6571

6672
logger.Info("Waiting 1.5sec for metrics to flush")

0 commit comments

Comments
 (0)