Documentation
¶
Index ¶
Constants ¶
const ExporterName = "postgres"
ExporterName is the registered name of the postgres exporter template. It is the only sink allowed to carry sensible data.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter persists the sensible view of an event (request and response bodies only) into the owner-controlled Postgres store. It is sensible-only and can never be reused as a metadata sink.
func (*Exporter) Close ¶
func (e *Exporter) Close()
Close releases the connection pool exactly once; further Publish calls fail fast rather than touching a closed pool.
type Settings ¶
type Settings struct {
DSN string `mapstructure:"dsn"`
DSNEnv string `mapstructure:"dsn_env"`
// Table is validated against the module-owned table name; it is an explicit,
// forward-compatible knob and is not allowed to point anywhere else.
Table string `mapstructure:"table"`
}
Settings is the per-gateway configuration for the postgres exporter, decoded from the telemetry exporter Settings map. The DSN is referenced by env-var name so secrets stay out of the config file; a literal dsn is accepted for local development only.
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template builds postgres.Exporter instances and runs the sensible-store migrations the first time the exporter is built.
func NewTemplate ¶
NewTemplate returns a postgres ExporterTemplate bound to the given logger.
func (*Template) ValidateConfig ¶
ValidateConfig performs structural validation only; it never opens a connection or resolves the DSN env var.
func (*Template) WithSettings ¶
func (t *Template) WithSettings(settings map[string]interface{}) (appmetrics.Exporter, error)
WithSettings validates the settings, opens a dedicated pool, and applies the schema migrations (advisory-locked) before returning the exporter.