Documentation ¶
Overview ¶
Package monitoring is used for monitoring agent. This is based off iamseth/oracledb_exporter. The significant difference is the reliance on yaml instead of toml and the use of gRPC via dbdaemon instead of oracle client and tcp.
Index ¶
- func GeneratePrometheusMetrics(dbdClient dbdpb.DatabaseDaemonClient, parse func(row map[string]string) error, ...) error
- func GetMetricType(metricType string, metricsType map[string]string) prometheus.ValueType
- func ParseSQLResponse(resp *dbdpb.RunCMDResponse) ([]map[string]string, error)
- func ScrapeGenericValues(dbdClient dbdpb.DatabaseDaemonClient, ch chan<- prometheus.Metric, ...) error
- func ScrapeMetric(dbdClient dbdpb.DatabaseDaemonClient, ch chan<- prometheus.Metric, ...) error
- type Exporter
- type Metric
- type Metrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePrometheusMetrics ¶
func GeneratePrometheusMetrics(dbdClient dbdpb.DatabaseDaemonClient, parse func(row map[string]string) error, query string) error
GeneratePrometheusMetrics parses metric query SQL results. Inspired by https://kylewbanks.com/blog/query-result-to-map-in-golang
func GetMetricType ¶
func GetMetricType(metricType string, metricsType map[string]string) prometheus.ValueType
GetMetricType returns the prometheus type of a metric.
func ParseSQLResponse ¶
func ParseSQLResponse(resp *dbdpb.RunCMDResponse) ([]map[string]string, error)
ParseSQLResponse parses the JSON result-set (returned by runSQLPlus API) and returns a list of rows with column-value mapping.
func ScrapeGenericValues ¶
func ScrapeGenericValues(dbdClient dbdpb.DatabaseDaemonClient, ch chan<- prometheus.Metric, context string, labels []string, metricsDesc map[string]string, metricsType map[string]string, metricsBuckets map[string]map[string]string, fieldToAppend string, ignoreZeroResult bool, request string) error
ScrapeGenericValues is a generic method for retrieving metrics.
func ScrapeMetric ¶
func ScrapeMetric(dbdClient dbdpb.DatabaseDaemonClient, ch chan<- prometheus.Metric, metricDefinition Metric) error
ScrapeMetric calls ScrapeGenericValues using Metric struct values.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter collects Oracle DB metrics. It implements prometheus.Collector.
func NewExporter ¶
func NewExporter(ctx context.Context, defaultFileMetrics, customMetrics, service string, port int, qt string) (*Exporter, error)
NewExporter returns a new Oracle DB exporter for the provided DSN.
func (*Exporter) Collect ¶
func (e *Exporter) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*Exporter) Describe ¶
func (e *Exporter) Describe(ch chan<- *prometheus.Desc)
Describe describes all the metrics exported by the Oracle DB exporter.
type Metric ¶
type Metric struct { Context string `yaml:"context"` Labels []string `yaml:"labels"` MetricsDesc map[string]string `yaml:"metricsdesc"` MetricsType map[string]string `yaml:"metricstype"` MetricsBuckets map[string]map[string]string `yaml:"metricsbuckets"` FieldToAppend string `yaml:"fieldtoappend"` Request string `yaml:"request"` IgnoreZeroResult bool `yaml:"ignorezeroresult"` }
Metric describes labels, type, and other information of a metric.