feat(telemetry): add NewConsole — logz-backed OTel exporters for local dev (v1.1.0)

NewConsole bootstraps the OTel SDK with three logz-backed exporters:
- Trace: WithSyncer, one log line per closed span (immediate, no batch)
- Metric: PeriodicReader (60s), flushed on shutdown
- OTel log: BatchProcessor, for third-party libs using OTel log API

ConsoleConfig requires only ServiceName — no OTLP endpoint needed.
Adds logz v1.0.1 as direct dependency; module tier bumped 1 → 2.
This commit is contained in:
2026-05-12 19:19:50 +00:00
parent 83ac0e3900
commit 00d15bee8d
8 changed files with 464 additions and 34 deletions

View File

@@ -5,6 +5,28 @@ All notable changes to this module will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this module adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.1.0] - 2026-05-12
### Added
- `ConsoleConfig` — service identity configuration for console/dev mode (only `ServiceName`,
`ServiceVersion`, `Environment`; no OTLP endpoint required)
- `NewConsole(ctx, logger logz.Logger, cfg ConsoleConfig) (func(context.Context) error, error)`
bootstraps the OTel SDK with logz-backed exporters for local development. Traces are exported
synchronously via `WithSyncer` (one log line per closed span); metrics via `PeriodicReader`
(flushed on shutdown); OTel log records via `BatchProcessor`. No collector needed.
- `logz v1.0.1` added as direct dependency (tier bumped from 1 → 2).
### Output format
```
INFO otel: span name=GET /api/v1/permisos trace_id=3f2a9c... duration_ms=18 status=Ok
INFO otel: metric name=http.server.duration kind=histogram count=5 sum=87.3 unit=ms
INFO otel: log body=cache miss severity=INFO
```
[1.1.0]: https://code.nochebuena.dev/go/telemetry/compare/v1.0.0...v1.1.0
## [1.0.0] - 2026-05-12
### Changed