Documentation
¶
Overview ¶
Package bootstrap defines the version 2 bootstrap file of the relay proxy: its schema, a strict loader that reports path- and line-addressed errors, the secret references, the explicit environment overrides, the defaults table, the redacted effective print and the JSON Schema.
Index ¶
- Constants
- Variables
- func ConnectionSpec(conn Connection, opts LoadOptions) (connection.Spec, error)
- func HTTPStoreConfig(conn *HTTPConnection, opts LoadOptions) (*manifestreader.HTTPStoreConfig, error)
- func JSONSchema() ([]byte, error)
- func NewHTTPStore(conn *HTTPConnection, opts LoadOptions) (*manifestreader.HTTPStore, error)
- func ParseUnixSocketMode(mode string) (fs.FileMode, error)
- func S3Spec(conn *S3Connection, opts LoadOptions) (*connection.S3Spec, error)
- type AWS
- type AdminKey
- type Auth
- type ByteSize
- type Config
- type Connection
- type ControlPlane
- type Credentials
- type Delay
- type Duration
- type Error
- type Evaluation
- type Exporter
- type ExporterRetry
- type FileConnection
- type HTTPConnection
- type HTTPTLS
- type HTTPTimeouts
- type KafkaFlush
- type KafkaGSSAPI
- type KafkaMetadata
- type KafkaNet
- type KafkaProducer
- type KafkaProducerRetry
- type KafkaRetry
- type KafkaSASL
- type KafkaSettings
- type KafkaTLS
- type KafkaTransaction
- type KinesisConnection
- type Listener
- type LoadOptions
- type Logging
- type Manifest
- type Metrics
- type Notifier
- type OFREPEventStream
- type Observability
- type Ops
- type Overrides
- type Poll
- type Pprof
- type RedisConnection
- type RedisTimeouts
- type RedshiftConnection
- type ResolvedSecret
- func (ResolvedSecret) Format(f fmt.State, _ rune)
- func (ResolvedSecret) GoString() string
- func (ResolvedSecret) LogValue() slog.Value
- func (ResolvedSecret) MarshalJSON() ([]byte, error)
- func (ResolvedSecret) MarshalText() ([]byte, error)
- func (ResolvedSecret) MarshalYAML() (any, error)
- func (r ResolvedSecret) Reveal() string
- func (ResolvedSecret) String() string
- type Retry
- type S3Connection
- type SQSConnection
- type Secret
- func (Secret) Format(f fmt.State, _ rune)
- func (Secret) GoString() string
- func (s Secret) IsInline() bool
- func (s Secret) IsSet() bool
- func (s Secret) IsZero() bool
- func (Secret) JSONSchema() *jsonschema.Schema
- func (Secret) LogValue() slog.Value
- func (s Secret) MarshalJSON() ([]byte, error)
- func (Secret) MarshalText() ([]byte, error)
- func (s Secret) MarshalYAML() (any, error)
- func (s Secret) Resolve(opts LoadOptions) (ResolvedSecret, error)
- func (Secret) String() string
- func (s *Secret) UnmarshalYAML(node *yaml.Node) error
- type SegmentResolver
- type SegmentTuning
- type Segments
- type Server
- type Shutdown
- type StoreTLS
- type TLS
- type Timeouts
- type Tracing
- type ValidateFlags
- type ValkeyConnection
- type ValkeyTimeouts
Constants ¶
const ( RoleAPI = "api" RoleOps = "ops" ProtocolHTTP1 = "http1" ProtocolH2C = "h2c" ProtocolH2 = "h2" // TLSVersion12 and TLSVersion13 are the values of server.listeners[].tls.minVersion. TLSVersion12 = "1.2" TLSVersion13 = "1.3" )
Listener roles and protocols.
const ( TypeS3 = "s3" TypeKinesis = "kinesis" TypeSQS = "sqs" TypeRedshift = "redshift" TypeFile = "file" TypeHTTP = "http" TypeRedis = "redis" TypeValkey = "valkey" )
Connection types.
const ( CredentialsChain = "chain" CredentialsStatic = "static" CredentialsAssumeRole = "assumeRole" CredentialsWebIdentity = "webIdentity" )
Credential types.
const ( ChecksumWhenSupported = "whenSupported" ChecksumWhenRequired = "whenRequired" )
Checksum settings of the S3 client.
const ( PipeliningAlways = "always" PipeliningAuto = "auto" )
Pipelining modes of a valkey connection.
const ( DefaultAPIAddress = ":1031" // DefaultUnixSocketMode is the mode of the socket file when server.unixSocketMode is not set. DefaultUnixSocketMode = "0660" DefaultLogLevel = "info" DefaultLogFormat = "json" DefaultServiceName = "semaphore" DefaultSampler = "parentbased_always_off" DefaultPollInterval = 60 * time.Second DefaultJitter = 0.1 DefaultConnectTimeout = 10 * time.Second DefaultRequestTimeout = 30 * time.Second DefaultMaxAttempts = 3 DefaultMaxBackoff = 20 * time.Second DefaultChannel = "stable" DefaultMaxObjects = 20000 DefaultFlushInterval = 60 * time.Second DefaultMaxEvents = 100000 DefaultExportFormat = "json" // DefaultShutdownTimeout bounds the stop that follows the drain delay. DefaultShutdownTimeout = 15 * time.Second // DefaultBlockTimeout is the wait of the block overflow policy of an exporter for room in its queue. DefaultBlockTimeout = 50 * time.Millisecond // MaxBlockTimeout is the upper bound of the wait of the block overflow policy. MaxBlockTimeout = 10 * time.Second // DefaultExporterDrainTimeout is the deadline of the final flush of an exporter that leaves. DefaultExporterDrainTimeout = 10 * time.Second // DefaultRetryAttempts is the attempts of a batch of an exporter, the first included. DefaultRetryAttempts = 5 // DefaultRetryInitialBackoff is the wait before the first retry of an export. DefaultRetryInitialBackoff = 200 * time.Millisecond // DefaultRetryMaxBackoff caps one wait of the retry of an export. DefaultRetryMaxBackoff = 5 * time.Second // DefaultRetryMaxElapsed caps the time of the retry of one flush. DefaultRetryMaxElapsed = 30 * time.Second // MaxRetryBackoff is the upper bound of the backoff settings of the retry of an exporter. MaxRetryBackoff = 10 * time.Minute // MaxRetryElapsed is the upper bound of the time of the retry of one flush. MaxRetryElapsed = time.Hour // MaxBatchBytes is the upper bound of the byte limit of a batch of an exporter. MaxBatchBytes = 1 << 30 // MaxShutdownDuration is the upper bound of the drain delay and of the shutdown timeout. MaxShutdownDuration = 10 * time.Minute )
The defaults table. docs/relay-proxy/bootstrap-config.md documents the same values.
const ( ExporterFile = "file" ExporterWebhook = "webhook" ExporterLog = "log" ExporterS3 = "s3" ExporterKinesis = "kinesis" ExporterGoogleStorage = "googleStorage" ExporterSQS = "sqs" ExporterKafka = "kafka" ExporterPubSub = "pubsub" ExporterBigQuery = "bigquery" ExporterRedshift = "redshift" ExporterAzure = "azureBlobStorage" ExporterOTel = "opentelemetry" )
Exporter kinds.
const ( OverflowDropNewest = "dropNewest" OverflowDropOldest = "dropOldest" OverflowBlock = "block" )
The overflow policies of an exporter.
const ( RetryKeep = "keep" RetryDrop = "drop" )
What an exporter does with a batch that exhausted its retry.
const ( NotifierSlack = "slack" NotifierMicrosoftTeams = "microsoftteams" NotifierWebhook = "webhook" NotifierDiscord = "discord" )
Notifier kinds.
const ( // KafkaSASLPlain, KafkaSASLScram256, KafkaSASLScram512 and KafkaSASLGSSAPI are the SASL mechanisms. KafkaSASLPlain = "PLAIN" KafkaSASLScram256 = "SCRAM-SHA-256" KafkaSASLScram512 = "SCRAM-SHA-512" KafkaSASLGSSAPI = "GSSAPI" // KafkaAcksNone, KafkaAcksLocal and KafkaAcksAll are the acknowledgements a producer waits for. KafkaAcksNone = "none" KafkaAcksLocal = "local" KafkaAcksAll = "all" // KafkaGSSAPIUser and KafkaGSSAPIKeytab are the GSSAPI authentication types. KafkaGSSAPIUser = "user" KafkaGSSAPIKeytab = "keytab" )
Kafka enumerations.
const ( EnvConfig = "SEMAPHORE_CONFIG" EnvLogLevel = "SEMAPHORE_LOG_LEVEL" EnvLogFormat = "SEMAPHORE_LOG_FORMAT" EnvListen = "SEMAPHORE_LISTEN" EnvOpsListen = "SEMAPHORE_OPS_LISTEN" EnvManifestKey = "SEMAPHORE_MANIFEST_KEY" EnvStateDir = "SEMAPHORE_STATE_DIR" // EnvShutdownDrainDelay and EnvShutdownTimeout set server.shutdown.drainDelay and server.shutdown.timeout. EnvShutdownDrainDelay = "SEMAPHORE_SHUTDOWN_DRAIN_DELAY" EnvShutdownTimeout = "SEMAPHORE_SHUTDOWN_TIMEOUT" )
The environment variables the loader reads. No other variable is read.
const ( DefaultSegmentTTL = 30 * time.Second DefaultSegmentNegativeTTL = 5 * time.Second DefaultSegmentMaxEntries = 10000 DefaultSegmentShards = 16 DefaultSegmentBreakerFailures = 5 DefaultSegmentBreakerCooldown = 10 * time.Second DefaultSegmentCallTimeout = 2 * time.Second DefaultSegmentMaxOverdue = 8 DefaultSegmentMaxIDBytes = 512 DefaultSegmentShutdownGrace = 5 * time.Second DefaultLookupTimeout = 100 * time.Millisecond DefaultSegmentKeyPrefix = "semaphore:segment:" )
The defaults of the segment resolver and of the segment stores. They are the defaults of modules/core/segment/resolver and of the segment providers (a test pins them).
const ( NormalizeNone = "none" NormalizeTrimLower = "trimLower" )
Normalization of the ids of a lookup.
const MaxUnixSocketPath = 90
MaxUnixSocketPath is the longest server.unixSocketPath in bytes. The path of a unix socket is limited to 104 bytes on some systems (108 on Linux), and the relay binds the socket in a staging directory next to the path before it moves it into place, which needs 14 bytes more.
const RedactedValue = cmdlog.RedactedValue
RedactedValue is what every secret prints instead of its content.
const Version = 2
Version is the only schema version of the bootstrap file.
Variables ¶
var ( // ErrVersionRequired is returned when the file has no "version" key or a version other than 2. ErrVersionRequired = errors.New("bootstrap config: version 2 required") // ErrSyntax is returned when the document is not valid YAML or has the wrong shape. ErrSyntax = errors.New("invalid YAML") // ErrUnknownKey is returned for a key the schema does not define. ErrUnknownKey = errors.New("unknown key") // ErrReservedKey is returned for a key that is reserved for a later release. ErrReservedKey = errors.New("reserved key, not supported yet") // ErrDuplicateName is returned when a key or a name appears twice. ErrDuplicateName = errors.New("duplicate name") // ErrInvalidName is returned for a name that does not match the name rules. ErrInvalidName = errors.New("invalid name") // ErrReservedName is returned for a reserved name. ErrReservedName = errors.New("reserved name") // ErrDanglingReference is returned for a reference to a connection that does not exist. ErrDanglingReference = errors.New("unknown connection") // ErrWrongConnectionType is returned for a reference to a connection of the wrong type. ErrWrongConnectionType = errors.New("connection has the wrong type") // ErrInvalidValue is returned for a value that is not allowed. ErrInvalidValue = errors.New("invalid value") // ErrInvalidDuration is returned for a duration that is not a positive duration string such as "60s". ErrInvalidDuration = errors.New("invalid duration") // ErrInvalidByteSize is returned for a size that is not a positive size string such as "64KiB". ErrInvalidByteSize = errors.New("invalid size") // ErrMissingValue is returned when a required key is not set. ErrMissingValue = errors.New("required value missing") // ErrNotAllowed is returned for a key that is not allowed for the type or kind of its parent. ErrNotAllowed = errors.New("key not allowed here") // ErrUnknownType is returned for a connection type or an exporter or notifier kind that does not exist. ErrUnknownType = errors.New("unknown type") // ErrUnsupportedType is returned for a connection type that is planned but not supported yet. ErrUnsupportedType = errors.New("type not supported yet") // ErrInlineSecret is returned for an inline secret when inline secrets are not enabled. ErrInlineSecret = errors.New("inline secret not allowed, use fromEnv or fromFile") // ErrInvalidSecret is returned for a secret that is neither a scalar nor a fromEnv or fromFile reference. ErrInvalidSecret = errors.New("invalid secret") // ErrDuplicateKey is returned when an admin key appears twice. The key is never printed. ErrDuplicateKey = errors.New("duplicate key") // ErrSecretUnresolved is returned when a secret reference cannot be resolved. ErrSecretUnresolved = errors.New("secret cannot be resolved") // ErrNoConfigPath is returned when neither the flag nor SEMAPHORE_CONFIG gives a file path. ErrNoConfigPath = errors.New("no bootstrap file given: use --config or SEMAPHORE_CONFIG") // ErrNoReader is returned when the options have no ReadFile function. ErrNoReader = errors.New("no ReadFile function in the load options") )
Sentinel errors of the package. Every error returned by the loader wraps one of them inside an Error.
Functions ¶
func ConnectionSpec ¶
func ConnectionSpec( conn Connection, opts LoadOptions, ) (connection.Spec, error)
ConnectionSpec turns an AWS backed connection of the file into the spec the connection factory takes, with its secrets resolved. A connection of type file or http has no spec (it is not an AWS client) and gives nil. The error names the setting, never a value.
func HTTPStoreConfig ¶
func HTTPStoreConfig(conn *HTTPConnection, opts LoadOptions) (*manifestreader.HTTPStoreConfig, error)
HTTPStoreConfig turns the connection into the setting of the store, with its secrets resolved and the CA bundle read. The error names the setting, never a value.
func JSONSchema ¶
JSONSchema returns the JSON Schema of the bootstrap file, generated from the Go types, indented with 4 spaces like the other schema of the repository.
func NewHTTPStore ¶
func NewHTTPStore(conn *HTTPConnection, opts LoadOptions) (*manifestreader.HTTPStore, error)
NewHTTPStore builds the store of an http connection.
func ParseUnixSocketMode ¶
ParseUnixSocketMode returns the permission bits of server.unixSocketMode: three or four octal digits, at most 0777. An empty mode is DefaultUnixSocketMode.
func S3Spec ¶
func S3Spec(conn *S3Connection, opts LoadOptions) (*connection.S3Spec, error)
S3Spec turns the S3 connection of the bootstrap file into the spec of the factory, resolving the secrets.
Types ¶
type AWS ¶
type AWS struct {
Credentials *Credentials `json:"credentials,omitempty" yaml:"credentials,omitempty"`
Timeouts *Timeouts `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
Retry *Retry `json:"retry,omitempty" yaml:"retry,omitempty"`
// Endpoint overrides the service endpoint, for emulators.
Endpoint string `json:"endpoint,omitempty" yaml:"endpoint,omitempty"`
Region string `json:"region,omitempty" yaml:"region,omitempty"`
// CABundleFile is a PEM file of certificate authorities trusted in addition to the system roots.
CABundleFile string `json:"caBundleFile,omitempty" yaml:"caBundleFile,omitempty"`
}
AWS holds the settings every AWS-family connection shares.
type AdminKey ¶
type AdminKey struct {
Secret
}
AdminKey is an entry of auth.adminKeys: a plain string (API keys are UUIDs set dynamically, not secrets in the sense of connection credentials) or a secret reference. It is redacted everywhere like a Secret.
func (AdminKey) JSONSchema ¶
func (AdminKey) JSONSchema() *jsonschema.Schema
JSONSchema describes a plain string or a reference.
type Auth ¶
type Auth struct {
// AdminKeys are plain strings or secret references. They are never printed.
AdminKeys []AdminKey `json:"adminKeys,omitempty" yaml:"adminKeys,omitempty"`
}
Auth holds the admin API keys.
type ByteSize ¶
type ByteSize int64
ByteSize is a size in bytes written as a string such as "1MiB" or "64KiB". A bare number is rejected.
func (ByteSize) JSONSchema ¶
func (ByteSize) JSONSchema() *jsonschema.Schema
JSONSchema describes the string form.
func (ByteSize) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (ByteSize) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
func (ByteSize) String ¶
String gives the size in the largest of MiB and KiB that holds it exactly, else in bytes.
func (*ByteSize) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler. Only strings are accepted. Zero is accepted and means the default of the setting, as in version 1.
type Config ¶
type Config struct {
Connections map[string]Connection `json:"connections,omitempty" yaml:"connections,omitempty"`
Exporters map[string]Exporter `json:"exporters,omitempty" yaml:"exporters,omitempty"`
Notifiers map[string]Notifier `json:"notifiers,omitempty" yaml:"notifiers,omitempty"`
ControlPlane *ControlPlane `json:"controlPlane,omitempty" yaml:"controlPlane,omitempty"`
Segments *Segments `json:"segments,omitempty" yaml:"segments,omitempty"`
Server Server `json:"server,omitzero" yaml:"server"`
Observability Observability `json:"observability,omitzero" yaml:"observability"`
Evaluation Evaluation `json:"evaluation,omitzero" yaml:"evaluation"`
Auth Auth `json:"auth,omitzero" yaml:"auth"`
Version int `json:"version" jsonschema:"enum=2" yaml:"version"`
// contains filtered or unexported fields
}
Config is the bootstrap file, version 2.
func Load ¶
func Load(overrides *Overrides, opts LoadOptions) (*Config, error)
Load reads the bootstrap file named by the --config flag or SEMAPHORE_CONFIG, then parses, overrides, defaults and validates it.
func Parse ¶
func Parse(data []byte, overrides *Overrides, opts LoadOptions) (*Config, error)
Parse decodes strictly, applies the overrides and the defaults, and validates.
func (*Config) EffectiveResolver ¶
func (c *Config) EffectiveResolver() SegmentResolver
EffectiveResolver is the settings of the segment resolver that the relay runs with: the segments section of the file with the defaults applied, or the defaults alone when the file has no segments section. The relay and the segment tool of the CLI both read the normalization and the longest id from it, so that the tool stores what the relay looks up.
func (*Config) EffectiveWaitForStores ¶
EffectiveWaitForStores reports whether /readyz waits for the first dial outcome of the segment stores in use: segments.waitForStores, true when unset.
type Connection ¶
type Connection struct {
S3 *S3Connection `json:"-" yaml:"-"`
Kinesis *KinesisConnection `json:"-" yaml:"-"`
SQS *SQSConnection `json:"-" yaml:"-"`
Redshift *RedshiftConnection `json:"-" yaml:"-"`
File *FileConnection `json:"-" yaml:"-"`
HTTP *HTTPConnection `json:"-" yaml:"-"`
Redis *RedisConnection `json:"-" yaml:"-"`
Valkey *ValkeyConnection `json:"-" yaml:"-"`
}
Connection is a discriminated union on the "type" key: exactly one member is set. New connection types are added as one member, one case in [connectionVariant] and one in the validation.
func (Connection) Format ¶
func (c Connection) Format(f fmt.State, _ rune)
Format implements fmt.Formatter: a connection prints its type only, so that no verb reaches a secret of a member (fmt does not call the Format method of a field while it prints a value for a verb that does not fit).
func (Connection) JSONSchema ¶
func (Connection) JSONSchema() *jsonschema.Schema
JSONSchema is a oneOf over the members, on the "type" discriminator.
func (Connection) MarshalJSON ¶
func (c Connection) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler through the YAML form.
func (Connection) MarshalYAML ¶
func (c Connection) MarshalYAML() (any, error)
MarshalYAML implements yaml.Marshaler.
func (Connection) Type ¶
func (c Connection) Type() string
Type returns the discriminator of the set member, or "" for an empty connection.
func (*Connection) UnmarshalYAML ¶
func (c *Connection) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler: it dispatches on the "type" key.
type ControlPlane ¶
type ControlPlane struct {
Manifest Manifest `json:"manifest,omitzero" yaml:"manifest"`
Connection string `json:"connection" yaml:"connection"`
StateDir string `json:"stateDir,omitempty" yaml:"stateDir,omitempty"`
}
ControlPlane tells where the manifest lives and how it is polled.
type Credentials ¶
type Credentials struct {
Type string `` //nolint:lll // struct tags can not be wrapped
/* 136-byte string literal not displayed */
RoleARN string `json:"roleArn,omitempty" yaml:"roleArn,omitempty"`
SessionName string `json:"sessionName,omitempty" yaml:"sessionName,omitempty"`
ExternalID Secret `json:"externalId,omitzero" yaml:"externalId,omitempty"`
TokenFile string `json:"tokenFile,omitempty" yaml:"tokenFile,omitempty"`
AccessKeyID Secret `json:"accessKeyId,omitzero" yaml:"accessKeyId,omitempty"`
SecretAccessKey Secret `json:"secretAccessKey,omitzero" yaml:"secretAccessKey,omitempty"`
SessionToken Secret `json:"sessionToken,omitzero" yaml:"sessionToken,omitempty"`
}
Credentials selects how the AWS client authenticates.
type Delay ¶
Delay is a duration written as a string such as "10s", where zero ("0s") is allowed and means no delay.
func (Delay) JSONSchema ¶
func (Delay) JSONSchema() *jsonschema.Schema
JSONSchema describes the string form.
func (Delay) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Delay) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
func (Delay) String ¶
String gives whole seconds as "10s" and any other duration in the standard form.
func (*Delay) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler. Only strings are accepted, and a negative value is rejected.
type Duration ¶
Duration is a positive duration written as a string such as "60s" or "1m30s".
func (Duration) JSONSchema ¶
func (Duration) JSONSchema() *jsonschema.Schema
JSONSchema describes the string form.
func (Duration) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Duration) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.
func (Duration) String ¶
String gives whole seconds as "60s" and any other duration in the standard form.
func (*Duration) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler. Only strings are accepted: a bare number is rejected.
type Error ¶
type Error struct {
// Err is the sentinel that tells the kind of the error.
Err error
// Path is the dotted path of the key, for example "connections.control.bucket".
Path string
// Detail is an optional explanation.
Detail string
// Line is the 1-based line in the file, or 0 when the value does not come from the file.
Line int
}
Error is a path- and line-addressed configuration error. It never contains the value of a secret or of an admin key. It does carry key names, type names and reference names written in the file, and it does not echo a key written directly under "auth".
type Evaluation ¶
type Evaluation struct {
// ContextEnrichment is merged into the context of every evaluation of every flag set that has no enrichment of
// its own. It wins over a request attribute of the same name, as in version 1.
ContextEnrichment map[string]any `` //nolint:lll // struct tags can not be wrapped
/* 265-byte string literal not displayed */
// Environment is added to the enrichment under the key env.
Environment string `json:"environment,omitempty" yaml:"environment,omitempty"`
// DisableSemaphoreMetadata keeps the semaphore_cacheable key out of the metadata of the OFREP answers; the
// legacy gofeatureflag_cacheable key is always sent.
DisableSemaphoreMetadata bool `json:"disableSemaphoreMetadata,omitempty" yaml:"disableSemaphoreMetadata,omitempty"`
}
Evaluation is how the relay evaluates flags.
type Exporter ¶
type Exporter struct {
Meta map[string]string `json:"meta,omitempty" yaml:"meta,omitempty"`
Headers map[string]Secret `json:"headers,omitzero" yaml:"headers,omitempty"`
FlushInterval *Duration `json:"flushInterval,omitempty" yaml:"flushInterval,omitempty"`
MaxEventInMemory *int `` //nolint:lll // struct tags can not be wrapped
/* 260-byte string literal not displayed */
Retry *ExporterRetry `json:"retry,omitempty" yaml:"retry,omitempty"`
MaxBytes *ByteSize `json:"maxBytes,omitempty" yaml:"maxBytes,omitempty"`
BlockTimeout *Duration `json:"blockTimeout,omitempty" yaml:"blockTimeout,omitempty"`
DrainTimeout *Duration `json:"drainTimeout,omitempty" yaml:"drainTimeout,omitempty"`
Kafka *KafkaSettings `json:"kafka,omitempty" yaml:"kafka,omitempty"`
ClusterIdentifier string `json:"clusterIdentifier,omitempty" yaml:"clusterIdentifier,omitempty"`
StreamName string `json:"streamName,omitempty" yaml:"streamName,omitempty"`
EventType string `json:"eventType,omitempty" yaml:"eventType,omitempty"`
Format string `` //nolint:lll // struct tags can not be wrapped
/* 250-byte string literal not displayed */
OverflowPolicy string `json:"overflowPolicy,omitempty" yaml:"overflowPolicy,omitempty"`
Filename string `json:"filename,omitempty" yaml:"filename,omitempty"`
CsvTemplate string `json:"csvTemplate,omitempty" yaml:"csvTemplate,omitempty"`
ParquetCompressionCodec string `json:"parquetCompressionCodec,omitempty" yaml:"parquetCompressionCodec,omitempty"` //nolint:lll // struct tags can not be wrapped
Path string `json:"path,omitempty" yaml:"path,omitempty"`
OutputDir string `json:"outputDir,omitempty" yaml:"outputDir,omitempty"`
LogFormat string `json:"logFormat,omitempty" yaml:"logFormat,omitempty"`
TracerName string `json:"tracerName,omitempty" yaml:"tracerName,omitempty"`
Container string `json:"container,omitempty" yaml:"container,omitempty"`
Bucket string `json:"bucket,omitempty" yaml:"bucket,omitempty"`
AccountName string `json:"accountName,omitempty" yaml:"accountName,omitempty"`
StreamARN string `json:"streamArn,omitempty" yaml:"streamArn,omitempty"`
Connection string `json:"connection,omitempty" yaml:"connection,omitempty"`
QueueURL string `json:"queueUrl,omitempty" yaml:"queueUrl,omitempty"`
ProjectID string `json:"projectId,omitempty" yaml:"projectId,omitempty"`
DatasetID string `json:"datasetId,omitempty" yaml:"datasetId,omitempty"`
Topic string `json:"topic,omitempty" yaml:"topic,omitempty"`
TableName string `json:"tableName,omitempty" yaml:"tableName,omitempty"`
Database string `json:"database,omitempty" yaml:"database,omitempty"`
Kind string `` //nolint:lll // struct tags can not be wrapped
/* 238-byte string literal not displayed */
WorkgroupName string `json:"workgroupName,omitempty" yaml:"workgroupName,omitempty"`
DBUser string `json:"dbUser,omitempty" yaml:"dbUser,omitempty"`
SecretARN string `json:"secretArn,omitempty" yaml:"secretArn,omitempty"`
GoogleCredentials Secret `json:"googleCredentials,omitzero" yaml:"googleCredentials,omitempty"`
AccountKey Secret `json:"accountKey,omitzero" yaml:"accountKey,omitempty"`
Secret Secret `json:"secret,omitzero" yaml:"secret,omitempty"`
EndpointURL Secret `json:"endpointUrl,omitzero" yaml:"endpointUrl,omitempty"`
AutoMigrate bool `json:"autoMigrate,omitempty" yaml:"autoMigrate,omitempty"`
}
Exporter is an evaluation-data sink. Which keys apply depends on the kind. The AWS endpoint, region and credentials of version 1 are replaced by a reference to a connection.
type ExporterRetry ¶
type ExporterRetry struct {
// MaxAttempts counts the first attempt: 1 means no retry.
MaxAttempts *int `json:"maxAttempts,omitempty" yaml:"maxAttempts,omitempty"`
// InitialBackoff is the wait before the first retry; it doubles up to MaxBackoff.
InitialBackoff *Duration `json:"initialBackoff,omitempty" yaml:"initialBackoff,omitempty"`
// MaxBackoff caps one wait.
MaxBackoff *Duration `json:"maxBackoff,omitempty" yaml:"maxBackoff,omitempty"`
// MaxElapsed caps the time of the retry of one flush: its waits and its attempts.
MaxElapsed *Duration `json:"maxElapsed,omitempty" yaml:"maxElapsed,omitempty"`
// OnExhausted says what becomes of a batch that fails every attempt: keep (default) hands it back to be sent again
// at the next flush, drop drops it and counts it.
OnExhausted string `json:"onExhausted,omitempty" yaml:"onExhausted,omitempty"`
}
ExporterRetry is the retry of a failed export inside the pipeline: exponential backoff with jitter, bounded in attempts and in the time spent waiting. A batch that exhausts it is dropped and counted.
type FileConnection ¶
type FileConnection struct {
Type string `json:"type" jsonschema:"enum=file" yaml:"type"`
// Path is the root directory. Object keys are resolved below it and can not leave it.
Path string `json:"path,omitempty" yaml:"path,omitempty"`
}
FileConnection is a connection of type file: a directory that holds the objects of the control plane, for a volume that is mounted into the relay (a local publish, a shared file system).
type HTTPConnection ¶
type HTTPConnection struct {
TLS *HTTPTLS `json:"tls,omitempty" yaml:"tls,omitempty"`
Timeouts *HTTPTimeouts `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
// Headers are sent with every request, for example Authorization. Each value is a secret reference.
Headers map[string]Secret `json:"headers,omitempty" yaml:"headers,omitempty"`
// MaxRedirects is the number of redirects followed, to the configured origin only and never to a lower scheme.
// Default 3, 0 follows none.
MaxRedirects *int `json:"maxRedirects,omitempty" jsonschema:"minimum=0,maximum=10" yaml:"maxRedirects,omitempty"`
Type string `json:"type" jsonschema:"enum=http" yaml:"type"`
// URL is the base URL: a key is read at <url>/<key>. https, or http for a loopback host (or with
// allowCleartext). No credentials, query or fragment.
URL string `json:"url,omitempty" yaml:"url,omitempty"`
// AllowCleartext lets url be http:// for a host that is not a loopback address. Default false.
AllowCleartext bool `json:"allowCleartext,omitempty" yaml:"allowCleartext,omitempty"`
}
HTTPConnection is a connection of type http: the objects of the control plane are files below a base URL, read with GET and conditional requests.
type HTTPTLS ¶
type HTTPTLS struct {
// CABundleFile is a PEM file of certificate authorities trusted in addition to the system roots.
CABundleFile string `json:"caBundleFile,omitempty" yaml:"caBundleFile,omitempty"`
// MinVersion is the lowest TLS version the connection accepts: 1.2 (default) or 1.3.
MinVersion string `json:"minVersion,omitempty" jsonschema:"enum=1.2,enum=1.3,default=1.2" yaml:"minVersion,omitempty"`
}
HTTPTLS is the TLS setting of an http connection. TLS is on for every https URL; there is no setting that turns the verification of the certificate off.
type HTTPTimeouts ¶
type HTTPTimeouts struct {
// Connect bounds the dial, and the TLS handshake on its own. Defaults to 10s.
Connect *Duration `json:"connect,omitempty" yaml:"connect,omitempty"`
// ResponseHeader bounds the wait for the response headers after the request was sent. Defaults to 20s, at most
// the request timeout.
ResponseHeader *Duration `json:"responseHeader,omitempty" yaml:"responseHeader,omitempty"`
// Request bounds one Get from the dial to the last byte of the body. Defaults to 30s.
Request *Duration `json:"request,omitempty" yaml:"request,omitempty"`
}
HTTPTimeouts are the timeouts of an http connection. Each one bounds one phase; Request bounds the whole Get.
type KafkaFlush ¶
type KafkaFlush struct {
Frequency *Duration `json:"frequency,omitempty" yaml:"frequency,omitempty"`
Bytes int `json:"bytes,omitempty" yaml:"bytes,omitempty"`
Messages int `json:"messages,omitempty" yaml:"messages,omitempty"`
MaxMessages int `json:"maxMessages,omitempty" yaml:"maxMessages,omitempty"`
}
KafkaFlush is sarama `Producer.Flush`.
type KafkaGSSAPI ¶
type KafkaGSSAPI struct {
DisablePAFXFAST *bool `json:"disablePafxfast,omitempty" yaml:"disablePafxfast,omitempty"`
AuthType string `json:"authType,omitempty" jsonschema:"enum=user,enum=keytab" yaml:"authType,omitempty"` //nolint:lll,tagalign // struct tags can not be wrapped
KeyTabPath string `json:"keyTabPath,omitempty" yaml:"keyTabPath,omitempty"`
KerberosConfigPath string `json:"kerberosConfigPath,omitempty" yaml:"kerberosConfigPath,omitempty"`
ServiceName string `json:"serviceName,omitempty" yaml:"serviceName,omitempty"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
Realm string `json:"realm,omitempty" yaml:"realm,omitempty"`
Password Secret `json:"password,omitzero" yaml:"password,omitempty"`
}
KafkaGSSAPI is sarama `Net.SASL.GSSAPI`, for the GSSAPI mechanism. AuthType is user or keytab; Password is `Password`; the other fields are those of the same names.
type KafkaMetadata ¶
type KafkaMetadata struct {
Retry *KafkaRetry `json:"retry,omitempty" yaml:"retry,omitempty"`
// RefreshFrequency and Timeout are the sarama fields of the same names.
RefreshFrequency *Duration `json:"refreshFrequency,omitempty" yaml:"refreshFrequency,omitempty"`
Timeout *Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
// Full, AllowAutoTopicCreation and SingleFlight are the sarama fields of the same names.
Full *bool `json:"full,omitempty" yaml:"full,omitempty"`
AllowAutoTopicCreation *bool `json:"allowAutoTopicCreation,omitempty" yaml:"allowAutoTopicCreation,omitempty"`
SingleFlight *bool `json:"singleFlight,omitempty" yaml:"singleFlight,omitempty"`
}
KafkaMetadata is sarama `Metadata`.
type KafkaNet ¶
type KafkaNet struct {
TLS *KafkaTLS `json:"tls,omitempty" yaml:"tls,omitempty"`
SASL *KafkaSASL `json:"sasl,omitempty" yaml:"sasl,omitempty"`
// DialTimeout, ReadTimeout, WriteTimeout and KeepAlive are the sarama fields of the same names.
DialTimeout *Duration `json:"dialTimeout,omitempty" yaml:"dialTimeout,omitempty"`
ReadTimeout *Duration `json:"readTimeout,omitempty" yaml:"readTimeout,omitempty"`
WriteTimeout *Duration `json:"writeTimeout,omitempty" yaml:"writeTimeout,omitempty"`
KeepAlive *Duration `json:"keepAlive,omitempty" yaml:"keepAlive,omitempty"`
// ResolveCanonicalBootstrapServers is the sarama field of the same name.
ResolveCanonicalBootstrapServers *bool `json:"resolveCanonicalBootstrapServers,omitempty" yaml:"resolveCanonicalBootstrapServers,omitempty"` //nolint:lll // struct tags can not be wrapped
// MaxOpenRequests is sarama `MaxOpenRequests`.
MaxOpenRequests int `json:"maxOpenRequests,omitempty" yaml:"maxOpenRequests,omitempty"`
}
KafkaNet is sarama `Net`.
type KafkaProducer ¶
type KafkaProducer struct {
Retry *KafkaProducerRetry `json:"retry,omitempty" yaml:"retry,omitempty"`
Flush *KafkaFlush `json:"flush,omitempty" yaml:"flush,omitempty"`
Transaction *KafkaTransaction `json:"transaction,omitempty" yaml:"transaction,omitempty"`
// Timeout is sarama `Producer.Timeout`.
Timeout *Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
// Idempotent is sarama `Producer.Idempotent`.
Idempotent *bool `json:"idempotent,omitempty" yaml:"idempotent,omitempty"`
// RequiredAcks is sarama `Producer.RequiredAcks`: none, local or all.
RequiredAcks string `json:"requiredAcks,omitempty" jsonschema:"enum=none,enum=local,enum=all" yaml:"requiredAcks,omitempty"` //nolint:lll // struct tags can not be wrapped
// Compression is sarama `Producer.Compression`.
Compression string `json:"compression,omitempty" jsonschema:"enum=none,enum=gzip,enum=snappy,enum=lz4,enum=zstd" yaml:"compression,omitempty"` //nolint:lll // struct tags can not be wrapped
// Partitioner picks the sarama `Producer.Partitioner` constructor.
Partitioner string `json:"partitioner,omitempty" jsonschema:"enum=hash,enum=random,enum=roundrobin" yaml:"partitioner,omitempty"` //nolint:lll // struct tags can not be wrapped
// MaxMessageBytes and CompressionLevel are the sarama fields of the same names.
MaxMessageBytes int `json:"maxMessageBytes,omitempty" yaml:"maxMessageBytes,omitempty"`
CompressionLevel int `json:"compressionLevel,omitempty" yaml:"compressionLevel,omitempty"`
}
KafkaProducer is sarama `Producer`. `Return.Successes` and `Return.Errors` are always true, as in version 1.
type KafkaProducerRetry ¶
type KafkaProducerRetry struct {
Backoff *Duration `json:"backoff,omitempty" yaml:"backoff,omitempty"`
MaxBufferBytes int64 `json:"maxBufferBytes,omitempty" yaml:"maxBufferBytes,omitempty"`
Max int `json:"max,omitempty" yaml:"max,omitempty"`
MaxBufferLength int `json:"maxBufferLength,omitempty" yaml:"maxBufferLength,omitempty"`
}
KafkaProducerRetry is sarama `Producer.Retry`: Max and Backoff, and the limits of the retry buffer, which only the producer has.
type KafkaRetry ¶
type KafkaRetry struct {
Backoff *Duration `json:"backoff,omitempty" yaml:"backoff,omitempty"`
Max int `json:"max,omitempty" yaml:"max,omitempty"`
}
KafkaRetry is a sarama `Retry` block of the metadata and the transactions: Max and Backoff.
type KafkaSASL ¶
type KafkaSASL struct {
GSSAPI *KafkaGSSAPI `json:"gssapi,omitempty" yaml:"gssapi,omitempty"`
Enable *bool `json:"enable,omitempty" yaml:"enable,omitempty"`
Handshake *bool `json:"handshake,omitempty" yaml:"handshake,omitempty"`
Mechanism string `` //nolint:lll // struct tags can not be wrapped
/* 130-byte string literal not displayed */
User string `json:"user,omitempty" yaml:"user,omitempty"`
AuthIdentity string `json:"authIdentity,omitempty" yaml:"authIdentity,omitempty"`
SCRAMAuthzID string `json:"scramAuthzId,omitempty" yaml:"scramAuthzId,omitempty"`
Password Secret `json:"password,omitzero" yaml:"password,omitempty"`
Version int `json:"version,omitempty" yaml:"version,omitempty"`
}
KafkaSASL is sarama `Net.SASL`. Password is `Net.SASL.Password`; Enable, Handshake, Mechanism (PLAIN when empty), User, AuthIdentity, SCRAMAuthzID and Version are the fields of the same names.
type KafkaSettings ¶
type KafkaSettings struct {
Net *KafkaNet `json:"net,omitempty" yaml:"net,omitempty"`
Metadata *KafkaMetadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`
Producer *KafkaProducer `json:"producer,omitempty" yaml:"producer,omitempty"`
// APIVersionsRequest is sarama `ApiVersionsRequest`.
APIVersionsRequest *bool `json:"apiVersionsRequest,omitempty" yaml:"apiVersionsRequest,omitempty"`
// Topic is the topic the events are published to.
Topic string `json:"topic" yaml:"topic"`
// Version is the Kafka version, such as 3.6.0 (sarama `Version`).
Version string `json:"version,omitempty" yaml:"version,omitempty"`
// ClientID is sarama `ClientID`.
ClientID string `json:"clientId,omitempty" yaml:"clientId,omitempty"`
// RackID is sarama `RackID`.
RackID string `json:"rackId,omitempty" yaml:"rackId,omitempty"`
// Addresses are the bootstrap brokers, host:port.
Addresses []string `json:"addresses" yaml:"addresses"`
// ChannelBufferSize is sarama `ChannelBufferSize`.
ChannelBufferSize int `json:"channelBufferSize,omitempty" yaml:"channelBufferSize,omitempty"`
}
KafkaSettings are the settings of the kafka exporter: the topic and the addresses, and the settings of the producer. Version 1 let an operator set any scalar field of the sarama configuration under `kafka.config`; the fields a producer uses are keys here. A zero value keeps the sarama default, as in version 1 (a value that is not set cannot be told from zero there). The consumer and admin settings, and the fields that hold code (a partitioner function, interceptors, a metric registry, a dialer), do not apply to the exporter.
type KafkaTLS ¶
type KafkaTLS struct {
// Enable is sarama `Net.TLS.Enable`.
Enable *bool `json:"enable,omitempty" yaml:"enable,omitempty"`
// InsecureSkipVerify is the field of the same name of the TLS configuration.
InsecureSkipVerify *bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"`
// ServerName is the field of the same name of the TLS configuration.
ServerName string `json:"serverName,omitempty" yaml:"serverName,omitempty"`
// CAFile is a PEM file of the authorities that sign the brokers (`RootCAs`).
CAFile string `json:"caFile,omitempty" yaml:"caFile,omitempty"`
// CertFile and KeyFile are the PEM files of the client certificate (`Certificates`).
CertFile string `json:"certFile,omitempty" yaml:"certFile,omitempty"`
KeyFile string `json:"keyFile,omitempty" yaml:"keyFile,omitempty"`
}
KafkaTLS is sarama `Net.TLS`. The certificates are files, read when the exporter is built.
type KafkaTransaction ¶
type KafkaTransaction struct {
Retry *KafkaRetry `json:"retry,omitempty" yaml:"retry,omitempty"`
// Timeout is sarama `Producer.Transaction.Timeout`.
Timeout *Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
// ID is sarama `Producer.Transaction.ID`.
ID string `json:"id,omitempty" yaml:"id,omitempty"`
}
KafkaTransaction is sarama `Producer.Transaction`.
type KinesisConnection ¶
type KinesisConnection struct {
AWS `yaml:",inline"`
Type string `json:"type" jsonschema:"enum=kinesis" yaml:"type"`
Stream string `json:"stream,omitempty" yaml:"stream,omitempty"`
}
KinesisConnection is a connection of type kinesis.
type Listener ¶
type Listener struct {
// TLS makes the listener serve TLS. The unix socket never does.
TLS *TLS `json:"tls,omitempty" yaml:"tls,omitempty"`
Name string `json:"name" yaml:"name"`
Address string `json:"address,omitempty" yaml:"address"`
// Role is "api" (default) or "ops".
Role string `json:"role,omitempty" jsonschema:"enum=api,enum=ops,default=api" yaml:"role,omitempty"`
// Protocols are "http1" (default), "h2c" (HTTP/2 over cleartext, refused with tls) and "h2" (HTTP/2 over TLS,
// needs tls).
Protocols []string `json:"protocols,omitempty" jsonschema:"enum=http1,enum=h2c,enum=h2,uniqueItems=true" yaml:"protocols,omitempty"` //nolint:lll // struct tags can not be wrapped
}
Listener is one address the relay listens on.
type LoadOptions ¶
type LoadOptions struct {
// LookupEnv reads an environment variable, like [os.LookupEnv]. A nil function means an empty environment.
LookupEnv func(string) (string, bool)
// ReadFile reads a file, like [os.ReadFile]. It is required by [Load] and by fromFile secrets.
ReadFile func(string) ([]byte, error)
// AllowInlineSecrets accepts plain strings for secrets. Development only.
AllowInlineSecrets bool
// SkipRelayChecks leaves out the checks that only starting the relay needs: the polling bounds of the manifest
// reader. A tool that reads the file for another purpose (publish) sets it; the relay and `config validate`
// do not.
SkipRelayChecks bool
}
LoadOptions injects what the loader needs from the outside world.
type Logging ¶
type Logging struct {
// Level is debug, info, warn or error. Default info.
Level string `json:"level,omitempty" jsonschema:"enum=debug,enum=info,enum=warn,enum=error,default=info" yaml:"level,omitempty"` //nolint:lll // struct tags can not be wrapped
// Format is json or text. Default json.
Format string `json:"format,omitempty" jsonschema:"enum=json,enum=text,default=json" yaml:"format,omitempty"`
}
Logging is the slog setup.
type Manifest ¶
type Manifest struct {
PollInterval *Duration `json:"pollInterval,omitempty" yaml:"pollInterval,omitempty"`
Jitter *float64 `json:"jitter,omitempty" jsonschema:"minimum=0,exclusiveMaximum=1,default=0.1" yaml:"jitter,omitempty"` //nolint:lll // struct tags can not be wrapped
MaxObjects *int `json:"maxObjects,omitempty" jsonschema:"minimum=1,default=20000" yaml:"maxObjects,omitempty"` //nolint:lll // struct tags can not be wrapped
Key string `json:"key,omitempty" yaml:"key"`
Channel string `json:"channel,omitempty" jsonschema:"default=stable" yaml:"channel,omitempty"` //nolint:lll // struct tags can not be wrapped
}
Manifest locates and polls the manifest object.
type Metrics ¶
type Metrics struct {
// Enabled defaults to true.
Enabled *bool `json:"enabled,omitempty" jsonschema:"default=true" yaml:"enabled,omitempty"`
LegacyNames bool `json:"legacyNames,omitempty" yaml:"legacyNames,omitempty"`
PerFlagLabels bool `json:"perFlagLabels,omitempty" yaml:"perFlagLabels,omitempty"`
// PerSegmentLabels adds the series labelled by segment name (off by default: the default series are labelled by
// connection only).
PerSegmentLabels bool `json:"perSegmentLabels,omitempty" yaml:"perSegmentLabels,omitempty"`
// MaxSegmentLabels caps the distinct segment names of those series; the others are counted under "other".
// Default 100.
MaxSegmentLabels int32 `json:"maxSegmentLabels,omitempty" yaml:"maxSegmentLabels,omitempty"`
}
Metrics is the Prometheus setup.
type Notifier ¶
type Notifier struct {
Meta map[string]string `json:"meta,omitempty" yaml:"meta,omitempty"`
Headers map[string]Secret `json:"headers,omitzero" yaml:"headers,omitempty"`
Kind string `json:"kind" jsonschema:"enum=slack,enum=microsoftteams,enum=webhook,enum=discord" yaml:"kind"` //nolint:lll // struct tags can not be wrapped
WebhookURL Secret `json:"webhookUrl,omitzero" yaml:"webhookUrl,omitempty"`
EndpointURL Secret `json:"endpointUrl,omitzero" yaml:"endpointUrl,omitempty"`
Secret Secret `json:"secret,omitzero" yaml:"secret,omitempty"`
}
Notifier sends flag changes. Which keys apply depends on the kind. The relay builds and runs them from the bootstrap file.
type OFREPEventStream ¶
type OFREPEventStream struct {
// BaseURL is the public base URL clients use to reach the relay, for example https://flags.example.com: an
// absolute http or https URL without credentials, query or fragment. Empty means off.
BaseURL string `json:"baseUrl,omitempty" yaml:"baseUrl,omitempty"`
// InactivityDelaySec is the delay in seconds after which a client takes the stream as inactive; 0 omits it.
InactivityDelaySec int `json:"inactivityDelaySec,omitempty" jsonschema:"minimum=0" yaml:"inactivityDelaySec,omitempty"` //nolint:lll // struct tags can not be wrapped
}
OFREPEventStream makes the OFREP bulk evaluation advertise the endpoint of the flag changes (OpenFeature ADR-0008), so that a provider subscribes instead of polling. It is on when BaseURL is set.
type Observability ¶
type Observability struct {
Logging Logging `json:"logging,omitzero" yaml:"logging"`
Metrics Metrics `json:"metrics,omitzero" yaml:"metrics"`
Tracing Tracing `json:"tracing,omitzero" yaml:"tracing"`
}
Observability groups logging, metrics and tracing.
type Ops ¶
type Ops struct {
// Pprof serves the Go profiler on the ops listener, never on the api listener.
Pprof Pprof `json:"pprof,omitzero" yaml:"pprof,omitempty"`
}
Ops holds the settings of the ops listener (the listener with the role ops).
type Overrides ¶
type Overrides struct {
Config string
LogLevel string
LogFormat string
Listen string
OpsListen string
ManifestKey string
StateDir string
// StateDirGiven is true when --state-dir was given, even empty: an empty value then means no state directory and
// wins over the variable and the file.
StateDirGiven bool
}
Overrides are the values of the command-line flags. A flag wins over the environment, which wins over the file. An empty field means the flag is not set. A nil *Overrides is the same as an empty one.
type Poll ¶
type Poll struct {
// Interval defaults to 60s.
Interval *Duration `json:"interval,omitempty" yaml:"interval,omitempty"`
// Jitter is a fraction between 0 and 1. Default 0.1.
Jitter *float64 `json:"jitter,omitempty" jsonschema:"minimum=0,maximum=1,default=0.1" yaml:"jitter,omitempty"`
}
Poll is the polling budget of a connection.
type Pprof ¶
type Pprof struct {
// Enabled needs a listener with the role ops. Default false.
Enabled bool `json:"enabled,omitempty" jsonschema:"default=false" yaml:"enabled,omitempty"`
}
Pprof is the profiler endpoint, under /debug/pprof/ of the ops listener.
type RedisConnection ¶
type RedisConnection struct {
TLS *StoreTLS `json:"tls,omitempty" yaml:"tls,omitempty"`
Timeouts *RedisTimeouts `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
// Atomic sends the existence check and SMISMEMBER of a set segment in one MULTI/EXEC. Unset means on; it only
// matters with segments.missingKey unknown. On a cluster each set is a transaction of its own.
Atomic *bool `json:"atomic,omitempty" yaml:"atomic,omitempty"`
// MaxRetries is the go-redis `MaxRetries`: -1 turns the retries off. Unset keeps the go-redis default.
MaxRetries *int `json:"maxRetries,omitempty" jsonschema:"minimum=-1" yaml:"maxRetries,omitempty"`
// PoolSize is the go-redis `PoolSize`. Unset keeps the go-redis default.
PoolSize *int `json:"poolSize,omitempty" jsonschema:"minimum=1" yaml:"poolSize,omitempty"`
// LookupTimeout bounds one lookup call to the store. Unset means 100ms.
LookupTimeout *Duration `json:"lookupTimeout,omitempty" yaml:"lookupTimeout,omitempty"`
Type string `json:"type" jsonschema:"enum=redis" yaml:"type"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
// KeyPrefix is the default prefix of the keys of the segments. Unset means semaphore:segment:.
KeyPrefix string `json:"keyPrefix,omitempty" yaml:"keyPrefix,omitempty"`
Password Secret `json:"password,omitzero" yaml:"password,omitempty"`
// Addresses are host:port. One address is a single node; several are a cluster.
Addresses []string `json:"addresses,omitempty" yaml:"addresses,omitempty"`
// DB is the database number. It does not apply to a cluster.
DB int `json:"db,omitempty" jsonschema:"minimum=0" yaml:"db,omitempty"`
// Cluster makes a single address a cluster (a configuration endpoint). Several addresses are a cluster already.
Cluster bool `json:"cluster,omitempty" yaml:"cluster,omitempty"`
// Script makes the atomic check one Lua script instead of MULTI/EXEC. It has no effect with atomic false.
Script bool `json:"script,omitempty" yaml:"script,omitempty"`
}
RedisConnection is a connection of type redis: a store of dynamic segments, reached through go-redis.
type RedisTimeouts ¶
type RedisTimeouts struct {
// Connect is the dial timeout (TCP and TLS), 1s or more.
Connect *Duration `json:"connect,omitempty" yaml:"connect,omitempty"`
// Read is the timeout of a socket read, 1s or more. It also bounds the handshake that opens a connection.
Read *Duration `json:"read,omitempty" yaml:"read,omitempty"`
// Write is the timeout of a socket write, 1s or more. It also bounds the handshake that opens a connection.
Write *Duration `json:"write,omitempty" yaml:"write,omitempty"`
}
RedisTimeouts are the go-redis timeouts of a redis connection. An unset timeout keeps the go-redis default.
type RedshiftConnection ¶
type RedshiftConnection struct {
AWS `yaml:",inline"`
Type string `json:"type" jsonschema:"enum=redshift" yaml:"type"`
}
RedshiftConnection is a connection of type redshift.
type ResolvedSecret ¶
type ResolvedSecret struct {
// contains filtered or unexported fields
}
ResolvedSecret is the value of a Secret once read from the environment or a file. It prints the marker with every verb and encoder: the content is only reachable through ResolvedSecret.Reveal.
func (ResolvedSecret) Format ¶
func (ResolvedSecret) Format(f fmt.State, _ rune)
Format implements fmt.Formatter so that no verb prints the content.
func (ResolvedSecret) GoString ¶
func (ResolvedSecret) GoString() string
GoString implements fmt.GoStringer.
func (ResolvedSecret) LogValue ¶
func (ResolvedSecret) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (ResolvedSecret) MarshalJSON ¶
func (ResolvedSecret) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (ResolvedSecret) MarshalText ¶
func (ResolvedSecret) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (ResolvedSecret) MarshalYAML ¶
func (ResolvedSecret) MarshalYAML() (any, error)
MarshalYAML implements yaml.Marshaler.
func (ResolvedSecret) Reveal ¶
func (r ResolvedSecret) Reveal() string
Reveal returns the content. Pass it to the client that needs it and never log it.
func (ResolvedSecret) String ¶
func (ResolvedSecret) String() string
String implements fmt.Stringer.
type Retry ¶
type Retry struct {
// MaxAttempts defaults to 3.
MaxAttempts *int `json:"maxAttempts,omitempty" jsonschema:"minimum=1,maximum=20,default=3" yaml:"maxAttempts,omitempty"` //nolint:lll // struct tags can not be wrapped
// MaxBackoff defaults to 20s.
MaxBackoff *Duration `json:"maxBackoff,omitempty" yaml:"maxBackoff,omitempty"`
}
Retry settings of the AWS client.
type S3Connection ¶
type S3Connection struct {
AWS `yaml:",inline"`
Poll *Poll `json:"poll,omitempty" yaml:"poll,omitempty"`
Type string `json:"type" jsonschema:"enum=s3" yaml:"type"`
Bucket string `json:"bucket,omitempty" yaml:"bucket,omitempty"`
// RequestChecksumCalculation is whenSupported (default) or whenRequired.
RequestChecksumCalculation string `` //nolint:lll // struct tags can not be wrapped
/* 159-byte string literal not displayed */
// ResponseChecksumValidation is whenSupported (default) or whenRequired.
ResponseChecksumValidation string `` //nolint:lll // struct tags can not be wrapped
/* 159-byte string literal not displayed */
PathStyle bool `json:"pathStyle,omitempty" yaml:"pathStyle,omitempty"`
}
S3Connection is a connection of type s3: one bucket, one endpoint, one credentials identity.
type SQSConnection ¶
type SQSConnection struct {
AWS `yaml:",inline"`
Type string `json:"type" jsonschema:"enum=sqs" yaml:"type"`
QueueURL string `json:"queueUrl,omitempty" yaml:"queueUrl,omitempty"`
}
SQSConnection is a connection of type sqs.
type Secret ¶
type Secret struct {
// contains filtered or unexported fields
}
Secret is a reference to a sensitive value, written in the file as {fromEnv: NAME} or {fromFile: PATH}. A plain scalar is an inline secret: the validation rejects it unless LoadOptions.AllowInlineSecrets is set. A Secret never prints its content: every formatting verb and every encoder gives RedactedValue for an inline value and the reference form for the others.
func (Secret) Format ¶
Format implements fmt.Formatter so that no verb prints the content.
func (Secret) JSONSchema ¶
func (Secret) JSONSchema() *jsonschema.Schema
JSONSchema describes the reference form of a secret.
func (Secret) MarshalJSON ¶
MarshalJSON implements json.Marshaler: the reference form, or the marker for an inline value.
func (Secret) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (Secret) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler: the reference form, or the marker for an inline value.
func (Secret) Resolve ¶
func (s Secret) Resolve(opts LoadOptions) (ResolvedSecret, error)
Resolve reads the value of the secret through the injected environment and file readers.
func (*Secret) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.
type SegmentResolver ¶
type SegmentResolver struct {
// CallTimeout bounds the shared call to a store. Default 2s.
CallTimeout *Duration `json:"callTimeout,omitempty" yaml:"callTimeout,omitempty"`
// ShutdownGrace bounds how long the old resolver may take to stop after a reload. Default 5s.
ShutdownGrace *Duration `json:"shutdownGrace,omitempty" yaml:"shutdownGrace,omitempty"`
// MaxOverdue is the number of overdue store calls from which no new call starts. Default 8.
MaxOverdue *int `json:"maxOverdue,omitempty" jsonschema:"minimum=1" yaml:"maxOverdue,omitempty"`
// MaxIDBytes is the longest id that is looked up. Default 512.
MaxIDBytes *int `json:"maxIdBytes,omitempty" jsonschema:"minimum=1" yaml:"maxIdBytes,omitempty"`
// Default is the cache and breaker settings of every segment.
Default SegmentTuning `json:"default,omitzero" yaml:"default"`
}
SegmentResolver is the settings of the resolver that sits in front of the stores.
type SegmentTuning ¶
type SegmentTuning struct {
// TTL is how long a member is cached. Default 30s.
TTL *Duration `json:"ttl,omitempty" yaml:"ttl,omitempty"`
// NegativeTTL is how long a non-member is cached. Default 5s.
NegativeTTL *Duration `json:"negativeTtl,omitempty" yaml:"negativeTtl,omitempty"`
// BreakerCooldown is how long the breaker stays open. Default 10s.
BreakerCooldown *Duration `json:"breakerCooldown,omitempty" yaml:"breakerCooldown,omitempty"`
// MaxEntries bounds the cache of a segment. Default 10000.
MaxEntries *int `json:"maxEntries,omitempty" jsonschema:"minimum=1" yaml:"maxEntries,omitempty"`
// Shards is the number of locks of the cache. Default 16.
Shards *int `json:"shards,omitempty" jsonschema:"minimum=1" yaml:"shards,omitempty"`
// BreakerFailures is the number of consecutive failed calls that open the breaker. Default 5.
BreakerFailures *int `json:"breakerFailures,omitempty" jsonschema:"minimum=1" yaml:"breakerFailures,omitempty"`
// NoCache turns the cache off.
NoCache *bool `json:"noCache,omitempty" yaml:"noCache,omitempty"`
// NoBreaker turns the breaker off.
NoBreaker *bool `json:"noBreaker,omitempty" yaml:"noBreaker,omitempty"`
// Normalize is none (default) or trimLower, applied to the ids before the cache and the store.
Normalize string `json:"normalize,omitempty" jsonschema:"enum=none,enum=trimLower" yaml:"normalize,omitempty"`
}
SegmentTuning is the cache and breaker settings of the segments. An unset value takes the default.
type Segments ¶
type Segments struct {
// WaitForStores makes /readyz wait for the first dial outcome (connected or failed) of every segment store that the
// served generation needs. Default true. False makes the relay ready as soon as a generation is applied.
WaitForStores *bool `json:"waitForStores,omitempty" yaml:"waitForStores,omitempty"`
Resolver SegmentResolver `json:"resolver,omitzero" yaml:"resolver"`
}
Segments configures the process-level settings of the segment stores. The segment definitions are published content: they come from the control plane, not from this file.
type Server ¶
type Server struct {
// UnixSocketPath is the path of the unix socket the api serves on, instead of an api listener.
UnixSocketPath string `json:"unixSocketPath,omitempty" yaml:"unixSocketPath,omitempty"`
// UnixSocketMode is the permission bits of the socket file, in octal ("0660", the default, or "660").
UnixSocketMode string `json:"unixSocketMode,omitempty" jsonschema:"default=0660" yaml:"unixSocketMode,omitempty"`
// Listeners are the addresses the relay listens on.
Listeners []Listener `json:"listeners,omitempty" yaml:"listeners,omitempty"`
// Shutdown tunes the stop of the relay after SIGTERM or SIGINT.
Shutdown Shutdown `json:"shutdown,omitzero" yaml:"shutdown,omitempty"`
// Ops tunes the ops listener.
Ops Ops `json:"ops,omitzero" yaml:"ops,omitempty"`
// OFREPEventStream advertises the flag change stream in the OFREP bulk evaluation.
OFREPEventStream OFREPEventStream `json:"ofrepEventStream,omitzero" yaml:"ofrepEventStream,omitempty"`
// ValidateFlags limits the body of the validate flags endpoint.
ValidateFlags ValidateFlags `json:"validateFlags,omitzero" yaml:"validateFlags,omitempty"`
// HideBanner keeps the banner out of the standard output at start.
HideBanner bool `json:"hideBanner,omitempty" yaml:"hideBanner,omitempty"`
}
Server is the network side of the relay.
type Shutdown ¶
type Shutdown struct {
// DrainDelay is how long the relay keeps serving after the readiness answered 503, so that load balancers stop
// sending traffic. Zero, or unset, means no delay.
DrainDelay *Delay `json:"drainDelay,omitempty" yaml:"drainDelay,omitempty"`
// Timeout bounds the stop that follows the drain delay (default 15s). When it ends the relay stops hard.
Timeout *Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}
Shutdown is how the relay stops: it fails the readiness, waits the drain delay while it keeps serving, then stops the listeners and the core within the timeout.
type StoreTLS ¶
type StoreTLS struct {
// ServerName overrides the name the server certificate is checked against.
ServerName string `json:"serverName,omitempty" yaml:"serverName,omitempty"`
// CABundleFile is a PEM file of certificate authorities trusted in addition to the system roots.
CABundleFile string `json:"caBundleFile,omitempty" yaml:"caBundleFile,omitempty"`
Enable bool `json:"enable,omitempty" yaml:"enable,omitempty"`
}
StoreTLS is the TLS setting of a redis or valkey connection. TLS is off unless Enable is true.
type TLS ¶
type TLS struct {
// CertFile is the path of the PEM certificate chain, the leaf first.
CertFile string `json:"certFile" yaml:"certFile"`
// KeyFile is the path of the PEM private key of the leaf.
KeyFile string `json:"keyFile" yaml:"keyFile"`
// MinVersion is the lowest TLS version accepted, "1.2" (default) or "1.3". Quote it in YAML.
MinVersion string `json:"minVersion,omitempty" jsonschema:"enum=1.2,enum=1.3,default=1.2" yaml:"minVersion,omitempty"`
}
TLS is the certificate of a listener. The files are read at start and again when they change, see the documentation of the bootstrap file.
type Timeouts ¶
type Timeouts struct {
// Connect defaults to 10s.
Connect *Duration `json:"connect,omitempty" yaml:"connect,omitempty"`
// Request defaults to 30s.
Request *Duration `json:"request,omitempty" yaml:"request,omitempty"`
}
Timeouts of the AWS client.
type Tracing ¶
type Tracing struct {
OTLPEndpoint string `json:"otlpEndpoint,omitempty" yaml:"otlpEndpoint,omitempty"`
// ServiceName defaults to semaphore.
ServiceName string `json:"serviceName,omitempty" jsonschema:"default=semaphore" yaml:"serviceName,omitempty"`
// Sampler defaults to parentbased_always_off.
Sampler string `` //nolint:lll // struct tags can not be wrapped
/* 227-byte string literal not displayed */
}
Tracing is the OpenTelemetry setup.
type ValidateFlags ¶
type ValidateFlags struct {
// MaxJSONBodySize is the largest JSON body. Default 1MiB, applied by the endpoint when unset or zero.
MaxJSONBodySize *ByteSize `` //nolint:lll // struct tags can not be wrapped
/* 167-byte string literal not displayed */
// MaxYAMLBodySize is the largest YAML body. Default 64KiB, applied by the endpoint when unset or zero.
MaxYAMLBodySize *ByteSize `` //nolint:lll // struct tags can not be wrapped
/* 168-byte string literal not displayed */
// MaxTOMLBodySize is the largest TOML body. Default 64KiB, applied by the endpoint when unset or zero.
MaxTOMLBodySize *ByteSize `` //nolint:lll // struct tags can not be wrapped
/* 168-byte string literal not displayed */
}
ValidateFlags are the limits of the body of POST /admin/v1/flags/validate, by format.
type ValkeyConnection ¶
type ValkeyConnection struct {
TLS *StoreTLS `json:"tls,omitempty" yaml:"tls,omitempty"`
Timeouts *ValkeyTimeouts `json:"timeouts,omitempty" yaml:"timeouts,omitempty"`
// Atomic sends the existence check and SMISMEMBER of a set segment in one MULTI/EXEC. Unset means on; it only
// matters with segments.missingKey unknown. The transaction goes to the primary.
Atomic *bool `json:"atomic,omitempty" yaml:"atomic,omitempty"`
// LookupTimeout bounds one lookup call to the store. Unset means 100ms.
LookupTimeout *Duration `json:"lookupTimeout,omitempty" yaml:"lookupTimeout,omitempty"`
Type string `json:"type" jsonschema:"enum=valkey" yaml:"type"`
Username string `json:"username,omitempty" yaml:"username,omitempty"`
// Pipelining is always (default) or auto, as in the valkey segment provider.
Pipelining string `json:"pipelining,omitempty" jsonschema:"enum=always,enum=auto,default=always" yaml:"pipelining,omitempty"` //nolint:lll // struct tags can not be wrapped
// KeyPrefix is the default prefix of the keys of the segments. Unset means semaphore:segment:.
KeyPrefix string `json:"keyPrefix,omitempty" yaml:"keyPrefix,omitempty"`
Password Secret `json:"password,omitzero" yaml:"password,omitempty"`
// Addresses are host:port. valkey-go finds out whether they are a cluster.
Addresses []string `json:"addresses,omitempty" yaml:"addresses,omitempty"`
// BlockingPipeline is the number of commands of one call from which valkey-go uses a dedicated connection.
// Zero (default) means never.
BlockingPipeline int `json:"blockingPipeline,omitempty" jsonschema:"minimum=0" yaml:"blockingPipeline,omitempty"`
// ForceSingleClient keeps valkey-go from probing for a cluster when one address is given.
ForceSingleClient bool `json:"forceSingleClient,omitempty" yaml:"forceSingleClient,omitempty"`
// Retry lets valkey-go send a read again after a network error. Default false.
Retry bool `json:"retry,omitempty" yaml:"retry,omitempty"`
}
ValkeyConnection is a connection of type valkey: a store of dynamic segments, reached through valkey-go.
type ValkeyTimeouts ¶
type ValkeyTimeouts struct {
// Connect is the dial timeout.
Connect *Duration `json:"connect,omitempty" yaml:"connect,omitempty"`
// IO is the read and write timeout of each connection (valkey-go `ConnWriteTimeout`), from 1s to 1m, and not
// below lookupTimeout. It also bounds the handshake that opens a connection (together with the connect timeout).
// Unset means ten lookup timeouts, at least 1s.
IO *Duration `json:"io,omitempty" yaml:"io,omitempty"`
}
ValkeyTimeouts are the valkey-go timeouts of a valkey connection. An unset timeout keeps the valkey-go default.
Source Files
¶
- bytesize.go
- config.go
- connection.go
- connection_file.go
- connection_http.go
- connection_store.go
- connection_types.go
- connspec.go
- consts.go
- controlplane.go
- decode.go
- defaults.go
- doc.go
- duration.go
- errors.go
- exporter.go
- kafka.go
- kafka_producer.go
- kafka_retry.go
- listener_tls.go
- load.go
- observability.go
- schema.go
- secret.go
- segments.go
- server_settings.go
- shutdown.go
- validate.go
- validate_kafka.go
- validate_refs.go
- validate_segments.go