Implement a dedicated observability package (telemetry/resileotel) that automatically emits standardized OpenTelemetry metrics and distributed tracing spans for resilience events.
- Architecture & Implementation Requirements:
- Module Isolation: Create this as a separate directory with its own go.mod (or use Go Workspaces) so the core resile library does not take on go.opentelemetry.io/otel as a hard dependency.
- Instrumenter Interface: Ensure resile has a clean Instrumenter interface with hooks like OnAttempt(ctx, attempt, err), OnCircuitStateChange(state), and OnSuccess(ctx, attempt, duration).
- Metrics Definitions: Create synchronous counters:
- resile.calls.total (attributes: policy_name, result=success|failure)
- resile.retries.total (attributes: policy_name, error_type)
- Tracing Spans: Wrap the overall Do execution in a parent span (e.g., Resile Execution). Wrap each individual attempt in a child span (e.g., Attempt 1, Attempt 2), attaching the error as a span event if it fails.
- Acceptance Criteria:
- Metrics must follow OpenTelemetry semantic conventions.
- Spans must correctly parent to existing traces provided via the context.Context.
- Resources:
- OpenTelemetry Go Documentation
Would you like me to write the initial prompt to feed these specifications directly to your manager agent to begin the delegation process?
Implement a dedicated observability package (telemetry/resileotel) that automatically emits standardized OpenTelemetry metrics and distributed tracing spans for resilience events.
Would you like me to write the initial prompt to feed these specifications directly to your manager agent to begin the delegation process?