plugins

package
v0.0.0-...-98c352f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresMetrics

type PostgresMetrics struct {
	// contains filtered or unexported fields
}

PostgresMetrics holds all metrics for the PostgreSQL plugin

func NewPostgresMetrics

func NewPostgresMetrics(namespace string) *PostgresMetrics

NewPostgresMetrics initializes and registers all PostgreSQL metrics

func (*PostgresMetrics) BatchOperationTotal

func (m *PostgresMetrics) BatchOperationTotal(job, database string)

BatchOperationTotal increments the batch operation counter

func (*PostgresMetrics) ConnectionError

func (m *PostgresMetrics) ConnectionError(job, database, errorType string)

ConnectionError increments the connection error counter

func (*PostgresMetrics) CopyOperationTotal

func (m *PostgresMetrics) CopyOperationTotal(job, database, table, status string)

CopyOperationTotal increments the copy operation counter

func (*PostgresMetrics) CopyRowsProcessed

func (m *PostgresMetrics) CopyRowsProcessed(job, database, table string, count int64)

CopyRowsProcessed increments the copy rows processed counter

func (*PostgresMetrics) ListenerError

func (m *PostgresMetrics) ListenerError(job, database, channel, errorType string)

ListenerError increments the listener error counter

func (*PostgresMetrics) NotificationReceived

func (m *PostgresMetrics) NotificationReceived(job, database, channel string)

NotificationReceived increments the notification received counter

func (*PostgresMetrics) ObserveBatchOperationDuration

func (m *PostgresMetrics) ObserveBatchOperationDuration(job, database string, durationSeconds float64)

ObserveBatchOperationDuration records the duration of a batch operation

func (*PostgresMetrics) ObserveBatchSize

func (m *PostgresMetrics) ObserveBatchSize(job, database string, size int)

ObserveBatchSize records the size of a batch operation

func (*PostgresMetrics) ObserveConnectionAcquireTime

func (m *PostgresMetrics) ObserveConnectionAcquireTime(job, database string, durationSeconds float64)

ObserveConnectionAcquireTime records the time taken to acquire a connection

func (*PostgresMetrics) ObserveCopyDuration

func (m *PostgresMetrics) ObserveCopyDuration(job, database, table string, durationSeconds float64)

ObserveCopyDuration records the duration of a copy operation

func (*PostgresMetrics) ObservePingDuration

func (m *PostgresMetrics) ObservePingDuration(job, database string, durationSeconds float64)

ObservePingDuration records the duration of a ping operation

func (*PostgresMetrics) ObservePoolConnectionLifetime

func (m *PostgresMetrics) ObservePoolConnectionLifetime(job, database string, durationSeconds float64)

ObservePoolConnectionLifetime records the lifetime of a connection

func (*PostgresMetrics) ObservePoolConnectionWaitTime

func (m *PostgresMetrics) ObservePoolConnectionWaitTime(job, database string, durationSeconds float64)

ObservePoolConnectionWaitTime records the time spent waiting for a connection

func (*PostgresMetrics) ObserveQueryDuration

func (m *PostgresMetrics) ObserveQueryDuration(job, database, queryType, table string, durationSeconds float64)

ObserveQueryDuration records the duration of a query

func (*PostgresMetrics) ObserveTransactionDuration

func (m *PostgresMetrics) ObserveTransactionDuration(job, database string, durationSeconds float64)

ObserveTransactionDuration records the duration of a transaction

func (*PostgresMetrics) OperationError

func (m *PostgresMetrics) OperationError(job, database, operation, errorType string)

OperationError increments the operation error counter

func (*PostgresMetrics) PoolConnectionRequest

func (m *PostgresMetrics) PoolConnectionRequest(job, database string)

PoolConnectionRequest increments the connection requests counter

func (*PostgresMetrics) PoolConnectionTimeout

func (m *PostgresMetrics) PoolConnectionTimeout(job, database string)

PoolConnectionTimeout increments the connection timeout counter

func (*PostgresMetrics) PreparedQueryUsage

func (m *PostgresMetrics) PreparedQueryUsage(job, database, queryName string)

PreparedQueryUsage increments the prepared query usage counter

func (*PostgresMetrics) QueryTotal

func (m *PostgresMetrics) QueryTotal(job, database, queryType, status string)

QueryTotal increments the query counter

func (*PostgresMetrics) RowsProcessed

func (m *PostgresMetrics) RowsProcessed(job, database, operation, table string, count int)

RowsProcessed increments the rows processed counter

func (*PostgresMetrics) SetPoolActiveConnections

func (m *PostgresMetrics) SetPoolActiveConnections(job, database string, count int)

SetPoolActiveConnections sets the active connections gauge

func (*PostgresMetrics) SetPoolIdleConnections

func (m *PostgresMetrics) SetPoolIdleConnections(job, database string, count int)

SetPoolIdleConnections sets the idle connections gauge

func (*PostgresMetrics) SetPoolMaxConnections

