Skip to content

Commit e8e6015

Browse files
Merge pull request #52 from AlwxSin/fix/#51-prometheus-observe
observe timeToHandle after request processing
2 parents 804db2b + 47e67ae commit e8e6015

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

prometheus/prometheus.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,14 @@ func (a Tracer) InterceptResponse(
139139
oc := graphql.GetOperationContext(ctx)
140140
observerStart := oc.Stats.OperationStart
141141

142+
res := next(ctx)
143+
142144
timeToHandleRequest.With(prometheusclient.Labels{"exitStatus": exitStatus}).
143145
Observe(float64(time.Since(observerStart).Nanoseconds() / int64(time.Millisecond)))
144146

145147
requestCompletedCounter.Inc()
146148

147-
return next(ctx)
149+
return res
148150
}
149151

150152
func (a Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (any, error) {

0 commit comments

Comments
 (0)