Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release connections in metricbeat redis module #12914

Merged
merged 3 commits into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- PdhExpandWildCardPathW will not expand counter paths in 32 bit windows systems, workaround will use a different function.{issue}12590[12590]{pull}12622[12622]
- In the elasticsearch/node_stats metricset, if xpack is enabled, make parsing of ES node load average optional as ES on Windows doesn't report load average. {pull}12866[12866]
- Ramdisk is not filtered out when collecting disk performance counters in diskio metricset {issue}12814[12814] {pull}12829[12829]
- Fix connections leak in redis module {pull}12914[12914]

*Packetbeat*

Expand Down
5 changes: 4 additions & 1 deletion metricbeat/module/redis/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {

// Fetch fetches metrics from Redis by issuing the INFO command.
func (m *MetricSet) Fetch(r mb.ReporterV2) error {
conn := m.Connection()
defer conn.Close()

// Fetch default INFO.
info, err := redis.FetchRedisInfo("default", m.Connection())
info, err := redis.FetchRedisInfo("default", conn)
if err != nil {
return errors.Wrap(err, "failed to fetch redis info")
}
Expand Down
2 changes: 2 additions & 0 deletions metricbeat/module/redis/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
// Fetch fetches information from Redis keys
func (m *MetricSet) Fetch(r mb.ReporterV2) error {
conn := m.Connection()
defer conn.Close()

for _, p := range m.patterns {
if err := redis.Select(conn, p.Keyspace); err != nil {
msg := errors.Wrapf(err, "Failed to select keyspace %d", p.Keyspace)
Expand Down
5 changes: 4 additions & 1 deletion metricbeat/module/redis/keyspace/keyspace.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {

// Fetch fetches metrics from Redis by issuing the INFO command.
func (m *MetricSet) Fetch(r mb.ReporterV2) error {
conn := m.Connection()
defer conn.Close()

// Fetch default INFO.
info, err := redis.FetchRedisInfo("keyspace", m.Connection())
info, err := redis.FetchRedisInfo("keyspace", conn)
if err != nil {
return errors.Wrap(err, "Failed to fetch redis info for keyspaces")
}
Expand Down