Documentation
¶
Index ¶
- type AZVault
- type Config
- type ConnectConfig
- type Database
- type DatabaseConfig
- type Exporter
- func (e *Exporter) Collect(ch chan<- prometheus.Metric)
- func (e *Exporter) DefaultMetrics() Metrics
- func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
- func (e *Exporter) GetDBs() []*Database
- func (e *Exporter) RunScheduledScrapes(ctx context.Context)
- func (e *Exporter) ScrapeMetric(d *Database, ch chan<- prometheus.Metric, m Metric) error
- type LoggingConfig
- type Metric
- type Metrics
- type MetricsConfiguration
- type MetricsFilesConfig
- type OCIVault
- type ScrapeContext
- type ScrapeResult
- type VaultConfig
- type WebConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ConfigFile string
User string
Password string
ConnectString string
DbRole dsn.AdminRole
ConfigDir string
ExternalAuth bool
MaxIdleConns int
MaxOpenConns int
PoolIncrement int
PoolMaxConnections int
PoolMinConnections int
CustomMetrics string
QueryTimeout int
DefaultMetricsFile string
ScrapeInterval time.Duration
LoggingConfig LoggingConfig
}
type ConnectConfig ¶
type ConnectConfig struct {
Role dsn.AdminRole
TNSAdmin string `yaml:"tnsAdmin"`
ExternalAuth bool `yaml:"externalAuth"`
MaxOpenConns *int `yaml:"maxOpenConns"`
MaxIdleConns *int `yaml:"maxIdleConns"`
PoolIncrement *int `yaml:"poolIncrement"`
PoolMaxConnections *int `yaml:"poolMaxConnections"`
PoolMinConnections *int `yaml:"poolMinConnections"`
QueryTimeout *int `yaml:"queryTimeout"`
}
func (ConnectConfig) GetMaxIdleConns ¶
func (c ConnectConfig) GetMaxIdleConns() int
func (ConnectConfig) GetMaxOpenConns ¶
func (c ConnectConfig) GetMaxOpenConns() int
func (ConnectConfig) GetPoolIncrement ¶
func (c ConnectConfig) GetPoolIncrement() int
func (ConnectConfig) GetPoolMaxConnections ¶
func (c ConnectConfig) GetPoolMaxConnections() int
func (ConnectConfig) GetPoolMinConnections ¶
func (c ConnectConfig) GetPoolMinConnections() int
func (ConnectConfig) GetQueryTimeout ¶
func (c ConnectConfig) GetQueryTimeout() int
type Database ¶
func NewDatabase ¶
func NewDatabase(logger *slog.Logger, dbname string, dbconfig DatabaseConfig) *Database
func (*Database) DBTypeMetric ¶
func (d *Database) DBTypeMetric(exporterLabels map[string]string) prometheus.Metric
func (*Database) UpMetric ¶
func (d *Database) UpMetric(exporterLabels map[string]string) prometheus.Metric
func (*Database) WarmupConnectionPool ¶
WarmupConnectionPool serially acquires connections to "warm up" the connection pool. This is a workaround for a perceived bug in ODPI_C where rapid acquisition of connections results in a SIGABRT.
type DatabaseConfig ¶
type DatabaseConfig struct {
Username string
Password string
PasswordFile string `yaml:"passwordFile"`
URL string `yaml:"url"`
ConnectConfig `yaml:",inline"`
Vault *VaultConfig `yaml:"vault,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
}
func (DatabaseConfig) GetPassword ¶
func (d DatabaseConfig) GetPassword() string
func (DatabaseConfig) GetUsername ¶
func (d DatabaseConfig) GetUsername() string
type Exporter ¶
type Exporter struct {
*MetricsConfiguration
// contains filtered or unexported fields
}
Exporter collects Oracle DB metrics. It implements prometheus.Collector.
func NewExporter ¶
func NewExporter(logger *slog.Logger, m *MetricsConfiguration) *Exporter
NewExporter creates a new Exporter instance
func (*Exporter) Collect ¶
func (e *Exporter) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*Exporter) DefaultMetrics ¶
DefaultMetrics is a somewhat hacky way to load the default metrics
func (*Exporter) Describe ¶
func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
Describe describes all the metrics exported by the Oracle DB exporter.
func (*Exporter) RunScheduledScrapes ¶
RunScheduledScrapes is only relevant for users of this package that want to set the scrape on a timer rather than letting it be per Collect call
func (*Exporter) ScrapeMetric ¶
ScrapeMetric is an interface method to call scrapeGenericValues using Metric struct values
type LoggingConfig ¶
type Metric ¶
type Metric struct {
Context string
Labels []string
MetricsDesc map[string]string
MetricsType map[string]string
MetricsBuckets map[string]map[string]string
FieldToAppend string
Request string
IgnoreZeroResult bool
QueryTimeout string
ScrapeInterval string
Databases []string
}
Metric is an object description
type Metrics ¶
type Metrics struct {
Metric []Metric
}
Metrics is a container structure for prometheus metrics
type MetricsConfiguration ¶
type MetricsConfiguration struct {
ListenAddress string `yaml:"listenAddress"`
MetricsPath string `yaml:"metricsPath"`
Databases map[string]DatabaseConfig `yaml:"databases"`
Metrics MetricsFilesConfig `yaml:"metrics"`
Logging LoggingConfig `yaml:"log"`
Web WebConfig `yaml:"web"`
}
func LoadMetricsConfiguration ¶
func LoadMetricsConfiguration(logger *slog.Logger, cfg *Config, path string, flags *web.FlagConfig) (*MetricsConfiguration, error)
func (*MetricsConfiguration) CustomMetricsFiles ¶
func (m *MetricsConfiguration) CustomMetricsFiles() []string
func (*MetricsConfiguration) LogDestination ¶
func (m *MetricsConfiguration) LogDestination() string
func (*MetricsConfiguration) LogDisable ¶
func (m *MetricsConfiguration) LogDisable() int
func (*MetricsConfiguration) LogInterval ¶
func (m *MetricsConfiguration) LogInterval() time.Duration
func (*MetricsConfiguration) ScrapeInterval ¶
func (m *MetricsConfiguration) ScrapeInterval() time.Duration
type MetricsFilesConfig ¶
type ScrapeContext ¶
type ScrapeContext struct {
}
type ScrapeResult ¶
ScrapResult is container structure for error handling