Documentation ¶
Index ¶
- Constants
- func AddSpanContextToLogger(ctx context.Context) context.Context
- func AddSpanToLogger(ctx context.Context, span trace.Span) (context.Context, trace.Span)
- func FatalError(signalName string, err error)
- func Init(ctx context.Context, isUserService bool, ...) error
- func LogBucket(base int, num int64, optMin, optMax optional.Option[int]) string
- func NewOtelLogger(logger *log.Logger, level log.Level) logr.Logger
- func OpenDBAndInstrument(dsn string) (*sql.DB, error)
- func SuccessOrFailureStatusAttr(succeeded bool) attribute.KeyValue
- func TimeSinceMS(start time.Time) int64
- type Config
- type ExportOTELFlag
Constants ¶
const ( ModuleNameAttribute = "ftl.module.name" OutcomeStatusNameAttribute = "ftl.outcome.status" RunnerDeploymentKeyAttribute = "ftl.deployment.key" SuccessStatus = "success" FailureStatus = "failure" )
Variables ¶
This section is empty.
Functions ¶
func AddSpanToLogger ¶
func FatalError ¶
func LogBucket ¶
LogBucket returns a string bucket label for a given positive number bucketed into powers of some arbitrary base. For base 8, for example, we would have buckets:
<1, [1-8), [8-64), [64-512), etc.
The buckets are then demarcated by `min` and `max`, such that any `num` < `base`^`min` will be bucketed together into the min bucket, and similarly, any `num` >= `base`^`max` will go in the `max` bucket. This constrains output cardinality by chopping the long tails on both ends of the normal distribution and lumping them all into terminal buckets. When `min` and `max` are not provided, the effective `min` is 0, and there is no max.
Go only supports a few bases with math.Log*, so this func performs a change of base: log_b(x) = log_a(x) / log_a(b)
func TimeSinceMS ¶
Types ¶
type Config ¶
type Config struct { LogLevel log.Level `default:"error" help:"OTEL log level." env:"FTL_O11Y_LOG_LEVEL"` ExportOTEL ExportOTELFlag `help:"Export observability data to OTEL." env:"OTEL_EXPORTER_OTLP_ENDPOINT"` }
type ExportOTELFlag ¶
type ExportOTELFlag bool
func (*ExportOTELFlag) UnmarshalText ¶
func (e *ExportOTELFlag) UnmarshalText(text []byte) error