func (m *PostgresMetrics) SetPoolMaxConnections(job, database string, count int)

SetPoolMaxConnections sets the max connections gauge

func (*PostgresMetrics) SetPoolTotalConnections

func (m *PostgresMetrics) SetPoolTotalConnections(job, database string, count int)

SetPoolTotalConnections sets the total connections gauge

func (*PostgresMetrics) TransactionOperation

func (m *PostgresMetrics) TransactionOperation(job, database, operationType string)

TransactionOperation increments the transaction operation counter

func (*PostgresMetrics) TransactionRollback

func (m *PostgresMetrics) TransactionRollback(job, database, reason string)

TransactionRollback increments the transaction rollback counter

func (*PostgresMetrics) TransactionSavepoint

func (m *PostgresMetrics) TransactionSavepoint(job, database, operation string)

TransactionSavepoint increments the transaction savepoint counter

func (*PostgresMetrics) TransactionTotal

func (m *PostgresMetrics) TransactionTotal(job, database, status string)

TransactionTotal increments the transaction counter

type PostgresPlugin

type PostgresPlugin struct {
	// contains filtered or unexported fields
}

PostgresPlugin implements the nautilus.DatabasePlugin interface for PostgreSQL

func NewPostgresPlugin

func NewPostgresPlugin(config *PostgresPluginConfig, namespace string) *PostgresPlugin

NewPostgresPlugin creates a new PostgreSQL plugin

func (*PostgresPlugin) BatchOperations

func (p *PostgresPlugin) BatchOperations(ctx context.Context) (*pgx.Batch, error)

BatchOperations executes multiple operations in a batch

func (*PostgresPlugin) Connect

func (p *PostgresPlugin) Connect(ctx context.Context) error

Connect establishes a connection to the database

func (*PostgresPlugin) CopyFrom

func (p *PostgresPlugin) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)

CopyFrom efficiently copies data from a source to a table

func (*PostgresPlugin) CreateTransaction

func (p *PostgresPlugin) CreateTransaction(ctx context.Context) (pgx.Tx, error)

CreateTransaction starts a new transaction

func (*PostgresPlugin) Disconnect

func (p *PostgresPlugin) Disconnect(ctx context.Context) error

Disconnect closes the database connection

func (*PostgresPlugin) ExecuteBatch

func (p *PostgresPlugin) ExecuteBatch(ctx context.Context, batch *pgx.Batch) (pgx.BatchResults, error)

ExecuteBatch executes a batch of operations

func (*PostgresPlugin) ExecuteCommand

func (p *PostgresPlugin) ExecuteCommand(ctx context.Context, command string, args ...any) (int64, error)

ExecuteCommand executes a command and returns the number of affected rows

func (*PostgresPlugin) ExecuteQuery

func (p *PostgresPlugin) ExecuteQuery(ctx context.Context, query string, args ...any) (pgx.Rows, error)

ExecuteQuery executes a query and returns rows

func (*PostgresPlugin) ExecuteQueryRow

func (p *PostgresPlugin) ExecuteQueryRow(ctx context.Context, query string, args ...any) (pgx.Row, error)

ExecuteQueryRow executes a query and returns a single row

func (*PostgresPlugin) GetPool

func (p *PostgresPlugin) GetPool() *pgxpool.Pool

GetPool returns the underlying connection pool

func (*PostgresPlugin) HandleNotification

func (p *PostgresPlugin) HandleNotification(channel string)

HandleNotification should be called when a notification is received

func (*PostgresPlugin) Initialize

func (p *PostgresPlugin) Initialize(ctx context.Context) error

Initialize sets up the plugin

func (*PostgresPlugin) Listen

func (p *PostgresPlugin) Listen(ctx context.Context, channel string) (*pgx.Conn, error)

Listen establishes a LISTEN/NOTIFY connection

func (*PostgresPlugin) Name

func (p *PostgresPlugin) Name() string

Name returns the plugin name

func (*PostgresPlugin) Ping

func (p *PostgresPlugin) Ping(ctx context.Context) error

Ping verifies the database connection is alive

func (*PostgresPlugin) Terminate

func (p *PostgresPlugin) Terminate(ctx context.Context) error

Terminate cleans up resources

func (*PostgresPlugin) UpdatePoolMetrics

func (p *PostgresPlugin) UpdatePoolMetrics()

UpdatePoolMetrics updates connection pool metrics

type PostgresPluginConfig

type PostgresPluginConfig struct {
	Job             string        `json:"job"`
	ConnString      string        `json:"connString"`
	MaxRetries      int           `json:"maxRetries"`
	RetryDelay      time.Duration `json:"retryDelay"`
	MaxConns        int           `json:"maxConns"`
	MinConns        int           `json:"minConns"`
	MaxConnIdleTime time.Duration `json:"maxConnIdleTime"`
	MaxConnLifetime time.Duration `json:"maxConnLifetime"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL