golang-observability-opentelemetry

Instrument Go applications with OpenTelemetry tracing, Prometheus metrics, and slog logging.

3|1|Updated Dec 8, 2025
One-click install
npx skills add https://github.com/bobmatnyc/termpilot --skill golang-observability-opentelemetry
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-observability-opentelemetry
Source: https://github.com/bobmatnyc/termpilot/tree/main/.claude/skills/toolchains-golang-observability
Command: npx skills add https://github.com/bobmatnyc/termpilot --skill golang-observability-opentelemetry

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Gaining deep insights into distributed Go applications requires a unified approach to tracing, metrics, and logging. This skill provides comprehensive guidance on instrumenting Go services with OpenTelemetry, Prometheus, and slog for production-ready observability.

Core Features & Use Cases

  • Distributed Tracing (OpenTelemetry): Implements context propagation and span creation for end-to-end request visibility.
  • Prometheus Metrics: Defines and exposes various metric types (counters, gauges, histograms) for performance monitoring.
  • Structured Logging (slog): Configures context-aware, structured logging with JSON output for easy analysis.
  • Health Checks & Graceful Shutdown: Integrates liveness/readiness probes and ensures clean resource teardown.

Quick Start

Use the golang-observability-opentelemetry skill to set up OpenTelemetry tracing for a Go HTTP server, including a custom span for a database operation.

Frequently Asked Questions about golang-observability-opentelemetry

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up distributed tracing in a Go application?

Distributed tracing in Go uses OpenTelemetry to create spans that track requests across services. Initialize a tracer provider, configure an exporter, and instrument your HTTP or gRPC handlers to automatically propagate context and create spans for each operation, giving you end-to-end visibility into request flow.

What's the best way to collect and expose metrics from a Go service?

Prometheus metrics collection in Go involves defining metric types—counters, gauges, and histograms—then exposing them via an HTTP endpoint. This enables scraping by monitoring systems to track performance, latency, and error rates across your service in real time.

How do I implement structured logging in Go?

Structured logging with slog creates context-aware logs in JSON format, making them machine-parseable and easier to correlate with traces and metrics. Configure slog handlers to include request IDs and contextual fields so logs are searchable and traceable across your system.

Can I use OpenTelemetry with existing Prometheus and logging setups?

Yes, OpenTelemetry integrates with Prometheus for metrics and slog for structured logging, allowing you to unify tracing, metrics, and logs in a single observability pipeline. This approach correlates all three signal types across your microservices without replacing existing tools.

Does this cover health checks and graceful shutdown for production Go services?

Yes, the skill includes implementing liveness and readiness probes for health checks and coordinating graceful shutdown to drain connections and close resources cleanly. This ensures your service handles Kubernetes restarts and rolling deployments safely.

What observability features do gRPC and HTTP services need?

Production gRPC and HTTP services require auto-instrumentation middleware for tracing, metric collection on request latency and errors, structured logging tied to request context, and health endpoints. This combination provides visibility into service behavior and enables rapid incident response.