Documentation
¶
Overview ¶
Package pgproxy is the pg_proxy trace kind: a postgres wire proxy that processes under capture are pointed at through the environment the session exports. It records the SQL those processes run, which commons-db's own SQL tap never sees, as sql_statements rows.
Index ¶
Constants ¶
View Source
const Kind = "pg_proxy"
Kind is the kind a host registers NewKind as.
Variables ¶
This section is empty.
Functions ¶
func NewKind ¶
func NewKind() *tracing.Handler[Params, sqlstatements.StatementRow]
NewKind is the pg_proxy kind: statements masked and capped at 64KiB a value, as sql_statements stores them.
Types ¶
type Params ¶
type Params struct {
// DSN is the upstream postgres://, with $VAR references expanded. Empty
// falls back to GAVEL_DB_DSN, then DATABASE_URL.
DSN string `json:"dsn,omitempty" clicky:"title=Upstream DSN"`
// Env names the variable a process reads its DSN from, such as FIN_DB_URL.
// When DSN is unset the upstream is read from it, and the proxied DSN is
// exported under it so a process that reads only that variable is observed.
Env string `json:"env,omitempty" clicky:"title=DSN variable"`
// Params keeps bind parameter values in each statement's args. Off by
// default: bind values carry row data, the likeliest place for a secret.
Params bool `json:"params,omitempty" clicky:"title=Capture bind values"`
// Connection labels the statements, as sql_statements' connection column.
Connection string `json:"connection,omitempty" clicky:"title=Connection label"`
// MaxStatements bounds what one capture stores; reaching it marks the
// capture truncated rather than growing without limit.
MaxStatements int `json:"maxStatements,omitempty" clicky:"title=Maximum statements"`
}
Params choose the postgres the proxy forwards to and what it records.
type ProxyReport ¶
type ProxyReport struct {
sqlstatements.Summary
Upstream string `json:"upstream"`
Truncated bool `json:"truncated,omitempty"`
}
ProxyReport is what a running capture reports: the sql_statements summary of the statements it stored, and whether it stopped storing them.
Click to show internal directories.
Click to hide internal directories.