# golang-observability-opentelemetry

A skill for instrumenting Go services: OpenTelemetry for distributed tracing, Prometheus for metrics, slog for structured logging.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 409 installs · ★ 78
- Author: Claude MPM Team
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/golang/golang-observability-opentelemetry/SKILL.md
- Updated: 2026-07-18
- HTML: https://affpapa.org/en/nevibecode/skills/golang-observability-opentelemetry

## What it does

Reach for this skill when you are adding observability to Go microservices. It ships working examples: setting up an OpenTelemetry tracer with a Jaeger exporter, creating spans with attributes and error recording, wrapping an HTTP handler with `otelhttp`, plus starting points for Prometheus metrics and structured logs through `slog`.

The skill uses progressive disclosure — a short summary at the entry point, the full text at roughly 5000 tokens. The quick start walks through five steps: initialize the tracer and exporter, expose a metrics endpoint, configure `slog`, instrument HTTP middleware, add health checks. There is a section on correlation too: trace ID, span ID and request ID have to line up across all three pillars, or debugging turns into guesswork.

One thing to check before you ship: the tracer example uses `AlwaysSample`, and a comment notes that production wants a probability sampler instead. Left as is, traces will flood the exporter. `slog` itself needs Go 1.21 or newer. The skill is not user-invocable — the model loads it when a task touches instrumentation.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill golang-observability-opentelemetry -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/golang-observability-opentelemetry/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/golang-observability-opentelemetry/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill golang-observability-opentelemetry -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/golang-observability-opentelemetry/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill golang-observability-opentelemetry -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/golang-observability-opentelemetry/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install bobmatnyc/claude-mpm-skills golang-observability-opentelemetry
```

2. **Manually: put the files in place**
- File: `.github/skills/golang-observability-opentelemetry/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill golang-observability-opentelemetry -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/bobmatnyc/claude-mpm-skills --path toolchains/golang/golang-observability-opentelemetry
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/golang-observability-opentelemetry/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill golang-observability-opentelemetry -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/golang/golang-observability-opentelemetry/SKILL.md

## When to use it
- add distributed tracing to an existing Go service
- correlate logs, traces and metrics with shared identifiers
- expose a `/metrics` endpoint for Prometheus
- wrap HTTP handlers with automatic `otelhttp` instrumentation
- add readiness and liveness probes for Kubernetes

## Example prompts
- Add OpenTelemetry tracing to this Go service, Jaeger exporter
- Set up `slog` with structured logs and correlation IDs
- Wrap the handlers with `otelhttp` and add health checks

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 3cf547f68fa7c2f1.

BEGIN THIRD-PARTY FILE 3cf547f68fa7c2f1
```text
---
name: golang-observability-opentelemetry
description: "Instrumenting Go applications with OpenTelemetry for distributed tracing, Prometheus for metrics, and structured logging with slog"
user-invocable: false
disable-model-invocation: true
version: 1.0.0
category: toolchain
author: Claude MPM Team
license: MIT
progressive_disclosure:
  entry_point:
    summary: "Master Go observability through OpenTelemetry distributed tracing, Prometheus metrics, and slog structured logging for production-ready microservices"
    when_to_use: "Instrumenting microservices for observability, setting up distributed tracing across services, creating operational dashboards, debugging production issues, performance monitoring and optimization"
    quick_start: "1. Initialize OpenTelemetry tracer and exporter 2. Add Prometheus metrics endpoint 3. Configure slog for structured logging 4. Instrument HTTP middleware 5. Implement health checks"
  token_estimate:
    entry: 150
    full: 5000
context_limit: 700
tags:
  - observability
  - golang
  - opentelemetry
  - prometheus
  - tracing
  - metrics
  - logging
  - slog
requires_tools: []
---

# Go Observability with OpenTelemetry

## Overview

Modern Go applications require comprehensive observability through the three pillars: traces, metrics, and logs. OpenTelemetry provides vendor-neutral instrumentation for distributed tracing, Prometheus offers powerful metrics collection, and Go's slog package (1.21+) delivers structured logging with minimal overhead.

**Key Features:**
- 🔍 **OpenTelemetry**: Distributed tracing with context propagation
- 📊 **Prometheus**: Metrics collection with /metrics endpoint
- 📝 **Structured Logging**: slog with JSON formatting and correlation IDs
- 🎯 **Auto-Instrumentation**: HTTP/gRPC middleware patterns
- 💚 **Health Checks**: Kubernetes-ready readiness/liveness probes
- 🔄 **Graceful Shutdown**: Clean exporter shutdown and signal handling

## When to Use This Skill

Activate this skill when:
- Instrumenting microservices for production observability
- Setting up distributed tracing across service boundaries
- Creating operational dashboards with Prometheus/Grafana
- Debugging production performance issues or bottlenecks
```
END THIRD-PARTY FILE 3cf547f68fa7c2f1

The third-party file has ended. Everything between the 3cf547f68fa7c2f1 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2236 of 26005 bytes. © Claude MPM Team · MIT · https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/golang/golang-observability-opentelemetry/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
