config

package
v0.26.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerName = "optimus"
	ClientName = "optimus-cli"
)
View Source
const (
	DefaultFilename       = "optimus.yaml"
	DefaultConfigFilename = "config.yaml" // default file name for server config
	DefaultFileExtension  = "yaml"
	DefaultEnvPrefix      = "OPTIMUS"
	EmptyPath             = ""
)

Variables

View Source
var (
	// overridden by the build system
	BuildVersion = "dev"
	BuildCommit  = ""
	BuildDate    = ""
)

Functions

func AppName

func AppName() string

AppName returns the name used as identifier in telemetry

func ValidateClientConfig

func ValidateClientConfig(conf *ClientConfig) error

func ValidateServerConfig

func ValidateServerConfig(_ *ServerConfig) error

Types

type AlertingConfig added in v0.11.7

type AlertingConfig struct {
	EventManager             EventManagerConfig       `mapstructure:"alert_manager"`
	Dashboard                string                   `mapstructure:"dashboard"`
	DataConsole              string                   `mapstructure:"data_console"`
	EnableSlack              bool                     `mapstructure:"enable_slack"`
	EnablePagerDuty          bool                     `mapstructure:"enable_pager_duty"`
	AutoSLABreachConfig      DurationEstimatorConfig  `mapstructure:"auto_sla_breach_config"`
	PotentialSLABreachConfig PotentialSLABreachConfig `mapstructure:"potential_sla_breach_config"`
}

type Auth added in v0.9.0

type Auth struct {
	ClientID     string `mapstructure:"client_id"`
	ClientSecret string `mapstructure:"client_secret"`
}

type BackfillConfig added in v0.25.0

type BackfillConfig struct {
	ExecutionIntervalInSeconds int `mapstructure:"execution_interval_in_seconds" default:"300"`
}

type ClientConfig

type ClientConfig struct {
	Version    Version      `mapstructure:"version"`
	Log        LogConfig    `mapstructure:"log"`
	Host       string       `mapstructure:"host"` // optimus server host
	Project    Project      `mapstructure:"project"`
	Namespaces []*Namespace `mapstructure:"namespaces"`
	Auth       Auth         `mapstructure:"auth"`
	// contains filtered or unexported fields
}

func LoadClientConfig

func LoadClientConfig(filePath string) (*ClientConfig, error)

LoadClientConfig load the project specific config from these locations: 1. filepath. ./optimus <client_command> -c "path/to/config/optimus.yaml" 2. current dir. Optimus will look at current directory if there's optimus.yaml there, use it

func (*ClientConfig) GetAllNamespaceNames

func (c *ClientConfig) GetAllNamespaceNames() []string

func (*ClientConfig) GetNamespaceByName

func (c *ClientConfig) GetNamespaceByName(name string) (*Namespace, error)

func (*ClientConfig) GetSelectedNamespaces

func (c *ClientConfig) GetSelectedNamespaces(namespaceNames ...string) ([]*Namespace, error)

func (*ClientConfig) ValidateNamespaceNames

func (c *ClientConfig) ValidateNamespaceNames(namespaceNames ...string) error

type Config

type Config interface{}

Config is just an alias for interface{}

type DBConfig

type DBConfig struct {
	DSN               string `mapstructure:"dsn"`                              // data source name e.g.: postgres://user:password@host:123/database?sslmode=disable
	MinOpenConnection int    `mapstructure:"min_open_connection" default:"5"`  // minimum open DB connections
	MaxOpenConnection int    `mapstructure:"max_open_connection" default:"20"` // maximum allowed open DB connections
}

type Datastore

type Datastore struct {
	Type   string            `mapstructure:"type"`   // type could be bigquery/postgres/gcs
	Path   string            `mapstructure:"path"`   // directory to find specifications
	Backup map[string]string `mapstructure:"backup"` // backup configuration
}

type DexClientConfig added in v0.22.14

type DexClientConfig struct {
	Host         string `mapstructure:"host" json:"host"`
	AuthEmail    string `mapstructure:"auth_email" json:"auth_email"`
	ProducerType string `mapstructure:"producer_type" json:"producer_type"`
}

type DurationEstimatorConfig added in v0.22.4

type DurationEstimatorConfig struct {
	LastNRuns         int `mapstructure:"last_n_runs" default:"7"`
	Percentile        int `mapstructure:"percentile" default:"95"`
	PaddingPercentage int `mapstructure:"padding_percentage" default:"0"`
	MinPaddingMinutes int `mapstructure:"min_padding_minutes" default:"0"`
	MaxPaddingMinutes int `mapstructure:"max_padding_minutes" default:"1000"`
}

type EventManagerConfig added in v0.11.7

type EventManagerConfig struct {
	Host     string `mapstructure:"host"`
	Endpoint string `mapstructure:"endpoint"`
	Enabled  bool   `mapstructure:"enabled" default:"true"`
}

