(hook redis.ProcessHook)
| 296 | } |
| 297 | |
| 298 | func (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 | |
| 318 | func (mh *metricsHook) ProcessPipelineHook( |
| 319 | hook redis.ProcessPipelineHook, |
nothing calls this directly
no test coverage detected