Skip to content

Commit

Permalink
Refactor: Use context in Fetch method
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsaks committed Dec 10, 2024
1 parent 0c5ed2d commit 2046288
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions metricbeat/module/pgbouncer/mem/mem.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ func New(base mb.BaseMetricSet) (mb.MetricSet, error) {

// Fetch methods implements the data gathering and data conversion to the right format
// It publishes the event which is then forwarded to the output. In case of an error, an error is reported.
func (m *MetricSet) Fetch(reporter mb.ReporterV2) error {
// Create a new context for this operation.
ctx := context.Background()

func (m *MetricSet) Fetch(ctx context.Context, reporter mb.ReporterV2) error {
// Execute the "SHOW MEM;" query against the database.
results, err := m.QueryStats(ctx, "SHOW MEM;")
if err != nil {
Expand Down

0 comments on commit 2046288

Please sign in to comment.