Documentation
¶
Index ¶
- Constants
- Variables
- func BuildDataSourceString(config Config) (string, error)
- func IsValidDriver(driver string) bool
- type ClientProviderFunc
- type Config
- type Db
- type DbClient
- type DbProviderFunc
- type DbSQLClient
- type DbWrapper
- type FakeDBClient
- type LogsCfg
- type MetricAggregation
- type MetricCfg
- type MetricType
- type MetricValueType
- type Query
- type SQLOpenerFunc
- type Scraper
- type StringMap
- type TelemetryConfig
- type TelemetryLogsConfig
Constants ¶
View Source
const ( DriverHDB = "hdb" DriverMySQL = "mysql" DriverOracle = "oracle" DriverPostgres = "postgres" DriverSnowflake = "snowflake" DriverSQLServer = "sqlserver" DriverTDS = "tds" )
Variables ¶
View Source
var ErrNullValueWarning = errors.New("NULL value")
Functions ¶
func BuildDataSourceString ¶ added in v0.129.0
func IsValidDriver ¶ added in v0.129.0
IsValidDriver checks if the given driver name is supported
Types ¶
type ClientProviderFunc ¶
type Config ¶
type Config struct {
scraperhelper.ControllerConfig `mapstructure:",squash"`
Driver string `mapstructure:"driver"`
DataSource string `mapstructure:"datasource"`
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Database string `mapstructure:"database"`
Username string `mapstructure:"username"`
Password configopaque.String `mapstructure:"password"`
AdditionalParams map[string]any `mapstructure:"additional_params"`
Queries []Query `mapstructure:"queries"`
StorageID *component.ID `mapstructure:"storage"`
Telemetry TelemetryConfig `mapstructure:"telemetry"`
}
type DbClient ¶
func NewDbClient ¶
type DbProviderFunc ¶
type DbSQLClient ¶
type DbSQLClient struct {
Db Db
Logger *zap.Logger
Telemetry TelemetryConfig
SQL string
}
type FakeDBClient ¶
This is only used for testing, but need to be exposed to other packages.
type LogsCfg ¶
type MetricAggregation ¶
type MetricAggregation string
const ( MetricAggregationUnspecified MetricAggregation = "" MetricAggregationCumulative MetricAggregation = "cumulative" MetricAggregationDelta MetricAggregation = "delta" )
func (MetricAggregation) Validate ¶
func (a MetricAggregation) Validate() error
type MetricCfg ¶
type MetricCfg struct {
MetricName string `mapstructure:"metric_name"`
ValueColumn string `mapstructure:"value_column"`
AttributeColumns []string `mapstructure:"attribute_columns"`
Monotonic bool `mapstructure:"monotonic"`
ValueType MetricValueType `mapstructure:"value_type"`
DataType MetricType `mapstructure:"data_type"`
Aggregation MetricAggregation `mapstructure:"aggregation"`
Unit string `mapstructure:"unit"`
Description string `mapstructure:"description"`
StaticAttributes map[string]string `mapstructure:"static_attributes"`
StartTsColumn string `mapstructure:"start_ts_column"`
TsColumn string `mapstructure:"ts_column"`
}
type MetricType ¶
type MetricType string
const ( MetricTypeUnspecified MetricType = "" MetricTypeGauge MetricType = "gauge" MetricTypeSum MetricType = "sum" )
func (MetricType) Validate ¶
func (t MetricType) Validate() error
type MetricValueType ¶
type MetricValueType string
const ( MetricValueTypeUnspecified MetricValueType = "" MetricValueTypeInt MetricValueType = "int" MetricValueTypeDouble MetricValueType = "double" )
func (MetricValueType) Validate ¶
func (t MetricValueType) Validate() error
type Query ¶
type Scraper ¶
type Scraper struct {
Query Query
ScrapeCfg scraperhelper.ControllerConfig
StartTime pcommon.Timestamp
ClientProviderFunc ClientProviderFunc
DbProviderFunc DbProviderFunc
Logger *zap.Logger
Telemetry TelemetryConfig
Client DbClient
Db *sql.DB
InstrumentationScope pcommon.InstrumentationScope
// contains filtered or unexported fields
}
func NewScraper ¶
func NewScraper(id component.ID, query Query, scrapeCfg scraperhelper.ControllerConfig, logger *zap.Logger, telemetry TelemetryConfig, dbProviderFunc DbProviderFunc, clientProviderFunc ClientProviderFunc, instrumentationScope pcommon.InstrumentationScope) *Scraper
func (*Scraper) ScrapeMetrics ¶ added in v0.115.0
type TelemetryConfig ¶
type TelemetryConfig struct {
Logs TelemetryLogsConfig `mapstructure:"logs"`
}
type TelemetryLogsConfig ¶
type TelemetryLogsConfig struct {
Query bool `mapstructure:"query"`
}
Click to show internal directories.
Click to hide internal directories.