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

Function extractServerInfo

extra/redisotel-native/metrics.go:476–489  ·  view source on GitHub ↗

extractServerInfo extracts server address and port from connection info For client connections, this is the remote endpoint (server address)

(cn redis.ConnInfo)

Source from the content-addressed store, hash-verified

474// extractServerInfo extracts server address and port from connection info
475// For client connections, this is the remote endpoint (server address)
476func extractServerInfo(cn redis.ConnInfo) (addr, port string) {
477 if cn == nil {
478 return "", ""
479 }
480
481 remoteAddr := cn.RemoteAddr()
482 if remoteAddr == nil {
483 return "", ""
484 }
485
486 addrStr := remoteAddr.String()
487 host, portStr := parseAddr(addrStr)
488 return host, portStr
489}
490
491// RecordConnectionCreateTime records the time it took to create a new connection
492func (r *metricsRecorder) RecordConnectionCreateTime(

Callers 6

RecordErrorMethod · 0.85
RecordPubSubMessageMethod · 0.85
RecordStreamLagMethod · 0.85

Calls 3

parseAddrFunction · 0.85
RemoteAddrMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected