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

Function addServerPortIfNonDefault

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

addServerPortIfNonDefault adds server.port attribute if port is not the default (6379)

(attrs []attribute.KeyValue, serverPort string)

Source from the content-addressed store, hash-verified

31
32// addServerPortIfNonDefault adds server.port attribute if port is not the default (6379)
33func addServerPortIfNonDefault(attrs []attribute.KeyValue, serverPort string) []attribute.KeyValue {
34 if serverPort != "" && serverPort != "6379" {
35 return append(attrs, attribute.String(AttrServerPort, serverPort))
36 }
37 return attrs
38}
39
40// metricsRecorder implements the otel.Recorder interface
41type metricsRecorder struct {

Callers 8

RecordErrorMethod · 0.85
RecordPubSubMessageMethod · 0.85
RecordStreamLagMethod · 0.85
RecordConnectionCountMethod · 0.85
RecordPendingRequestsMethod · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected