Skip to content

Commit

Permalink
removed dupllicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
naman47vyas committed Jun 11, 2024
1 parent 49981b7 commit e2d37fd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
9 changes: 0 additions & 9 deletions receiver/postgresqlreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type client interface {
getLatestWalAgeSeconds(ctx context.Context) (int64, error)
getMaxConnections(ctx context.Context) (int64, error)
getIndexStats(ctx context.Context, database string) (map[indexIdentifer]indexStat, error)
getActiveConnections(ctx context.Context) (int64, error)
listDatabases(ctx context.Context) ([]string, error)
getRowStats(ctx context.Context) ([]RowStats, error)
getQueryStats(ctx context.Context) ([]queryStats, error)
Expand Down Expand Up @@ -659,14 +658,6 @@ func (c *postgreSQLClient) getBufferHit(ctx context.Context) ([]BufferHit, error
return bh, errors
}

func (c *postgreSQLClient) getActiveConnections(ctx context.Context) (int64, error) {
query := `SELECT COUNT(*) FROM pg_stat_activity WHERE state = 'active';`
row := c.client.QueryRowContext(ctx, query)
var activeConns int64
err := row.Scan(&activeConns)
return activeConns, err
}

func (c *postgreSQLClient) getVersionString(ctx context.Context) (string, error) {
var version string
err := c.client.QueryRowContext(ctx, "SHOW server_version").Scan(&version)
Expand Down
14 changes: 0 additions & 14 deletions receiver/postgresqlreceiver/scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,20 +397,6 @@ func (p *postgreSQLScraper) collectQueryPerfStats(
}
}

func (p *postgreSQLScraper) collectActiveConnections(
ctx context.Context,
now pcommon.Timestamp,
client client,
errs *errsMux,
) {
ac, err := client.getActiveConnections(ctx)
if err != nil {
errs.addPartial(err)
return
}
p.mb.RecordPostgresqlConnectionCountDataPoint(now, ac)
}

func (p *postgreSQLScraper) collectBufferHits(
ctx context.Context,
now pcommon.Timestamp,
Expand Down

0 comments on commit e2d37fd

Please sign in to comment.