go-request-logging

Generate structured logging with request-ID propagation for Go gRPC microservices.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-request-logging
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-request-logging
Source: https://github.com/saddam-eng-tech/ai-agent-skills/tree/main/go-request-logging
Command: npx skills add https://github.com/saddam-eng-tech/ai-agent-skills --skill go-request-logging

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of tracing requests across distributed Go gRPC microservices by ensuring consistent logging with request and trace IDs.

Core Features & Use Cases

  • Request ID Propagation: Automatically extracts and propagates request IDs from gRPC metadata.
  • Contextual Logging: Injects request and trace IDs into the logger context, ensuring all log lines within a request's lifecycle are correlated.
  • Interceptor Setup: Generates a gRPC server interceptor to handle logging logic.
  • Use Case: Debugging a complex user request that spans multiple microservices becomes significantly easier when every log message related to that request is tagged with the same unique identifier.

Quick Start

Add structured logging with request ID propagation to my Go gRPC service.

Frequently Asked Questions about go-request-logging

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

FAQPage Schema
How do I add structured logging to my Go gRPC microservices?

Structured logging in Go gRPC microservices is set up by generating a server interceptor that extracts request IDs from metadata and injects them into the context for correlated tracing across services.

Why do I need request ID propagation in gRPC logging?

Request ID propagation in gRPC logging ensures every log line within a single request lifecycle carries the same unique trace ID, solving the problem of tracking complex user requests spanning multiple distributed microservices.

Can I use this gRPC logging setup with different Go logger libraries?

Yes, the gRPC logging setup supports configurable logger libraries including slog, zap, and zerolog, allowing you to integrate structured request tracing into your existing Go logging stack.

What is the best way to correlate logs across distributed Go microservices?

The best way to correlate logs across distributed Go microservices is using a gRPC server interceptor to automatically extract and propagate trace IDs from metadata into the context for all log messages.

How does context injection work for tracing in Go gRPC interceptors?

Context injection for tracing in Go gRPC works by extracting the request ID from incoming gRPC metadata and injecting it into the logger context, ensuring all subsequent log lines automatically carry the trace ID.

Does this structured logging approach require external dependencies for Go gRPC?

No, this structured logging approach for Go gRPC has no external dependencies and outputs self-contained interceptor and context helper files to manage request ID extraction and logger configuration.