Skip to content

Commit

Permalink
Disable all new queries by default, rename marginalia -> summary
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Yuan <felix.yuan@reddit.com>
  • Loading branch information
Sticksman committed Jun 24, 2023
1 parent 63b372e commit 8f1a3e0
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion collector/pg_archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

func init() {
registerCollector("archiver", defaultEnabled, NewPGArchiverCollector)
registerCollector("archiver", defaultDisabled, NewPGArchiverCollector)
}

type PGArchiverCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_blocked.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const blockedSubsystem = "blocked"

func init() {
registerCollector(blockedSubsystem, defaultEnabled, NewPGBlockedCollector)
registerCollector(blockedSubsystem, defaultDisabled, NewPGBlockedCollector)
}

type PGBlockedCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_database_wraparound.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const databaseWraparoundSubsystem = "database_wraparound"

func init() {
registerCollector(databaseWraparoundSubsystem, defaultEnabled, NewPGDatabaseWraparoundCollector)
registerCollector(databaseWraparoundSubsystem, defaultDisabled, NewPGDatabaseWraparoundCollector)
}

type PGDatabaseWraparoundCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_index_size.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const indexSizeSubsystem = "index_size"

func init() {
registerCollector(indexSizeSubsystem, defaultEnabled, NewPGIndexSizeCollector)
registerCollector(indexSizeSubsystem, defaultDisabled, NewPGIndexSizeCollector)
}

type PGIndexSizeCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_long_running_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const longRunningTransactionsSubsystem = "long_running_transactions"

func init() {
registerCollector(longRunningTransactionsSubsystem, defaultEnabled, NewPGLongRunningTransactionsCollector)
registerCollector(longRunningTransactionsSubsystem, defaultDisabled, NewPGLongRunningTransactionsCollector)
}

type PGLongRunningTransactionsCollector struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ import (
"github.com/prometheus/client_golang/prometheus"
)

const longRunningTransactionsMarginaliaSubsystem = "long_running_transactions_marginalia"
const longRunningTransactionsSummarySubsystem = "long_running_transactions_summary"

func init() {
registerCollector(longRunningTransactionsMarginaliaSubsystem, defaultEnabled, NewPGLongRunningTransactionsMarginaliaCollector)
registerCollector(longRunningTransactionsSummarySubsystem, defaultDisabled, NewPGLongRunningTransactionsSummaryCollector)
}

