prometheus-go-code-review

Audit Prometheus metrics in Go code for correctness.

75|9|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/anderskev/beagle --skill prometheus-go-code-review
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prometheus-go-code-review
Source: https://github.com/anderskev/beagle/tree/main/skills/prometheus-go-code-review
Command: npx skills add https://github.com/anderskev/beagle --skill prometheus-go-code-review

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides auditing Prometheus instrumentation in Go, ensuring metric types, labels, and patterns follow best practices for reliable observability.

Core Features & Use Cases

  • Validate metric types (Counter/Gauge/Histogram) against measurement semantics.
  • Enforce low-cardinality labels and proper unit suffixes.
  • Ensure metrics are registered once and do not panic under race conditions.
  • Confirm /metrics endpoint exposure and sane histogram buckets.

Quick Start

Inspect metrics definitions and registries in the Go codebase, then adjust types, labels, and bucket boundaries to align with best practices.

Frequently Asked Questions about prometheus-go-code-review

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

FAQPage Schema
How do I audit Prometheus metrics in Go code for correctness?

Audit Prometheus metrics in Go by validating metric types (Counter, Gauge, Histogram) match measurement semantics, enforcing low-cardinality labels with proper unit suffixes, ensuring single registration, and confirming /metrics endpoint exposure. Use prometheus/client_golang to inspect definitions across services and adjust to follow best practices.

What are the common mistakes in Prometheus instrumentation with Go?

Common mistakes include using wrong metric types, high-cardinality labels causing memory issues, missing or incorrect unit suffixes, registering metrics multiple times causing panics, and misconfigured histogram buckets. This Skill identifies and fixes these patterns in prometheus/client_golang implementations.

How do I prevent race conditions when registering Prometheus metrics in Go?

Prevent race conditions by registering each metric exactly once during initialization, using a global registry or singleton pattern, and avoiding concurrent metric creation. This Skill ensures your Go service registers all prometheus/client_golang metrics safely before exposing /metrics.

What should I check when reviewing Prometheus histogram bucket configuration?

Review histogram buckets to ensure they align with your latency or request-size distribution, avoid too many buckets causing cardinality explosion, and use sensible boundaries (e.g., milliseconds for latency). This Skill validates bucket choices across your Go instrumentation.

Can I use Prometheus instrumentation across multiple Go services?

Yes, Prometheus instrumentation via prometheus/client_golang works across multiple Go services. This Skill audits metric consistency, label cardinality, naming conventions, and registration patterns to ensure reliability and observability best practices across your service fleet.