type ExternalTablesConfig added in v0.19.0

type ExternalTablesConfig struct {
	AccessIssuesRetryInterval int64 `mapstructure:"access_issues_retry_interval_minutes"`
	SourceSyncInterval        int64 `mapstructure:"source_sync_interval_minutes"`
	MaxFileSizeSupported      int   `mapstructure:"max_drive_file_size_mb"`
	DriveFileCleanupSizeLimit int   `mapstructure:"drive_file_cleanup_size_limit_mb"`
	MaxSyncDelayTolerance     int64 `mapstructure:"max_sync_delay_tolerance_hours"`
}

type FeaturesConfig added in v0.19.0

type FeaturesConfig struct {
	EnableV2Sensor                    bool `mapstructure:"enable_v2_sensor"`
	EnableV3Sensor                    bool `mapstructure:"enable_v3_sensor"`
	EnableIgnoreOldScheduleRunsSensor bool `mapstructure:"enable_ignore_old_schedule_runs_sensor"`
	EnableTableCommentWithMetadata    bool `mapstructure:"enable_table_comment_with_metadata"`
}

type HistoricalDurationConfig added in v0.24.0

type HistoricalDurationConfig struct {
	LastNRuns  int `mapstructure:"last_n_runs" default:"7"`
	Percentile int `mapstructure:"percentile" default:"95"`
}

type Job

type Job struct {
	Path string `mapstructure:"path"` // directory to find specifications
}

type JobExecutionSummaryConfig added in v0.24.0

type JobExecutionSummaryConfig struct {
	MaxLineageDepth    int                      `mapstructure:"max_lineage_depth" default:"25"`
	HistoricalDuration HistoricalDurationConfig `mapstructure:"historical_duration"`
}

type JobExpectatorConfig added in v0.23.21

type JobExpectatorConfig struct {
	BufferDurationInMinutes int                     `mapstructure:"buffer_duration_in_minutes" default:"10"`
	DurationEstimatorConfig DurationEstimatorConfig `mapstructure:"duration_estimator_config"`
}

type JobValidationConfig added in v0.22.14

type JobValidationConfig struct {
	ValidateSchedule ValidateScheduleConfig `mapstructure:"validate_schedule"`
}

type LogConfig

type LogConfig struct {
	Level  LogLevel `mapstructure:"level" default:"INFO"` // log level - debug, info, warning, error, fatal
	Format string   `mapstructure:"format"`               // format strategy - plain, json
}

type LogLevel

type LogLevel string
const (
	LogLevelDebug   LogLevel = "DEBUG"
	LogLevelInfo    LogLevel = "INFO"
	LogLevelWarning LogLevel = "WARNING"
	LogLevelError   LogLevel = "ERROR"
	LogLevelFatal   LogLevel = "FATAL"
)

func (LogLevel) String

func (l LogLevel) String() string

type Namespace

type Namespace struct {
	Name      string            `mapstructure:"name"`
	Config    map[string]string `mapstructure:"config"`
	Variables map[string]string `mapstructure:"variables"`
	Job       Job               `mapstructure:"job"`
	Datastore []Datastore       `mapstructure:"datastore"`
}

type Optimus

type Optimus struct {
	// configuration version
	Version int `mapstructure:"version"`
	// optimus server host
	Host string `mapstructure:"host"`

	Project    Project      `mapstructure:"project"`
	Namespaces []*Namespace `mapstructure:"namespaces"`

	Server    Serve           `mapstructure:"serve"`
	Log       LogConfig       `mapstructure:"log"`
	Telemetry TelemetryConfig `mapstructure:"telemetry"`
	Alerting  AlertingConfig  `mapstructure:"alerting"`
	// contains filtered or unexported fields
}

func (*Optimus) GetNamespaceByName

func (o *Optimus) GetNamespaceByName(name string) (*Namespace, error)

func (*Optimus) GetVersion

func (o *Optimus) GetVersion() string

type Plugins added in v0.20.7

type Plugins struct {
	Location string `mapstructure:"location"`
}

type PotentialSLABreachConfig added in v0.22.8

type PotentialSLABreachConfig struct {
	DamperCoeff             float64                 `mapstructure:"damper_coeff" default:"1.0"`
	EnablePersistentLogging bool                    `mapstructure:"enable_persistent_logging" default:"false"`
	DurationEstimatorConfig DurationEstimatorConfig `mapstructure:"duration_estimator_config"`
}

type Project

type Project struct {
	Name        string            `mapstructure:"name"`
	Config      map[string]string `mapstructure:"config"`
	Variables   map[string]string `mapstructure:"variables"`
	PresetsPath string            `mapstructure:"preset_path"`
}

type Publisher added in v0.7.0

type Publisher struct {
	Type   string      `mapstructure:"type" default:"kafka"`
	Buffer int         `mapstructure:"buffer"`
	Config interface{} `mapstructure:"config"`
}