type PGLongRunningTransactionsMarginaliaCollector struct {
type PGLongRunningTransactionsSummaryCollector struct {
log log.Logger
}

func NewPGLongRunningTransactionsMarginaliaCollector(config collectorConfig) (Collector, error) {
return &PGLongRunningTransactionsMarginaliaCollector{log: config.logger}, nil
func NewPGLongRunningTransactionsSummaryCollector(config collectorConfig) (Collector, error) {
return &PGLongRunningTransactionsSummaryCollector{log: config.logger}, nil
}

var (
longRunningTransactionsMarginaliaMaxAgeInSeconds = prometheus.NewDesc(
prometheus.BuildFQName(namespace, longRunningTransactionsMarginaliaSubsystem, "max_age_in_seconds"),
longRunningTransactionsSummaryMaxAgeInSeconds = prometheus.NewDesc(
prometheus.BuildFQName(namespace, longRunningTransactionsSummarySubsystem, "max_age_in_seconds"),
"The current maximum transaction age in seconds",
[]string{"application", "endpoint"},
prometheus.Labels{},
)

longRunningTransactionsMarginaliaQuery = `
longRunningTransactionsSummaryQuery = `
SELECT
activity.matches[1] AS application,
activity.matches[2] AS endpoint,
Expand All @@ -62,10 +62,10 @@ var (
`
)

func (PGLongRunningTransactionsMarginaliaCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
func (PGLongRunningTransactionsSummaryCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
db := instance.getDB()
rows, err := db.QueryContext(ctx,
longRunningTransactionsMarginaliaQuery)
longRunningTransactionsSummaryQuery)

if err != nil {
return err
Expand All @@ -81,7 +81,7 @@ func (PGLongRunningTransactionsMarginaliaCollector) Update(ctx context.Context,
}

ch <- prometheus.MustNewConstMetric(
longRunningTransactionsMarginaliaMaxAgeInSeconds,
longRunningTransactionsSummaryMaxAgeInSeconds,
prometheus.GaugeValue,
maxAgeInSeconds,
application, endpoint,
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_oldest_blocked.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const oldestBlockedSubsystem = "oldest_blocked"

func init() {
registerCollector(oldestBlockedSubsystem, defaultEnabled, NewPGOldestBlockedCollector)
registerCollector(oldestBlockedSubsystem, defaultDisabled, NewPGOldestBlockedCollector)
}

type PGOldestBlockedCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_slow.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const slowSubsystem = "slow"

func init() {
registerCollector(slowSubsystem, defaultEnabled, NewPGSlowCollector)
registerCollector(slowSubsystem, defaultDisabled, NewPGSlowCollector)
}

type PGSlowCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_stat_activity_autovacuum.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const statActivityAutovacuumSubsystem = "stat_activity_autovacuum"

func init() {
registerCollector(statActivityAutovacuumSubsystem, defaultEnabled, NewPGStatActivityAutovacuumCollector)
registerCollector(statActivityAutovacuumSubsystem, defaultDisabled, NewPGStatActivityAutovacuumCollector)
}

type PGStatActivityAutovacuumCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_stat_activity_autovacuum_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const statActivityAutovacuumActiveSubsystem = "stat_activity_autovacuum_active"

func init() {
registerCollector(statActivityAutovacuumActiveSubsystem, defaultEnabled, NewPGStatActivityAutovacuumActiveCollector)
registerCollector(statActivityAutovacuumActiveSubsystem, defaultDisabled, NewPGStatActivityAutovacuumActiveCollector)
}

type PGStatActivityAutovacuumActiveCollector struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@ import (
"github.com/prometheus/client_golang/prometheus"
)

const statActivityMarginaliaSubsystem = "stat_activity_marginalia"
const statActivitySummarySubsystem = "stat_activity_summary"

func init() {
registerCollector(statActivityMarginaliaSubsystem, defaultEnabled, NewPGStatActivityMarginaliaCollector)
registerCollector(statActivitySummarySubsystem, defaultEnabled, NewPGStatActivitySummaryCollector)
}

type PGStatActivityMarginaliaCollector struct {
type PGStatActivitySummaryCollector struct {
log log.Logger
}

func NewPGStatActivityMarginaliaCollector(config collectorConfig) (Collector, error) {
return &PGStatActivityMarginaliaCollector{log: config.logger}, nil
func NewPGStatActivitySummaryCollector(config collectorConfig) (Collector, error) {
return &PGStatActivitySummaryCollector{log: config.logger}, nil
}

var (
statActivityMarginaliaActiveCount = prometheus.NewDesc(
prometheus.BuildFQName(namespace, statActivityMarginaliaSubsystem, "active_count"),
statActivitySummaryActiveCount = prometheus.NewDesc(
prometheus.BuildFQName(namespace, statActivitySummarySubsystem, "active_count"),
"Number of active queries at time of sample",
[]string{"usename", "application", "endpoint", "command", "state", "wait_event", "wait_event_type"},
prometheus.Labels{},
)
statActivityMarginaliaMaxTxAgeInSeconds = prometheus.NewDesc(
prometheus.BuildFQName(namespace, statActivityMarginaliaSubsystem, "max_tx_age_in_seconds"),
statActivitySummaryMaxTxAgeInSeconds = prometheus.NewDesc(
prometheus.BuildFQName(namespace, statActivitySummarySubsystem, "max_tx_age_in_seconds"),
"Number of active queries at time of sample",
[]string{"usename", "application", "endpoint", "command", "state", "wait_event", "wait_event_type"},
prometheus.Labels{},
)

statActivityMarginaliaQuery = `
statActivitySummaryQuery = `
SELECT
usename AS usename,
a.matches[1] AS application,
Expand All @@ -75,10 +75,10 @@ var (
`
)

func (PGStatActivityMarginaliaCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
func (PGStatActivitySummaryCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
db := instance.getDB()
rows, err := db.QueryContext(ctx,
statActivityMarginaliaQuery)
statActivitySummaryQuery)

if err != nil {
return err
Expand All @@ -94,13 +94,13 @@ func (PGStatActivityMarginaliaCollector) Update(ctx context.Context, instance *i
}

ch <- prometheus.MustNewConstMetric(
statActivityMarginaliaActiveCount,
statActivitySummaryActiveCount,
prometheus.GaugeValue,
count,
usename, application, endpoint, command, state, waitEvent, waitEventType,
)
ch <- prometheus.MustNewConstMetric(
statActivityMarginaliaMaxTxAgeInSeconds,
statActivitySummaryMaxTxAgeInSeconds,
prometheus.GaugeValue,
maxTxAge,
usename, application, endpoint, command, state, waitEvent, waitEventType,
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_stat_user_indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

func init() {
registerCollector(statUserIndexesSubsystem, defaultEnabled, NewPGStatUserIndexesCollector)
registerCollector(statUserIndexesSubsystem, defaultDisabled, NewPGStatUserIndexesCollector)
}

type PGStatUserIndexesCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_stat_walreceiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

func init() {
registerCollector(statWalReceiverSubsystem, defaultEnabled, NewPGStatWalReceiverCollector)
registerCollector(statWalReceiverSubsystem, defaultDisabled, NewPGStatWalReceiverCollector)
}

type PGStatWalReceiverCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_statio_user_indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

func init() {
registerCollector(statioUserIndexesSubsystem, defaultEnabled, NewPGStatioUserIndexesCollector)
registerCollector(statioUserIndexesSubsystem, defaultDisabled, NewPGStatioUserIndexesCollector)
}

type PGStatioUserIndexesCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_stuck_idle_in_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const stuckIdleInTransactionSubsystem = "stuck_in_transaction"

func init() {
registerCollector(stuckIdleInTransactionSubsystem, defaultEnabled, NewPGStuckIdleInTransactionCollector)
registerCollector(stuckIdleInTransactionSubsystem, defaultDisabled, NewPGStuckIdleInTransactionCollector)
}

type PGStuckIdleInTransactionCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_total_relation_size.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const totalRelationSizeSubsystem = "total_relation_size"

func init() {
registerCollector(totalRelationSizeSubsystem, defaultEnabled, NewPGTotalRelationSizeCollector)
registerCollector(totalRelationSizeSubsystem, defaultDisabled, NewPGTotalRelationSizeCollector)
}

type PGTotalRelationSizeCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_xid.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const xidSubsystem = "xid"

func init() {
registerCollector(xidSubsystem, defaultEnabled, NewPGXidCollector)
registerCollector(xidSubsystem, defaultDisabled, NewPGXidCollector)
}

type PGXidCollector struct {
Expand Down
2 changes: 1 addition & 1 deletion collector/pg_xlog_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
const xlogLocationSubsystem = "xlog_location"

func init() {
registerCollector(xlogLocationSubsystem, defaultEnabled, NewPGXlogLocationCollector)
registerCollector(xlogLocationSubsystem, defaultDisabled, NewPGXlogLocationCollector)
}

type PGXlogLocationCollector struct {
Expand Down

0 comments on commit 8f1a3e0

Please sign in to comment.