Skip to content

jsnfwlr/go11y

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go11y1 for observability in Go

Opinionated but simple Go implementation of structured logging and open telemetry tracing for your application.

Features

Structured Logging

go11y wraps the Go standard lib slog package, so it's structured logging with JSON from the outset, just more convenient.

_, o, _ := go11y.Initialise(ctx, nil, os.Stdout, "arg1", "val1")
o.Info("structured logging", nil, "arg2", "val2")
{
    "time":"2025-08-04T10:14:19.780509481+08:00",
    "level":"INFO",
    "source":{
        "function":"main.main",
        "file":"/home/user/demo/main.go",
        "line":81
    },
    "msg":"structured logging",
    "arg1": "val1",
    "arg2": "val2",
}

Tracing

go11y doesn't handle the tracing for you (yet) but it does leave room for it so you don't need to go to too much effort to integrate it.

_, o, _ := go11y.Initialise(ctx, nil, os.Stdout)

ctx, span := otel.Tracer("packageName").Start(ctx, "functionName", trace.WithSpanKind(trace.SpanKindClient))

o.Info("structured logging", span)

Roundtrippers

Middleware

Configuration

Hard Coded - BYO or Built in

Environment Variables

Examples

Used by

Todo

  • Implement integration tests for log ingestion and tracing with Grafana-LGTM testcontainer
  • Expand GoDoc details and add examples
  • Try to get tracing integrated into go11y so there is less boilerplate needed

Notes

1 sounds like golly

About

Observability (logging and tracing) for Golang projects

Topics

Resources

License

Stars

Watchers

Forks