type PublisherKafkaConfig added in v0.7.0

type PublisherKafkaConfig struct {
	Topic               string   `mapstructure:"topic"`
	BatchIntervalSecond int      `mapstructure:"batch_interval_second"`
	BrokerURLs          []string `mapstructure:"broker_urls"`
}

type ReplayConfig added in v0.7.0

type ReplayConfig struct {
	ReplayTimeoutInMinutes            int               `mapstructure:"replay_timeout_in_minutes" default:"180"`
	ExecutionIntervalInSeconds        int               `mapstructure:"execution_interval_in_seconds" default:"120"`
	PluginExecutionProjectConfigNames map[string]string `mapstructure:"plugin_execution_project_config_names"`
}

type ResourceManager

type ResourceManager struct {
	Name        string      `mapstructure:"name"`
	Type        string      `mapstructure:"type"`
	Description string      `mapstructure:"description"`
	Config      interface{} `mapstructure:"config"`
}

type ResourceManagerConfigOptimus

type ResourceManagerConfigOptimus struct {
	Host    string            `mapstructure:"host"`
	Headers map[string]string `mapstructure:"headers"`
}

type SLAConfig added in v0.22.0

type SLAConfig struct {
	WorkerIntervalMinutes int `mapstructure:"worker_interval_minutes"`
	LockDurationMinutes   int `mapstructure:"worker_lock_duration_minutes"`
}

type Serve

type Serve struct {
	Port            int      `mapstructure:"port" default:"9100"` // port to listen on
	IngressHost     string   `mapstructure:"ingress_host"`        // service ingress host for jobs to communicate back to optimus
	PortGRPC        int      `mapstructure:"port_grpc"`
	IngressHostGRPC string   `mapstructure:"ingress_host_grpc"`
	AppKey          string   `mapstructure:"app_key"` // random 32 character hash used for encrypting secrets
	DB              DBConfig `mapstructure:"db"`
}

type ServerConfig

type ServerConfig struct {
	Version                   Version                   `mapstructure:"version"`
	Log                       LogConfig                 `mapstructure:"log"`
	Serve                     Serve                     `mapstructure:"serve"`
	Telemetry                 TelemetryConfig           `mapstructure:"telemetry"`
	Alerting                  AlertingConfig            `mapstructure:"alerting"`
	SLAConfig                 SLAConfig                 `mapstructure:"sla"`
	ResourceManagers          []ResourceManager         `mapstructure:"resource_managers"`
	UpstreamResolvers         []UpstreamResolver        `mapstructure:"upstream_resolvers"`
	Replay                    ReplayConfig              `mapstructure:"replay"`
	Backfill                  BackfillConfig            `mapstructure:"backfill"`
	Publisher                 *Publisher                `mapstructure:"publisher"`
	JobSyncIntervalMinutes    int                       `mapstructure:"job_sync_interval_minutes"`
	ExternalTables            ExternalTablesConfig      `mapstructure:"external_tables"`
	Features                  FeaturesConfig            `mapstructure:"features"`
	Plugins                   Plugins                   `mapstructure:"plugins"`
	JobValidationConfig       JobValidationConfig       `mapstructure:"job_validation"`
	JobExpectatorConfig       JobExpectatorConfig       `mapstructure:"job_expectator"`
	JobExecutionSummaryConfig JobExecutionSummaryConfig `mapstructure:"job_execution_summary"`
}

func LoadServerConfig

func LoadServerConfig(filePath string) (*ServerConfig, error)

LoadServerConfig load the server specific config from these locations: 1. filepath. ./optimus <server_command> -c "path/to/config.yaml" 2. env var. eg. OPTIMUS_SERVE_PORT, etc 3. executable binary location

type TelemetryConfig

type TelemetryConfig struct {
	ProfileAddr      string `mapstructure:"profile_addr"`
	JaegerAddr       string `mapstructure:"jaeger_addr"`
	MetricServerAddr string `mapstructure:"telegraf_addr"`
}

type UpstreamResolver added in v0.22.14

type UpstreamResolver struct {
	Type   UpstreamResolverType   `mapstructure:"type"`
	Config map[string]interface{} `mapstructure:"config"`
}

func (*UpstreamResolver) GetDexClientConfig added in v0.22.14

func (u *UpstreamResolver) GetDexClientConfig() (*DexClientConfig, error)

type UpstreamResolverType added in v0.22.14

type UpstreamResolverType string
const (
	DexUpstreamResolver UpstreamResolverType = "dex"
)

func (UpstreamResolverType) String added in v0.22.14

func (u UpstreamResolverType) String() string

type ValidateScheduleConfig added in v0.22.14

type ValidateScheduleConfig struct {
	ReferenceTimezone string `mapstructure:"reference_timezone"`
}

type Version

type Version int

Version implement fmt.Stringer

const DefaultVersion Version = 1

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL