Documentation
¶
Index ¶
- Constants
- Variables
- func SetupTestCerts(t *testing.T) (string, string)
- type Config
- func (c *Config) Close()
- func (c *Config) GetDBConfig() *cconfig.DBConfig
- func (c *Config) GetDBHost() string
- func (c *Config) GetDBName() string
- func (c *Config) GetDBPassword() string
- func (c *Config) GetDBPasswordPath() string
- func (c *Config) GetDBPort() int
- func (c *Config) GetDBUser() string
- func (c *Config) GetDevMode() bool
- func (c *Config) GetHealthzConfig() *HealthzConfig
- func (c *Config) GetHealthzEnabled() bool
- func (c *Config) GetHealthzPort() int
- func (c *Config) GetLogLevel() string
- func (c *Config) GetMaxConcurrentActivityPollers() int
- func (c *Config) GetMetricsConfig() *MetricsConfig
- func (c *Config) GetMetricsEnabled() bool
- func (c *Config) GetMetricsNamespace() string
- func (c *Config) GetMetricsPort() int
- func (c *Config) GetNgcAPIBaseURL() string
- func (c *Config) GetNotificationsSlackEnabled() bool
- func (c *Config) GetNotificationsSlackWebhookURL() string
- func (c *Config) GetNotificationsSlackWebhookURLPath() string
- func (c *Config) GetPathToConfig() string
- func (c *Config) GetSiteManagerEndpoint() string
- func (c *Config) GetTemporalCaPath() string
- func (c *Config) GetTemporalCertPath() string
- func (c *Config) GetTemporalConfig() (*cconfig.TemporalConfig, error)
- func (c *Config) GetTemporalEncryptionKey() string
- func (c *Config) GetTemporalEncryptionKeyPath() string
- func (c *Config) GetTemporalHost() string
- func (c *Config) GetTemporalKeyPath() string
- func (c *Config) GetTemporalNamespace() string
- func (c *Config) GetTemporalPort() int
- func (c *Config) GetTemporalQueue() string
- func (c *Config) GetTemporalServerName() string
- func (c *Config) GetTemporalTlsEnabled() bool
- func (c *Config) GetTracingEnabled() bool
- func (c *Config) GetTracingServiceName() string
- func (c *Config) SetNgcAPIBaseURL(value string)
- func (c *Config) SetNotificationsSlackWebhookURL(value string)
- func (c *Config) SetSiteManagerEndpoint(value string)
- func (c *Config) SetTemporalCaPath(value string)
- func (c *Config) SetTemporalCertPath(value string)
- func (c *Config) SetTemporalEncryptionKey()
- func (c *Config) SetTemporalEncryptionKeyPath(value string)
- func (c *Config) SetTemporalKeyPath(value string)
- func (c *Config) Validate()
- func (c *Config) WatchSecretFilePaths()
- type HealthzConfig
- type MetricsConfig
Constants ¶
const ( // ConfigFilePath specifies the path to the config file, this contains the default path ConfigFilePath = "config.file" // ConfigFilePathEnv specifies the environment variable name for the config file path ConfigFilePathEnv = "CONFIG_FILE_PATH" // ConfigDevMode specifies if the service is running in dev mode ConfigDevMode = "env.dev" // ConfigLogLevel specifies the log level ConfigLogLevel = "log.level" // ConfigDBHost specifies the host of the database ConfigDBHost = "db.host" // ConfigDBPort specifies the port of the database ConfigDBPort = "db.port" // ConfigDBName specifies the name of the database ConfigDBName = "db.name" // ConfigDBUser specifies the user of the database ConfigDBUser = "db.user" // ConfigDBPasswordPath specifies the path for file containing password of the database ConfigDBPasswordPath = "db.passwordPath" // ConfigDBPassword specifies the password of the database, not read from config file, rather from file specified by db.passwordPath ConfigDBPassword = "db.password" // ConfigTemporalHost specifies the hostname for Temporal ConfigTemporalHost = "temporal.host" // ConfigTemporalPort specifies the port for Temporal ConfigTemporalPort = "temporal.port" // ConfigTemporalServerName specifies the server name for Temporal ConfigTemporalServerName = "temporal.serverName" // ConfigTemporalNamespace specifies the namespace for Temporal ConfigTemporalNamespace = "temporal.namespace" // ConfigTemporalNamespaceEnv specifies the env var to read namespace for Temporal ConfigTemporalNamespaceEnv = "TEMPORAL_NAMESPACE" // ConfigTemporalQueue specifies the queue for Temporal ConfigTemporalQueue = "temporal.queue" // ConfigTemporalQueueEnv specifies the env var to read queue for Temporal ConfigTemporalQueueEnv = "TEMPORAL_QUEUE" // ConfigTemporalEncryptionKey specifies the data encryption key for Temporal ConfigTemporalEncryptionKey = "temporal.encryptionKey" // ConfigTemporalEncryptionKeyPath specifies the path for file containing data encryption key for Temporal ConfigTemporalEncryptionKeyPath = "temporal.encryptionKeyPath" // ConfigTemporalTlsEnabled specifies if TLS should be used with Temporal ConfigTemporalTlsEnabled = "temporal.tls.enabled" // ConfigTemporalCertPath specifies the path for client cert ConfigTemporalCertPath = "temporal.tls.certPath" // ConfigTemporalKeyPath specifies the path for client key ConfigTemporalKeyPath = "temporal.tls.keyPath" // ConfigTemporalCaPath specifies the path for server CA cert ConfigTemporalCaPath = "temporal.tls.caPath" // ConfigNgcAPIBaseURL specifies the base URL for the NGC API ConfigNgcAPIBaseURL = "ngc.api.baseUrl" // ConfigNotificationsSlackWebhookURL specifies the Slack webhook URL ConfigNotificationsSlackWebhookURL = "notifications.slack.webhookURL" // ConfigNotificationsSlackWebhookURLPath specifies file path to read Slack webhook URL ConfigNotificationsSlackWebhookURLPath = "notifications.slack.webhookURLPath" // ConfigSiteManagerEndpoint is the service endpoint for site manager ConfigSiteManagerEndpoint = "siteManager.svcEndpoint" // ConfigMetricsEnabled is a feature flag for Prometheus metrics ConfigMetricsEnabled = "metrics.enabled" // ConfigMetricsPort specifies the port for Prometheus metrics ConfigMetricsPort = "metrics.port" // ConfigMetricsNamespace specifies the prefix for every exposed metric name ConfigMetricsNamespace = "metrics.namespace" // ConfigHealthzEnabled is a feature flag for health check endpoint ConfigHealthzEnabled = "healthz.enabled" // ConfigHealthzPort specifies the port for health check endpoint ConfigHealthzPort = "healthz.port" // ConfigTracingEnabled is a feature flag for tracing ConfigTracingEnabled = "tracing.enabled" // ConfigTracingServiceName specifies the service name for tracing ConfigTracingServiceName = "tracing.serviceName" // ConfigWorkerMaxConcurrentActivityPollers specifies how many concurrent activity // task pollers the Temporal worker runs. This service reads only from config.yaml // (Helm-rendered) -- unlike Site Agent's old-style config, there's no env var override. ConfigWorkerMaxConcurrentActivityPollers = "worker.maxConcurrentActivityPollers" )
const ( // DefaultMaxConcurrentActivityPollers is the poller count used when config.yaml // doesn't set worker.maxConcurrentActivityPollers. Matches the historical hardcoded value. DefaultMaxConcurrentActivityPollers = 10 // MaxMaxConcurrentActivityPollers caps the configurable poller count. Each poller can // hold a DB connection from the shared pgx pool while its activity runs, and this worker // also serves the cloud task queue. Lowered from an initial 200 (an unguessed // fat-finger-only bound) to 20 per review: benchmarking found no throughput gain going // from poller=10 to poller=40 at page_size=50, and Temporal's own worker design means a // handful of pollers already saturates typical activity-execution-slot counts -- raising // this further is unlikely to help and mainly risks pgx pool exhaustion on a worker that // also serves the cloud task queue. Bump with fresh benchmark data if a real need appears. MaxMaxConcurrentActivityPollers = 20 )
const DefaultMetricsNamespace = "nico_rest_workflow"
DefaultMetricsNamespace prefixes every metric this worker exposes and matches its nico-rest-workflow Helm service name. Operators override it with metrics.namespace.
Variables ¶
var ( // ProjectRoot describes the folder path of this project ProjectRoot = filepath.Join(filepath.Dir(cur), "../..") )
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config represents configurations for the service
func (*Config) GetDBConfig ¶
GetDBConfig returns the database config
func (*Config) GetDBPassword ¶
GetDBPassword returns the password of the database
func (*Config) GetDBPasswordPath ¶
GetDBPasswordPath returns the path for file containing password of the database
func (*Config) GetDevMode ¶
GetDevMode returns if the service is running in dev mode
func (*Config) GetHealthzConfig ¶
func (c *Config) GetHealthzConfig() *HealthzConfig
GetHealthzConfig returns the Healthz config
func (*Config) GetHealthzEnabled ¶
GetHealthzEnabled gets the enabled field for Healthz
func (*Config) GetHealthzPort ¶
GetHealthzPort gets the port for Healthz
func (*Config) GetLogLevel ¶
GetLogLevel returns the log level
func (*Config) GetMaxConcurrentActivityPollers ¶
GetMaxConcurrentActivityPollers returns the number of concurrent activity task pollers the Temporal worker should run
func (*Config) GetMetricsConfig ¶
func (c *Config) GetMetricsConfig() *MetricsConfig
GetMetricsConfig returns the Metrics config
func (*Config) GetMetricsEnabled ¶
GetMetricsEnabled gets the enabled field for Metrics
func (*Config) GetMetricsNamespace ¶
GetMetricsNamespace gets the prefix applied to every exposed metric name. An explicitly empty value falls back to the default rather than exposing unprefixed names that would collide with another service's.
func (*Config) GetMetricsPort ¶
GetMetricsPort gets the port for Metrics
func (*Config) GetNgcAPIBaseURL ¶
GetNgcAPIBaseURL returns the base url for the ngc api
func (*Config) GetNotificationsSlackEnabled ¶
GetNotificationsSlackEnabled returns if Slack notifications are enabled
func (*Config) GetNotificationsSlackWebhookURL ¶
GetNotificationsSlackWebhookURL gets the slack webhook url
func (*Config) GetNotificationsSlackWebhookURLPath ¶
GetNotificationsSlackWebhookURLPath gets the file path to read slack webhook url
func (*Config) GetPathToConfig ¶
GetPathToConfig returns the path to the config file
func (*Config) GetSiteManagerEndpoint ¶
GetSiteManagerEndpoint gets the path for site manager service endpoint
func (*Config) GetTemporalCaPath ¶
GetTemporalCaPath returns the path for ca cert for Temporal
func (*Config) GetTemporalCertPath ¶
GetTemporalCertPath returns the path for client cert for Temporal
func (*Config) GetTemporalConfig ¶
func (c *Config) GetTemporalConfig() (*cconfig.TemporalConfig, error)
GetTemporalConfig returns the temporal config
func (*Config) GetTemporalEncryptionKey ¶
GetTemporalEncryptionKey returns the encryption key for Temporal
func (*Config) GetTemporalEncryptionKeyPath ¶
GetTemporalEncryptionKeyPath returns the path for file containing data encryption key for Temporal
func (*Config) GetTemporalHost ¶
GetTemporalHost returns the hostname for Temporal
func (*Config) GetTemporalKeyPath ¶
GetTemporalKeyPath returns the path for client key for Temporal
func (*Config) GetTemporalNamespace ¶
GetTemporalNamespace returns the namespace for Temporal
func (*Config) GetTemporalPort ¶
GetTemporalPort returns the port for Temporal
func (*Config) GetTemporalQueue ¶
GetTemporalQueue returns the queue for Temporal
func (*Config) GetTemporalServerName ¶
GetTemporalServerName returns the server name for Temporal
func (*Config) GetTemporalTlsEnabled ¶
GetTemporalTlsEnabled returns true if TLS is enabled for Temporal connection
func (*Config) GetTracingEnabled ¶
GetTracingEnabled gets the enabled field for tracing
func (*Config) GetTracingServiceName ¶
GetTracingServiceName gets the service name for tracing
func (*Config) SetNgcAPIBaseURL ¶
SetNgcAPIBaseURL sets the base url for the ngc api
func (*Config) SetNotificationsSlackWebhookURL ¶
SetNotificationsSlackWebhookURL sets the slack webhook url
func (*Config) SetSiteManagerEndpoint ¶
SetSiteManagerEndpoint sets the endpoint
func (*Config) SetTemporalCaPath ¶
SetTemporalCaPath sets the path for ca for Temporal
func (*Config) SetTemporalCertPath ¶
SetTemporalCertPath set the path for client cert for Temporal
func (*Config) SetTemporalEncryptionKey ¶
func (c *Config) SetTemporalEncryptionKey()
SetTemporalEncryptionKey sets the encryption key for Temporal
func (*Config) SetTemporalEncryptionKeyPath ¶
SetTemporalEncryptionKeyPath sets the path for file containing data encryption key for Temporal
func (*Config) SetTemporalKeyPath ¶
SetTemporalKeyPath set the path for client key for Temporal
func (*Config) WatchSecretFilePaths ¶
func (c *Config) WatchSecretFilePaths()
WatchSecretFilePaths starts watching secret files for changes.
type HealthzConfig ¶
HealthzConfig holds configuration of Healthz
func NewHealthzConfig ¶
func NewHealthzConfig(enabled bool, port int) *HealthzConfig
NewHealthzConfig initializes and returns a configuration object for managing Healthz
func (*HealthzConfig) GetListenAddr ¶
func (hccfg *HealthzConfig) GetListenAddr() string
GetListenAddr returns the local address for listen socket.
type MetricsConfig ¶
MetricsConfig holds configuration of Metrics
func NewMetricsConfig ¶
func NewMetricsConfig(enabled bool, port int, namespace string) *MetricsConfig
NewMetricsConfig initializes and returns a configuration object for managing Metrics
func (*MetricsConfig) GetListenAddr ¶
func (mcfg *MetricsConfig) GetListenAddr() string
GetListenAddr returns the local address for listen socket.