2025-06-09 16:43:29 +05:30
|
|
|
package statsreporter
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
"github.com/SigNoz/signoz/pkg/factory"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
|
// Enabled is a flag to enable or disable the stats reporter.
|
|
|
|
|
Enabled bool `mapstructure:"enabled"`
|
|
|
|
|
|
|
|
|
|
// Interval is the interval at which the stats are collected.
|
|
|
|
|
Interval time.Duration `mapstructure:"interval"`
|
2025-06-18 01:54:55 +05:30
|
|
|
|
|
|
|
|
// Collect is the collection configuration.
|
|
|
|
|
Collect Collect `mapstructure:"collect"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Collect struct {
|
|
|
|
|
Identities bool `mapstructure:"identities"`
|
2025-06-09 16:43:29 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewConfigFactory() factory.ConfigFactory {
|
|
|
|
|
return factory.NewConfigFactory(factory.MustNewName("statsreporter"), newConfig)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func newConfig() factory.Config {
|
|
|
|
|
return Config{
|
|
|
|
|
Enabled: true,
|
|
|
|
|
Interval: 6 * time.Hour,
|
2025-06-18 01:54:55 +05:30
|
|
|
Collect: Collect{
|
|
|
|
|
Identities: true,
|
|
|
|
|
},
|
2025-06-09 16:43:29 +05:30
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c Config) Validate() error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (c Config) Provider() string {
|
|
|
|
|
if c.Enabled {
|
|
|
|
|
return "analytics"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "noop"
|
|
|
|
|
}
|