MCPcopy
hub / github.com/redis/go-redis / ProcessHook

Method ProcessHook

extra/redisotel/metrics.go:298–316  ·  view source on GitHub ↗
(hook redis.ProcessHook)

Source from the content-addressed store, hash-verified

296}
297
298func (mh *metricsHook) ProcessHook(hook redis.ProcessHook) redis.ProcessHook {
299 return func(ctx context.Context, cmd redis.Cmder) error {
300 start := time.Now()
301
302 err := hook(ctx, cmd)
303
304 dur := time.Since(start)
305
306 attrs := make([]attribute.KeyValue, 0, len(mh.attrs)+3)
307 attrs = append(attrs, mh.attrs...)
308 attrs = append(attrs, attribute.String("type", "command"))
309 attrs = append(attrs, statusAttr(err))
310 attrs = append(attrs, errorTypeAttribute(err))
311
312 mh.useTime.Record(ctx, milliseconds(dur), metric.WithAttributeSet(attribute.NewSet(attrs...)))
313
314 return err
315 }
316}
317
318func (mh *metricsHook) ProcessPipelineHook(
319 hook redis.ProcessPipelineHook,

Callers

nothing calls this directly

Calls 6

hookStruct · 0.85
statusAttrFunction · 0.85
errorTypeAttributeFunction · 0.85
millisecondsFunction · 0.85
RecordMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected