Documentation
¶
Index ¶
- Variables
- func LoadEnv(environment ...string) error
- func NewLogger(cfg *Config) *slog.Logger
- func NewLoggerWithOtel(cfg *Config, otel OtelService) *slog.Logger
- func WithCognitoAppClientID(appClientID string) func(*Config)
- func WithCognitoRegion(region string) func(*Config)
- func WithCognitoUserPoolID(userPoolID string) func(*Config)
- func WithEnvironment(environment string) func(*Config)
- func WithOtelDisable(value ...bool) func(*Config)
- func WithOtlpEndpoint(endpoint string) func(*Config)
- func WithOtlpInsecure(insecure bool) func(*Config)
- func WithPort(port int) func(*Config)
- func WithRedisAddr(addr string) func(*Config)
- func WithRedisDB(db int) func(*Config)
- func WithRedisPassword(pw string) func(*Config)
- func WithSkipAuth(value ...bool) func(*Config)
- type CognitoConfig
- type Config
- type OtelConfig
- type OtelService
- type OtlpConfig
- type RedisConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ServiceVersion = "UNSET"
The value of the ServiceVersion attribute associated with the otel Resource. This should be overwritten at build time:
export SERVICE_VERSION=$(git rev-parse --short HEAD)
go build -o out \
-X verification-service-api/pkg/core.ServiceVersion=${SERVICE_VERSION}
Functions ¶
func NewLoggerWithOtel ¶
func NewLoggerWithOtel(cfg *Config, otel OtelService) *slog.Logger
func WithCognitoAppClientID ¶
func WithCognitoRegion ¶
func WithCognitoUserPoolID ¶
func WithEnvironment ¶
func WithOtelDisable ¶
func WithOtlpEndpoint ¶
func WithOtlpInsecure ¶
func WithRedisAddr ¶
func WithRedisDB ¶
func WithRedisPassword ¶
func WithSkipAuth ¶
Types ¶
type CognitoConfig ¶
type Config ¶
type Config struct {
Cognito CognitoConfig
Environment string
Otel OtelConfig
Port int
SkipAuth bool
Redis RedisConfig
}
func DefaultConfig ¶
func DefaultConfig() Config
func NewConfigFromEnv ¶
type OtelConfig ¶
type OtelConfig struct {
OtlpExporter OtlpConfig
Disable bool
}
type OtelService ¶
type OtelService interface {
// Return the current span associated with context c.
SpanFromContext(c context.Context) trace.Span
// Return the underlying LoggerProvider
LoggerProvider() log.LoggerProvider
// Cleanup any resources associated with this object. Errors
// are logged with logger.Error or logger.ErrorContext and
// then dismissed.
Shutdown(c context.Context, logger *slog.Logger)
}
OtelService provides methods for handling OpenTelemetry operations.
func NewOtelService ¶
func NewOtelService(ctx context.Context, cfg *Config) (OtelService, error)
Initialize the appropriate implementation of OtelService. If cfg.Disabled then the implementation uses the otel/*/noop packages.
type OtlpConfig ¶
type RedisConfig ¶
Click to show internal directories.
Click to hide internal directories.