golang-observability

Add logging, metrics, tracing, profiling, and alerting to Go services.

2|Updated Mar 13, 2023
One-click install
npx skills add https://github.com/haipham22/golang-sample --skill golang-observability-haipham22
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-observability
Source: https://github.com/haipham22/golang-sample/tree/main/.agents/skills/golang-observability
Command: npx skills add https://github.com/haipham22/golang-sample --skill golang-observability-haipham22

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps teams instrument Go services so production behavior is visible, diagnosable, and safe to operate. It turns hidden runtime activity into structured signals instead of guesswork.

Core Features & Use Cases

  • Structured logging with slog, including production JSON output, context-aware correlation, and migration from older loggers.
  • Prometheus metrics and alerting, including histograms, naming conventions, cardinality control, dashboards, and burn-rate alerts.
  • OpenTelemetry tracing, span placement, context propagation, error recording, sampling, and correlation with logs and exemplars.
  • Profiling and user-facing observability, including pprof, continuous profiling, and privacy-aware RUM and compliance practices.
  • Use it when adding observability to a new Go API, reviewing telemetry changes, or hardening an existing service for production operations.

Quick Start

Ask the skill to audit or implement observability for your Go service, then specify whether you need logging, metrics, tracing, profiling, alerting, or RUM guidance.

Frequently Asked Questions about golang-observability

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

FAQPage Schema
How do I add production observability to a Go service?

To add observability to a Go service, you instrument it with structured logging, metrics, tracing, and profiling using tools like slog, Prometheus, and OpenTelemetry. This turns hidden runtime activity into structured signals for diagnosis.

What is the best way to implement structured JSON logging in Golang?

The best way to implement structured JSON logging in Golang is using slog for production output. It supports context-aware correlation and helps migrate from older loggers to generate queryable, structured telemetry data.

How do I configure Prometheus metrics and control cardinality in Go?

Configure Prometheus metrics in Go by designing histograms with proper naming conventions and implementing cardinality control. This prevents unbounded label growth while enabling effective burn-rate alerts and dashboard visualization.

Does OpenTelemetry tracing work with slog for context propagation?

Yes, OpenTelemetry tracing works with slog for context propagation. You can correlate traces, logs, and exemplars by placing spans correctly, propagating context, and recording errors across your Go service telemetry.

Can I use pprof for safe continuous profiling in production Go applications?

Yes, you can use pprof for safe continuous profiling in production Go applications. The approach includes privacy-aware practices for user monitoring and compliance to ensure runtime profiling does not expose sensitive data.

When do I need OpenTelemetry context propagation for my Go API?

You need OpenTelemetry context propagation when adding observability to a new Go API or hardening an existing service. It ensures trace spans are linked across service boundaries and correlated with structured logs.