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 AddSpanContextToLogger ¶ added in v0.383.0
func AddSpanToLogger ¶ added in v0.383.0
func FatalError ¶ added in v0.410.0
func LogBucket ¶ added in v0.410.0
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 SuccessOrFailureStatusAttr ¶ added in v0.324.0
func TimeSinceMS ¶ added in v0.410.0
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 ¶ added in v0.138.0
type ExportOTELFlag bool
func (*ExportOTELFlag) UnmarshalText ¶ added in v0.138.0
func (e *ExportOTELFlag) UnmarshalText(text []byte) error