Skip to content

Commit d519d5f

Browse files
author
Claus-Theodor Riegg
committed
fix: change misleading parameter name
1 parent 2d053a5 commit d519d5f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

redisMetric.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type redisMetric struct {
1515
value float64
1616
}
1717

18-
func generateUniqueMetrics(instanceName string) []redisMetric {
18+
func generateUniqueMetrics(redisInfoOutput string) []redisMetric {
1919
var metrics []redisMetric
2020
// ensure that the map is always iterated in the same order
2121
metricNames := make([]string, 0, len(uniqueMetricMap))
@@ -28,7 +28,7 @@ func generateUniqueMetrics(instanceName string) []redisMetric {
2828

2929
for _, metricName := range metricNames {
3030
submNam := uniqueMetricMap[metricName]
31-
val, err := fetchMetricValue(instanceName, metricName)
31+
val, err := fetchMetricValue(redisInfoOutput, metricName)
3232

3333
if err == nil {
3434
metrics = append(metrics, redisMetric{
@@ -43,8 +43,8 @@ func generateUniqueMetrics(instanceName string) []redisMetric {
4343
return metrics
4444
}
4545

46-
func fetchMetricValue(instanceName string, metricName string) (float64, error) {
47-
scanner := bufio.NewScanner(strings.NewReader(instanceName))
46+
func fetchMetricValue(redisInfoOutput string, metricName string) (float64, error) {
47+
scanner := bufio.NewScanner(strings.NewReader(redisInfoOutput))
4848

4949
for scanner.Scan() {
5050
line := scanner.Text()
@@ -59,11 +59,11 @@ func fetchMetricValue(instanceName string, metricName string) (float64, error) {
5959
return 0, fmt.Errorf("metric %s not found", metricName)
6060
}
6161

62-
func generateRecordsMetrics(instanceName string) []redisMetric {
62+
func generateRecordsMetrics(redisInfoOutput string) []redisMetric {
6363
var metrics []redisMetric
6464
// group 1 is the db ID; group 2 is the number of keys (records)
6565
re := regexp.MustCompile(`^db(\d+):keys=(\d+)`)
66-
scanner := bufio.NewScanner(strings.NewReader(instanceName))
66+
scanner := bufio.NewScanner(strings.NewReader(redisInfoOutput))
6767

6868
for scanner.Scan() {
6969
line := scanner.Text()

0 commit comments

Comments
 (0)