RecordConnectionHandoff records when a connection is handed off to another node
( ctx context.Context, cn redis.ConnInfo, poolName string, )
| 554 | |
| 555 | // RecordConnectionHandoff records when a connection is handed off to another node |
| 556 | func (r *metricsRecorder) RecordConnectionHandoff( |
| 557 | ctx context.Context, |
| 558 | cn redis.ConnInfo, |
| 559 | poolName string, |
| 560 | ) { |
| 561 | if r.connectionHandoff == nil { |
| 562 | return |
| 563 | } |
| 564 | |
| 565 | attrs := []attribute.KeyValue{ |
| 566 | attribute.String(AttrDBSystemName, DBSystemRedis), |
| 567 | getLibraryVersionAttr(), |
| 568 | } |
| 569 | |
| 570 | // Use pool name from connection (set when connection was created) |
| 571 | if cn != nil { |
| 572 | connPoolName := cn.PoolName() |
| 573 | if connPoolName != "" { |
| 574 | attrs = append(attrs, attribute.String(AttrDBClientConnectionPoolName, connPoolName)) |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | // Record the counter |
| 579 | r.connectionHandoff.Add(ctx, 1, metric.WithAttributes(attrs...)) |
| 580 | } |
| 581 | |
| 582 | // RecordError records client errors (ASK, MOVED, handshake failures, etc.) |
| 583 | func (r *metricsRecorder) RecordError( |
nothing calls this directly
no test coverage detected