mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
* chore(api_key): add api key analytics * feat(analytics): move frontend events * feat(analytics): add collect config * feat(analytics): add collect config * feat(analytics): fix traits * feat(analytics): fix traits * feat(analytics): fix traits * feat(analytics): fix traits * feat(analytics): fix traits * feat(analytics): fix factor api key * fix(analytics): fix org stats * fix(analytics): fix org stats
49 lines
906 B
Go
49 lines
906 B
Go
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"`
|
|
|
|
// Collect is the collection configuration.
|
|
Collect Collect `mapstructure:"collect"`
|
|
}
|
|
|
|
type Collect struct {
|
|
Identities bool `mapstructure:"identities"`
|
|
}
|
|
|
|
func NewConfigFactory() factory.ConfigFactory {
|
|
return factory.NewConfigFactory(factory.MustNewName("statsreporter"), newConfig)
|
|
}
|
|
|
|
func newConfig() factory.Config {
|
|
return Config{
|
|
Enabled: true,
|
|
Interval: 6 * time.Hour,
|
|
Collect: Collect{
|
|
Identities: true,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (c Config) Validate() error {
|
|
return nil
|
|
}
|
|
|
|
func (c Config) Provider() string {
|
|
if c.Enabled {
|
|
return "analytics"
|
|
}
|
|
|
|
return "noop"
|
|
}
|