• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

oliver006 / redis_exporter / 17172001870

23 Aug 2025 05:58AM UTC coverage: 84.921% (-0.9%) from 85.87%
17172001870

Pull #1028

github

web-flow
Merge 891f7f01e into 7632b7b20
Pull Request #1028: sirupsen/log --> log/slog

121 of 249 new or added lines in 18 files covered. (48.59%)

6 existing lines in 1 file now uncovered.

2568 of 3024 relevant lines covered (84.92%)

13254.26 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.88
/exporter/modules.go
1
package exporter
2

3
import (
4
        "log/slog"
5
        "strings"
6

7
        "github.com/gomodule/redigo/redis"
8
        "github.com/prometheus/client_golang/prometheus"
9
)
10

11
func (e *Exporter) extractModulesMetrics(ch chan<- prometheus.Metric, c redis.Conn) {
4✔
12
        info, err := redis.String(doRedisCmd(c, "INFO", "MODULES"))
4✔
13
        if err != nil {
4✔
NEW
14
                slog.Error("Failed to extract modules metrics", "error", err)
×
15
                return
×
16
        }
×
17

18
        lines := strings.Split(info, "\r\n")
4✔
19
        for _, line := range lines {
141✔
20
                slog.Debug("info", "line", line)
137✔
21

137✔
22
                split := strings.Split(line, ":")
137✔
23
                if len(split) != 2 {
183✔
24
                        continue
46✔
25
                }
26

27
                if split[0] == "module" {
102✔
28
                        // module format: 'module:name=<module-name>,ver=21005,api=1,filters=0,usedby=[],using=[],options=[]'
11✔
29
                        module := strings.Split(split[1], ",")
11✔
30
                        if len(module) != 7 {
11✔
31
                                continue
×
32
                        }
33
                        e.registerConstMetricGauge(ch, "module_info", 1,
11✔
34
                                strings.Split(module[0], "=")[1],
11✔
35
                                strings.Split(module[1], "=")[1],
11✔
36
                                strings.Split(module[2], "=")[1],
11✔
37
                                strings.Split(module[3], "=")[1],
11✔
38
                                strings.Split(module[4], "=")[1],
11✔
39
                                strings.Split(module[5], "=")[1],
11✔
40
                        )
11✔
41
                        continue
11✔
42
                }
43

44
                fieldKey := split[0]
80✔
45
                fieldValue := split[1]
80✔
46

80✔
47
                if !e.includeMetric(fieldKey) {
120✔
48
                        continue
40✔
49
                }
50
                e.parseAndRegisterConstMetric(ch, fieldKey, fieldValue)
40✔
51
        }
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc