I'm trying to instrument my http.Handler with promhttp.InstrumentHandlerDuration, like so:
duration := prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "request_duration_seconds",
Help: "Request duration",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
},
[]string{"code", "method"},
)
// ...
http.Handle("/", promhttp.InstrumentHandlerDuration(duration, handler))
However, this causes a runtime panic because prometheus.summary doesn't conform to the ExemplarObserver interface.
2023/04/22 14:47:25 http: panic serving 127.0.0.1:56256: interface conversion: *prometheus.summary is not prometheus.ExemplarObserver: missing method ObserveWithExemplar
It's not clear to me how to resolve this issue - unfortunately the documentation for InstrumentHandlerDuration doesn't discuss the matter, nor does the example provided (I'd be curious if the example as written even works!)
I'm trying to instrument my
http.Handlerwithpromhttp.InstrumentHandlerDuration, like so:However, this causes a runtime panic because
prometheus.summarydoesn't conform to theExemplarObserverinterface.It's not clear to me how to resolve this issue - unfortunately the documentation for
InstrumentHandlerDurationdoesn't discuss the matter, nor does the example provided (I'd be curious if the example as written even works!)