mirror of
https://github.com/hanzoai/o11y.git
synced 2026-11-03 02:04:48 +00:00
36 lines
911 B
Go
36 lines
911 B
Go
package metricsexplorer
|
|
|
|
import (
|
|
"github.com/hanzoai/o11y/pkg/errors"
|
|
"github.com/hanzoai/o11y/pkg/factory"
|
|
)
|
|
|
|
type Config struct {
|
|
// TelemetryStore is the telemetrystore configuration
|
|
TelemetryStore TelemetryStoreConfig `mapstructure:"telemetrystore"`
|
|
}
|
|
|
|
type TelemetryStoreConfig struct {
|
|
// Threads is the number of threads to use for Datastore queries
|
|
Threads int `mapstructure:"threads"`
|
|
}
|
|
|
|
func NewConfigFactory() factory.ConfigFactory {
|
|
return factory.NewConfigFactory(factory.MustNewName("metricsexplorer"), newConfig)
|
|
}
|
|
|
|
func newConfig() factory.Config {
|
|
return Config{
|
|
TelemetryStore: TelemetryStoreConfig{
|
|
Threads: 8, // Default value
|
|
},
|
|
}
|
|
}
|
|
|
|
func (c Config) Validate() error {
|
|
if c.TelemetryStore.Threads <= 0 {
|
|
return errors.NewInvalidInputf(errors.CodeInvalidInput, "metricsexplorer.telemetrystore.threads must be positive, got %d", c.TelemetryStore.Threads)
|
|
}
|
|
return nil
|
|
}
|