Release v1.0.0: HTTP instrumentation, slog correlation, TLS by default
Add HTTPMiddleware, HTTPTransport and LogHandler; extend TracerConfig with Insecure, Headers and Attributes; install W3C propagators; parent-based sampling; end-to-end OTLP export tests; update dependencies (Go 1.26). Breaking since v0.2.0: the OTLP connection uses TLS unless Insecure is set. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
362267470e
commit
2c83b28342
15 files changed
+695
-119
No files matched your search
@@ -1,17 +1,28 @@
|
||||
// Package obsx provides observability setup for the platform: metrics (Prometheus)
|
||||
// and tracing (OpenTelemetry).
|
||||
// Package obsx wires observability into a Go service: tracing (OpenTelemetry),
|
||||
// metrics (Prometheus) and trace-correlated logs (log/slog).
|
||||
//
|
||||
// # Quick Start
|
||||
//
|
||||
// // Tracing
|
||||
// // Tracing: global tracer provider + W3C propagation
|
||||
// shutdown, err := obsx.SetupTracer(ctx, obsx.TracerConfig{
|
||||
// ServiceName: "my-service",
|
||||
// Endpoint: "localhost:4317",
|
||||
// Insecure: true,
|
||||
// })
|
||||
// defer shutdown(ctx)
|
||||
//
|
||||
// // Logs carry trace_id / span_id
|
||||
// slog.SetDefault(slog.New(obsx.LogHandler(slog.NewJSONHandler(os.Stderr, nil))))
|
||||
//
|
||||
// // Metrics
|
||||
// metrics := obsx.NewMetrics(obsx.MetricsConfig{Namespace: "myapp"})
|
||||
// reqCounter := metrics.Counter("requests_total", "Total requests", "method", "status")
|
||||
// http.Handle("/metrics", metrics.Handler())
|
||||
// mux.Handle("GET /metrics", metrics.Handler())
|
||||
//
|
||||
// // HTTP server spans + request metrics, and traced outgoing calls
|
||||
// handler := obsx.HTTPMiddleware(metrics)(mux)
|
||||
// client := &http.Client{Transport: obsx.HTTPTransport(nil)}
|
||||
//
|
||||
// # Stability
|
||||
//
|
||||
// The package follows semantic versioning; the v1 API is stable.
|
||||
package obsx
|
||||
Reference in new issue
Block a user