mirror of
https://github.com/hanzoai/otel-collector.git
synced 2026-11-03 02:20:04 +00:00
- Go module: github.com/SigNoz/signoz-otel-collector → github.com/hanzoai/otel-collector - All signoz-prefixed packages → o11y-prefixed - Docker: signoz/* → ghcr.io/hanzoai/otel-collector - ClickHouse exporter → Hanzo Datastore - Env vars: SIGNOZ_* → HANZO_* - Directory renames for all processor/receiver/exporter packages
95 lines
3.2 KiB
Go
95 lines
3.2 KiB
Go
package config
|
|
|
|
import (
|
|
"time"
|
|
|
|
o11ycolFeatureGate "github.com/hanzoai/otel-collector/featuregate"
|
|
"github.com/spf13/cobra"
|
|
otelcolFeatureGate "go.opentelemetry.io/collector/featuregate"
|
|
)
|
|
|
|
var (
|
|
Collector collector
|
|
Clickhouse clickhouse
|
|
MigrateReady migrateReady
|
|
MigrateBootstrap migrateBootstrap
|
|
MigrateSyncCheck migrateSyncCheck
|
|
MigrateSyncUp migrateSyncUp
|
|
MigrateAsyncCheck migrateAsyncCheck
|
|
MigrateAsyncUp migrateAsyncUp
|
|
)
|
|
|
|
type collector struct {
|
|
Config string
|
|
ManagerConfig string
|
|
CopyPath string
|
|
}
|
|
|
|
func (cfg *collector) RegisterFlags(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().StringVar(&cfg.Config, "config", "", "File path for the collector configuration")
|
|
cmd.PersistentFlags().StringVar(&cfg.ManagerConfig, "manager-config", "", "File path for the agent manager configuration")
|
|
cmd.PersistentFlags().StringVar(&cfg.CopyPath, "copy-path", "/etc/otel/o11ycol-config.yaml", "File path for the copied collector configuration")
|
|
cmd.PersistentFlags().Var(o11ycolFeatureGate.NewFlag(otelcolFeatureGate.GlobalRegistry()), "feature-gates",
|
|
"Comma-delimited list of feature gate identifiers. Prefix with '-' to disable the feature. '+' or no prefix will enable the feature.")
|
|
}
|
|
|
|
type clickhouse struct {
|
|
DSN string
|
|
Cluster string
|
|
Replication bool
|
|
}
|
|
|
|
func (cfg *clickhouse) RegisterFlags(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().StringVar(&cfg.DSN, "clickhouse-dsn", "tcp://0.0.0.0:9001", "DSN for clickhouse connection")
|
|
cmd.PersistentFlags().StringVar(&cfg.Cluster, "clickhouse-cluster", "cluster", "Name of the clickhouse cluster to connect")
|
|
cmd.PersistentFlags().BoolVar(&cfg.Replication, "clickhouse-replication", true, "Set true if replication is enabled in the clickhouse cluster")
|
|
}
|
|
|
|
type migrateReady struct {
|
|
Timeout time.Duration
|
|
}
|
|
|
|
func (cfg *migrateReady) RegisterFlags(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().DurationVar(&cfg.Timeout, "timeout", time.Duration(10*time.Second), "Timeout for migrate ready operation")
|
|
}
|
|
|
|
type migrateSyncCheck struct {
|
|
Timeout time.Duration
|
|
}
|
|
|
|
func (cfg *migrateSyncCheck) RegisterFlags(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().DurationVar(&cfg.Timeout, "timeout", time.Duration(10*time.Second), "Timeout for sync check operation")
|
|
}
|
|
|
|
type migrateBootstrap struct {
|
|
Timeout time.Duration
|
|
}
|
|
|
|
func (cfg *migrateBootstrap) RegisterFlags(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().DurationVar(&cfg.Timeout, "timeout", time.Duration(15*time.Minute), "Timeout for bootstrap operation")
|
|
}
|
|
|
|
type migrateSyncUp struct {
|
|
Timeout time.Duration
|
|
}
|
|
|
|
func (cfg *migrateSyncUp) RegisterFlags(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().DurationVar(&cfg.Timeout, "timeout", time.Duration(10*time.Second), "Timeout for sync up operation")
|
|
}
|
|
|
|
type migrateAsyncCheck struct {
|
|
Timeout time.Duration
|
|
}
|
|
|
|
func (cfg *migrateAsyncCheck) RegisterFlags(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().DurationVar(&cfg.Timeout, "timeout", time.Duration(10*time.Second), "Timeout for async check operation")
|
|
}
|
|
|
|
type migrateAsyncUp struct {
|
|
Timeout time.Duration
|
|
}
|
|
|
|
func (cfg *migrateAsyncUp) RegisterFlags(cmd *cobra.Command) {
|
|
cmd.PersistentFlags().DurationVar(&cfg.Timeout, "timeout", time.Duration(10*time.Second), "Timeout for async up operation")
|
|
}
|