Documentation
¶
Index ¶
- Constants
- Variables
- type APIKeys
- type ApiKeyType
- type CommonFlagSet
- type Config
- func (c *Config) APIKeyExists(apiKey string) bool
- func (c *Config) APIKeysAdminExists(apiKey string) bool
- func (c *Config) AttachConfigChangeCallback(callback func(newConfig *Config))
- func (c *Config) EffectiveAwsApiGatewayBasePath(logger *zap.Logger) string
- func (c *Config) EffectiveMonitoringPort(logger *zap.Logger) int
- func (c *Config) ForceReloadAPIKeys()
- func (c *Config) GetAPIKeys() []string
- func (c *Config) GetAuthorizedKeys() APIKeys
- func (c *Config) GetFlagSetAPIKeys(flagsetName string) ([]string, error)
- func (c *Config) IsAuthenticationEnabled() bool
- func (c *Config) IsDebugEnabled() bool
- func (c *Config) IsSwaggerEnabled() bool
- func (c *Config) IsUsingFlagsets() bool
- func (c *Config) IsValid() error
- func (c *Config) LambdaAdapter(logger *zap.Logger) LambdaAdapter
- func (c *Config) ServerHost() string
- func (c *Config) ServerMode(logger *zap.Logger) ServerMode
- func (c *Config) ServerPort(logger *zap.Logger) int
- func (c *Config) SetAPIKeys(apiKeys []string)deprecated
- func (c *Config) SetAuthorizedKeys(authorizedKeys APIKeys)
- func (c *Config) SetFlagSetAPIKeys(flagsetName string, apiKeys []string) error
- func (c *Config) StopConfigChangeWatcher() error
- func (c *Config) SwaggerHost() string
- func (c *Config) UnixSocketPath() string
- func (c *Config) ZapLogLevel() zapcore.Level
- type ConfigLoader
- type ExporterConf
- type ExporterKind
- type FlagSet
- type JaegerSampler
- type JaegerSamplerConfiguration
- type JaegerSamplerManager
- type JaegerSamplerManagerHost
- type JaegerSamplerMax
- type JaegerSamplerRefresh
- type LambdaAdapter
- type NotifierConf
- type NotifierKind
- type OpenTelemetryConfiguration
- type OtelExporter
- type OtelExporterOtlp
- type OtelResource
- type Server
- type ServerMode
- type Swagger
Constants ¶
const DefaultLogLevel = "info"
const OtelTracerName = "go-feature-flag"
Variables ¶
var DefaultExporter = struct { Format string LogFormat string FileName string CsvFormat string FlushInterval time.Duration MaxEventInMemory int64 ParquetCompressionCodec string LogLevel string ExporterEventType ffclient.ExporterEventType }{ Format: "JSON", LogFormat: "[{{ .FormattedDate}}] user=\"{{ .UserKey}}\", flag=\"{{ .Key}}\", value=\"{{ .Value}}\"", FileName: "flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}", CsvFormat: "{{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};" + "{{ .Value}};{{ .Default}};{{ .Source}}\n", FlushInterval: 60000 * time.Millisecond, MaxEventInMemory: 100000, ParquetCompressionCodec: parquet.CompressionCodec_SNAPPY.String(), LogLevel: DefaultLogLevel, ExporterEventType: ffclient.FeatureEventExporter, }
Functions ¶
This section is empty.
Types ¶
type APIKeys ¶
type APIKeys struct {
Admin []string `mapstructure:"admin" koanf:"admin"`
Evaluation []string `mapstructure:"evaluation" koanf:"evaluation"`
}
APIKeys is a struct to store the API keys for the different endpoints
type ApiKeyType ¶
type ApiKeyType = string
const ( EvaluationKeyType ApiKeyType = "EVALUATION" AdminKeyType ApiKeyType = "ADMIN" FlagSetKeyType ApiKeyType = "FLAGSET" ErrorKeyType ApiKeyType = "ERROR" )
Enum for the type of the API keys
type CommonFlagSet ¶
type CommonFlagSet struct {
// Retriever is the configuration on how to retrieve the file
Retriever *retrieverconf.RetrieverConf `mapstructure:"retriever" koanf:"retriever"`
// Retrievers is the exact same things than Retriever but allows to give more than 1 retriever at the time.
// We are dealing with config files in order, if you have the same flag name in multiple files it will be override
// based of the order of the retrievers in the slice.
//
// Note: If both Retriever and Retrievers are set, we will start by calling the Retriever and,
// after we will use the order of Retrievers.
Retrievers *[]retrieverconf.RetrieverConf `mapstructure:"retrievers" koanf:"retrievers"`
// Notifiers is the configuration on where to notify a flag change
Notifiers []NotifierConf `mapstructure:"notifiers" koanf:"notifiers"`
// FixNotifiers, Before version v1.46.0, the notifier was called "notifier" instead of "notifiers".
// This is a backward compatibility fix to allow to use the old configuration.
// This will be removed in a future version.
//
// Deprecated: use Notifiers instead.
FixNotifiers []NotifierConf `mapstructure:"notifier" koanf:"notifier"`
// Exporter is the configuration on how to export data
Exporter *ExporterConf `mapstructure:"exporter" koanf:"exporter"`
// Exporters is the exact same things than Exporter but allows to give more than 1 exporter at the time.
Exporters *[]ExporterConf `mapstructure:"exporters" koanf:"exporters"`
// FileFormat (optional) is the format of the file to retrieve (available YAML, TOML and JSON)
// Default: YAML
FileFormat string `mapstructure:"fileFormat" koanf:"fileformat"`
// PollingInterval (optional) Poll every X time
// The minimum possible is 1 second
// Default: 60 seconds
PollingInterval int `mapstructure:"pollingInterval" koanf:"pollinginterval"`
// StartWithRetrieverError (optional) If true, the relay proxy will start even if we did not get any flags from
// the retriever. It will serve only default values until the retriever returns the flags.
// The init method will not return any error if the flag file is unreachable.
// Default: false
StartWithRetrieverError bool `mapstructure:"startWithRetrieverError" koanf:"startwithretrievererror"`
// EnablePollingJitter (optional) set to true if you want to avoid having true periodicity when
// retrieving your flags. It is useful to avoid having spike on your flag configuration storage
// in case your application is starting multiple instance at the same time.
// We ensure a deviation that is maximum + or - 10% of your polling interval.
// Default: false
EnablePollingJitter bool `mapstructure:"enablePollingJitter" koanf:"enablepollingjitter"`
// DisableNotifierOnInit (optional) set to true if you do not want to call any notifier
// when the flags are loaded.
// This is useful if you do not want a Slack/Webhook notification saying that
// the flags have been added every time you start the application.
// Default is set to false for backward compatibility.
// Default: false
DisableNotifierOnInit bool `mapstructure:"disableNotifierOnInit" koanf:"disablenotifieroninit"`
// EvaluationContextEnrichment is the flag to enable the evaluation context enrichment.
EvaluationContextEnrichment map[string]any `mapstructure:"evaluationContextEnrichment" koanf:"evaluationcontextenrichment"` //nolint: lll
// PersistentFlagConfigurationFile is the flag to enable the persistent flag configuration file.
PersistentFlagConfigurationFile string `mapstructure:"persistentFlagConfigurationFile" koanf:"persistentflagconfigurationfile"` //nolint: lll
// Environment is the environment of the flag set.
Environment string `mapstructure:"environment" koanf:"environment"`
}
type Config ¶
type Config struct {
// CommonFlagSet is the common flag set for the relay proxy
CommonFlagSet `mapstructure:",inline" koanf:",squash"`
// Server is the server configuration, including host, port, and unix socket
Server Server `mapstructure:"server" koanf:"server"`
// Swagger is the swagger configuration
Swagger Swagger `mapstructure:"swagger" koanf:"swagger"`
// HideBanner (optional) if true, we don't display the go-feature-flag relay proxy banner
HideBanner bool `mapstructure:"hideBanner" koanf:"hidebanner"`
// EnablePprof (optional) if true, go-feature-flag relay proxy will start
// the pprof endpoints on the same port as the monitoring.
// Default: false
EnablePprof bool `mapstructure:"enablePprof" koanf:"enablepprof"`
// LogLevel (optional) sets the verbosity for logging,
// Possible values: debug, info, warn, error, dpanic, panic, fatal
// If level debug go-feature-flag relay proxy will run on debug mode, with more logs and custom responses
// Default: debug
LogLevel string `mapstructure:"logLevel" koanf:"loglevel"`
// LogFormat (optional) sets the log message format
// Possible values: json, logfmt
// Default: json
LogFormat string `mapstructure:"logFormat" koanf:"logformat"`
// ExporterCleanQueueInterval (optional) is the duration between each cleaning of the queue by the thread in charge
// of removing the old events.
// Default: 1 minute
ExporterCleanQueueInterval time.Duration `mapstructure:"exporterCleanQueueInterval" koanf:"exportercleanqueueinterval"`
// Version is the version of the relay-proxy
Version string `mapstructure:"version" koanf:"version"`
// Disable x-gofeatureflag-version header in the relay-proxy HTTP response
// Default: false
DisableVersionHeader bool `mapstructure:"disableVersionHeader" koanf:"disableversionheader"`
// AuthorizedKeys list of API keys that authorized to use endpoints
AuthorizedKeys APIKeys `mapstructure:"authorizedKeys" koanf:"authorizedkeys"`
// EvaluationContextEnrichment (optional) will be merged with the evaluation context sent during the evaluation.
// It is useful to add common attributes to all the evaluations, such as a server version, environment, ...
//
// All those fields will be included in the custom attributes of the evaluation context,
// if in the evaluation context you have a field with the same name,
// it will be overridden by the evaluationContextEnrichment.
// Default: nil
EvaluationContextEnrichment map[string]any `mapstructure:"evaluationContextEnrichment" koanf:"evaluationcontextenrichment"` //nolint: lll
// OpenTelemetryOtlpEndpoint (optional) is the endpoint of the OpenTelemetry collector
// Default: ""
OpenTelemetryOtlpEndpoint string `mapstructure:"openTelemetryOtlpEndpoint" koanf:"opentelemetryotlpendpoint"`
// PersistentFlagConfigurationFile (optional) if set GO Feature Flag will store flags configuration in this file
// to be able to serve the flags even if none of the retrievers is available during starting time.
//
// By default, the flag configuration is not persisted and stays on the retriever system. By setting a file here,
// you ensure that GO Feature Flag will always start with a configuration but which can be out-dated.
PersistentFlagConfigurationFile string `mapstructure:"persistentFlagConfigurationFile" koanf:"persistentflagconfigurationfile"` //nolint: lll
// OtelConfig is the configuration for the OpenTelemetry part of the relay proxy
OtelConfig OpenTelemetryConfiguration `mapstructure:"otel" koanf:"otel"`
// JaegerConfig is the configuration for the Jaeger sampling of the relay proxy
JaegerConfig JaegerSamplerConfiguration `mapstructure:"jaeger" koanf:"jaeger"`
// EnvVariablePrefix (optional) is the prefix we are using to load the environment variables
// By default we have no prefix
EnvVariablePrefix string `mapstructure:"envVariablePrefix" koanf:"envvariableprefix"`
// EnableBulkMetricFlagNames (optional) enables per-flag metrics for bulk evaluation endpoints.
// This adds flag_name labels to the all_flags_evaluations_total_with_flag metric.
// Default: false
EnableBulkMetricFlagNames bool `mapstructure:"enableBulkMetricFlagNames" koanf:"enablebulkmetricflagnames"`
// FlagSets is the list of flag sets configured.
// A flag set is a group of flags that can be used to configure the relay proxy.
// Each flag set can have its own API key, retrievers, notifiers and exporters.
// There is no inheritance between flag sets.
FlagSets []FlagSet `mapstructure:"flagsets" koanf:"flagsets"`
// ---------- Deprecated fields ----------
// ListenPort (optional) is the port we are using to start the proxy
//
// Deprecated: use Server.Port instead
ListenPort int `mapstructure:"listen" koanf:"listen"`
// MonitoringPort (optional) is the port we are using to expose the metrics and healthchecks
// If not set we will use the same port as the proxy
//
// Deprecated: use Server.MonitoringPort instead
MonitoringPort int `mapstructure:"monitoringPort" koanf:"monitoringport"`
// Deprecated: use Swagger.Enabled instead
EnableSwagger bool `mapstructure:"enableSwagger" koanf:"enableswagger"`
// Deprecated: use Swagger.Host instead
Host string `mapstructure:"host" koanf:"host"`
// Deprecated: use AuthorizedKeys instead
// APIKeys list of API keys that authorized to use endpoints
APIKeys []string `mapstructure:"apiKeys" koanf:"apikeys"`
// StartAsAwsLambda (optional) if true, the relay proxy will start ready to be launched as AWS Lambda
//
// Deprecated: use `Server.Mode = lambda` instead
StartAsAwsLambda bool `mapstructure:"startAsAwsLambda" koanf:"startasawslambda"`
// AwsLambdaAdapter (optional) is the adapter to use when the relay proxy is started as an AWS Lambda.
// Possible values are "APIGatewayV1", "APIGatewayV2" and "ALB"
// Default: "APIGatewayV2"
//
// Deprecated: use `Server.LambdaAdapter` instead
AwsLambdaAdapter string `mapstructure:"awsLambdaAdapter" koanf:"awslambdaadapter"`
// AwsApiGatewayBasePath (optional) is the base path prefix for AWS API Gateway deployments.
// This is useful when deploying behind a non-root path like "/api" or "/dev/feature-flags".
// The relay proxy will strip this base path from incoming requests before processing.
// Example: if set to "/api/feature-flags", requests to "/api/feature-flags/health" will be processed as "/health"
// Default: ""
//
// Deprecated: use `Server.AwsApiGatewayBasePath` instead
AwsApiGatewayBasePath string `mapstructure:"awsApiGatewayBasePath" koanf:"awsapigatewaybasepath"`
// contains filtered or unexported fields
}
func (*Config) APIKeyExists ¶
APIKeyExists is checking if an API Key exist in the relay proxy configuration
func (*Config) APIKeysAdminExists ¶
APIKeysAdminExists is checking if an admin API Key exist in the relay proxy configuration
func (*Config) AttachConfigChangeCallback ¶
AttachConfigChangeCallback attaches a callback to be called when the configuration changes
func (*Config) EffectiveAwsApiGatewayBasePath ¶
EffectiveAwsApiGatewayBasePath returns the AWS API Gateway base path, checking first the server config and then the top-level config, defaulting to empty string if not set.
func (*Config) EffectiveMonitoringPort ¶
EffectiveMonitoringPort returns the monitoring port, checking first the top-level config and then the server config.
func (*Config) ForceReloadAPIKeys ¶
func (c *Config) ForceReloadAPIKeys()
ForceReloadAPIKeys is forcing the reload of the API Keys. This is used to reload the API Keys when the configuration changes. The entire reload operation is atomic to prevent race conditions.
func (*Config) GetAPIKeys ¶
GetAPIKeys returns a copy of the APIKeys with proper synchronization.
func (*Config) GetAuthorizedKeys ¶
GetAuthorizedKeys returns a copy of the AuthorizedKeys with proper synchronization.
func (*Config) GetFlagSetAPIKeys ¶
func (*Config) IsAuthenticationEnabled ¶
IsAuthenticationEnabled returns true if we need to be authenticated.
func (*Config) IsDebugEnabled ¶
IsDebugEnabled returns true if the log level is debug
func (*Config) IsSwaggerEnabled ¶
IsSwaggerEnabled is the function to check if the swagger is enabled. If the Swagger.Enabled is true, we return true. If the EnableSwagger is true, we return true. If both are false, we return false.
func (*Config) IsUsingFlagsets ¶
IsUsingFlagsets returns true if the configuration is using flagsets
func (*Config) LambdaAdapter ¶
func (c *Config) LambdaAdapter(logger *zap.Logger) LambdaAdapter
LambdaAdapter returns the lambda adapter, checking first the server config and then the top-level config, defaulting to APIGatewayV2 if not set.
func (*Config) ServerHost ¶
ServerHost returns the server host, defaulting to "0.0.0.0" if not set.
func (*Config) ServerMode ¶
func (c *Config) ServerMode(logger *zap.Logger) ServerMode
ServerMode returns the server mode, checking first the server config and then the top-level config, defaulting to HTTP if not set.
func (*Config) ServerPort ¶
ServerPort returns the server port, checking first the server config and then the top-level config, defaulting to 1031 if not set.
func (*Config) SetAPIKeys
deprecated
func (*Config) SetAuthorizedKeys ¶
SetAuthorizedKeys sets the authorized keys for the configuration
func (*Config) SetFlagSetAPIKeys ¶
func (*Config) StopConfigChangeWatcher ¶
StopConfigChangeWatcher stops the watcher for the configuration changes
func (*Config) SwaggerHost ¶
SwaggerHost returns the swagger host. If the Swagger.Host is set, we return it. If the Host is set, we return it. If both are not set, we return "localhost".
func (*Config) UnixSocketPath ¶
UnixSocketPath returns the unix socket path.
func (*Config) ZapLogLevel ¶
ZapLogLevel returns the zap core level for the log level
type ConfigLoader ¶
type ConfigLoader struct {
// contains filtered or unexported fields
}
func NewConfigLoader ¶
func NewConfigLoader( cmdLineFlagSet *pflag.FlagSet, log *zap.Logger, version string, watchChanges bool) *ConfigLoader
NewConfigLoader creates a new ConfigLoader.
func (*ConfigLoader) AddConfigChangeCallback ¶
func (c *ConfigLoader) AddConfigChangeCallback(callback func(newConfig *Config))
AddConfigChangeCallback adds a callback to be called when the configuration changes
func (*ConfigLoader) StopWatchChanges ¶
func (c *ConfigLoader) StopWatchChanges() error
StopWatchChanges stops watching for changes in the configuration file
func (*ConfigLoader) ToConfig ¶
func (c *ConfigLoader) ToConfig() (*Config, error)
ToConfig returns the configuration.
type ExporterConf ¶
type ExporterConf struct {
Kind ExporterKind `mapstructure:"kind" koanf:"kind"`
TracerName string `mapstructure:"tracerName" koanf:"tracername"`
OutputDir string `mapstructure:"outputDir" koanf:"outputdir"`
Format string `mapstructure:"format" koanf:"format"`
Filename string `mapstructure:"filename" koanf:"filename"`
CsvTemplate string `mapstructure:"csvTemplate" koanf:"csvtemplate"`
Bucket string `mapstructure:"bucket" koanf:"bucket"`
Path string `mapstructure:"path" koanf:"path"`
EndpointURL string `mapstructure:"endpointUrl" koanf:"endpointurl"`
Secret string `mapstructure:"secret" koanf:"secret"`
Meta map[string]string `mapstructure:"meta" koanf:"meta"`
LogFormat string `mapstructure:"logFormat" koanf:"logformat"`
FlushInterval int64 `mapstructure:"flushInterval" koanf:"flushinterval"`
MaxEventInMemory int64 `mapstructure:"maxEventInMemory" koanf:"maxeventinmemory"`
ParquetCompressionCodec string `mapstructure:"parquetCompressionCodec" koanf:"parquetcompressioncodec"`
Headers map[string][]string `mapstructure:"headers" koanf:"headers"`
QueueURL string `mapstructure:"queueUrl" koanf:"queueurl"`
Kafka kafkaexporter.Settings `mapstructure:"kafka" koanf:"kafka"`
ProjectID string `mapstructure:"projectID" koanf:"projectid"`
Topic string `mapstructure:"topic" koanf:"topic"`
StreamArn string `mapstructure:"streamArn" koanf:"streamarn"`
StreamName string `mapstructure:"streamName" koanf:"streamname"`
AccountName string `mapstructure:"accountName" koanf:"accountname"`
AccountKey string `mapstructure:"accountKey" koanf:"accountkey"`
Container string `mapstructure:"container" koanf:"container"`
ExporterEventType string `mapstructure:"eventType" koanf:"eventtype"`
}
ExporterConf contains all the field to configure an exporter
func (*ExporterConf) IsValid ¶
func (c *ExporterConf) IsValid() error
type ExporterKind ¶
type ExporterKind string
const ( FileExporter ExporterKind = "file" WebhookExporter ExporterKind = "webhook" LogExporter ExporterKind = "log" S3Exporter ExporterKind = "s3" KinesisExporter ExporterKind = "kinesis" GoogleStorageExporter ExporterKind = "googleStorage" SQSExporter ExporterKind = "sqs" KafkaExporter ExporterKind = "kafka" PubSubExporter ExporterKind = "pubsub" AzureExporter ExporterKind = "azureBlobStorage" OpenTelemetryExporter ExporterKind = "opentelemetry" )
func (ExporterKind) IsValid ¶
func (r ExporterKind) IsValid() error
IsValid is checking if the value is part of the enum
type FlagSet ¶
type FlagSet struct {
CommonFlagSet `mapstructure:",inline" koanf:",squash"`
// APIKeys is the api keys for the flag set.
// This will add a new API keys to the list of authorizedKeys.evaluation keys.
// This property is madatory for every flagset, we will use it to filter the flag available.
APIKeys []string `mapstructure:"apiKeys" koanf:"apikeys"`
// Name of the flagset.
// This allow to identify the flagset.
// Default: generated value
Name string `mapstructure:"name,omitempty" koanf:"name"`
}
FlagSet is the configuration for a flag set. A flag set is a collection of flags that are used to evaluate features. It is used to group flags together and to apply the same configuration to them. It is also used to apply the same API key to all the flags in the flag set.
type JaegerSampler ¶
type JaegerSampler struct {
Manager JaegerSamplerManager `mapstructure:"manager" koanf:"manager"`
Refresh JaegerSamplerRefresh `mapstructure:"refresh" koanf:"refresh"`
Max JaegerSamplerMax `mapstructure:"max" koanf:"max"`
}
JaegerSampler is the configuration object to configure the sampling.
type JaegerSamplerConfiguration ¶
type JaegerSamplerConfiguration struct {
Sampler JaegerSampler `mapstructure:"sampler" koanf:"sampler"`
}
JaegerSamplerConfiguration is the configuration object to configure the sampling. Most of the time this configuration is set using environment variables.
type JaegerSamplerManager ¶
type JaegerSamplerManager struct {
Host JaegerSamplerManagerHost `mapstructure:"host" koanf:"host"`
}
JaegerSamplerManager is the configuration object to configure the manager of the sampling.
type JaegerSamplerManagerHost ¶
type JaegerSamplerManagerHost struct {
Port string `mapstructure:"port" koanf:"port"`
}
JaegerSamplerManagerHost is the configuration object to configure the host of the manager of the sampling.
type JaegerSamplerMax ¶
type JaegerSamplerMax struct {
Operations int `mapstructure:"operations" koanf:"operations"`
}
JaegerSamplerMax is the configuration object to configure the max of the sampling.
type JaegerSamplerRefresh ¶
type JaegerSamplerRefresh struct {
Interval string `mapstructure:"interval" koanf:"interval"`
}
JaegerSamplerRefresh is the configuration object to configure the refresh of the sampling.
type LambdaAdapter ¶
type LambdaAdapter = string
const ( LambdaAdapterAPIGatewayV1 LambdaAdapter = "APIGatewayV1" LambdaAdapterAPIGatewayV2 LambdaAdapter = "APIGatewayV2" LambdaAdapterALB LambdaAdapter = "ALB" )
type NotifierConf ¶
type NotifierConf struct {
Kind NotifierKind `mapstructure:"kind" koanf:"kind"`
// Deprecated: Use WebhookURL instead
SlackWebhookURL string `mapstructure:"slackWebhookUrl" koanf:"slackwebhookurl"`
EndpointURL string `mapstructure:"endpointUrl" koanf:"endpointurl"`
Secret string `mapstructure:"secret" koanf:"secret"`
Meta map[string]string `mapstructure:"meta" koanf:"meta"`
Headers map[string][]string `mapstructure:"headers" koanf:"headers"`
WebhookURL string `mapstructure:"webhookUrl" koanf:"webhookurl"`
}
func (*NotifierConf) IsValid ¶
func (c *NotifierConf) IsValid() error
type NotifierKind ¶
type NotifierKind string
const ( SlackNotifier NotifierKind = "slack" MicrosoftTeamsNotifier NotifierKind = "microsoftteams" WebhookNotifier NotifierKind = "webhook" DiscordNotifier NotifierKind = "discord" )
func (NotifierKind) IsValid ¶
func (r NotifierKind) IsValid() error
IsValid is checking if the value is part of the enum
type OpenTelemetryConfiguration ¶
type OpenTelemetryConfiguration struct {
SDK struct {
Disabled bool `mapstructure:"disabled" koanf:"disabled"`
} `mapstructure:"sdk" koanf:"sdk"`
Exporter OtelExporter `mapstructure:"exporter" koanf:"exporter"`
Service struct {
Name string `mapstructure:"name" koanf:"name"`
} `mapstructure:"service" koanf:"service"`
Traces struct {
Sampler string `mapstructure:"sampler" koanf:"sampler"`
} `mapstructure:"traces" koanf:"traces"`
Resource OtelResource `mapstructure:"resource" koanf:"resource"`
}
OpenTelemetryConfiguration is the configuration for the OpenTelemetry part of the relay proxy It is used to configure the OpenTelemetry SDK and the OpenTelemetry Exporter Most of the time this configuration is set using environment variables.
type OtelExporter ¶
type OtelExporter struct {
Otlp OtelExporterOtlp `mapstructure:"otlp" koanf:"otlp"`
}
type OtelExporterOtlp ¶
type OtelResource ¶
type Server ¶
type Server struct {
// Mode is the server mode.
// default: http
Mode ServerMode `mapstructure:"mode" koanf:"mode"`
// Host is the server host.
// default: 0.0.0.0
Host string `mapstructure:"host" koanf:"host"`
// Port is the server port.
// default: 1031
Port int `mapstructure:"port" koanf:"port"`
// MonitoringPort is the monitoring port. It can be specified only if the server mode is HTTP.
// default: none, it will use the same as server port.
MonitoringPort int `mapstructure:"monitoringPort" koanf:"monitoringport"`
// UnixSocket is the server unix socket path.
UnixSocketPath string `mapstructure:"unixSocketPath" koanf:"unixsocketpath"`
// AWS Lambda configuration
// LambdaAdapter is the adapter to use when the relay proxy is started as an AWS Lambda.
// default: APIGatewayV2
LambdaAdapter LambdaAdapter `mapstructure:"awsLambdaAdapter" koanf:"awsLambdaAdapter"`
// AwsApiGatewayBasePath (optional) is the base path prefix for AWS API Gateway deployments.
// This is useful when deploying behind a non-root path like "/api" or "/dev/feature-flags".
// The relay proxy will strip this base path from incoming requests before processing.
// Example: if set to "/api/feature-flags", requests to "/api/feature-flags/health" will be processed as "/health"
// Default: ""
AwsApiGatewayBasePath string `mapstructure:"awsApiGatewayBasePath" koanf:"awsapigatewaybasepath"`
}
type ServerMode ¶
type ServerMode = string
const ( // ServerModeHTTP is the HTTP server mode. ServerModeHTTP ServerMode = "http" // ServerModeLambda is the AWS Lambda server mode. ServerModeLambda ServerMode = "lambda" // ServerModeUnixSocket is the Unix Socket server mode. ServerModeUnixSocket ServerMode = "unixsocket" )