mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-10-30 18:26:25 +00:00
- imports: ClickHouse/ch-go, clickhouse-go/v2, srikanthccv/ClickHouse-go-mock
-> github.com/hanzo-ds/{native,go,mock} (require, clean semver, NO replace)
- identifiers/aliases/type-names/config-keys/type-IDs: clickhouse -> datastore
(receiver dir clickhousesystemtablesreceiver -> datastoresystemtablesreceiver)
- DSN scheme clickhouse:// -> datastore:// (driver treats non-http/https as Native)
- removed the go.opencensus.io version-pin replace (require-pinned instead)
- kept: real external refs (github.com/ClickHouse, clickhouse.com docs) and the
hanzo-ds/mock test API (NewClickHouseNative) pending the mock's own rename
Full ./... build passes. 0 replace directives, 0 signoz.
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package datastoresystemtablesreceiver
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"go.uber.org/multierr"
|
|
)
|
|
|
|
type QueryLogScrapeConfig struct {
|
|
ScrapeIntervalSeconds uint32 `mapstructure:"scrape_interval_seconds"`
|
|
|
|
// Must be configured to a value greater than flush_interval_milliseconds setting for query_log
|
|
// For details see https://clickhouse.com/docs/en/operations/server-configuration-parameters/settings#query-log
|
|
MinScrapeDelaySeconds uint32 `mapstructure:"min_scrape_delay_seconds"`
|
|
}
|
|
|
|
type Config struct {
|
|
DSN string `mapstructure:"dsn"`
|
|
|
|
// Cluster name to use for scraping query log from clustered deployments.
|
|
// If ClusterName is specified, the scrape will target `clusterAllReplicas(cluster_name, system.query_log)`
|
|
ClusterName string `mapstructure:"cluster_name"`
|
|
|
|
QueryLogScrapeConfig QueryLogScrapeConfig `mapstructure:"query_log_scrape_config"`
|
|
}
|
|
|
|
func (cfg *Config) Validate() (err error) {
|
|
if cfg.DSN == "" {
|
|
err = multierr.Append(err, errors.New("dsn must be specified"))
|
|
}
|
|
|
|
if cfg.QueryLogScrapeConfig.MinScrapeDelaySeconds == 0 {
|
|
err = multierr.Append(err, errors.New("query_log_scrape_config.scrape_delay_seconds must be set to a value greater than flush_interval_milliseconds setting for datastore query_log table"))
|
|
}
|
|
|
|
return err
|
|
}
|