Skip to content

docs: Add Zerolog integration guide with trace correlation #1709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Calm-Rock
Copy link
Member

@Calm-Rock Calm-Rock commented Jul 21, 2025

Description

This PR addresses issue #1501 by adding comprehensive documentation for integrating Zerolog with SigNoz, including proper trace correlation.

What's included

  • Complete Zerolog integration guide with trace correlation (trace_id and span_id)
  • Direct OTLP export method with custom hook implementation
  • Middleware examples for web frameworks (Gin)
  • Step-by-step setup instructions with code examples
  • Troubleshooting section for common issues

Key features documented

  1. Trace-aware logger creation - Automatically adds trace_id and span_id to all logs
  2. Request context propagation - Middleware to ensure trace context flows through the application
  3. Custom OTLP Hook - Since the otelzerolog bridge doesn't exist, implemented a custom hook solution
  4. Direct log export - Simplified approach focusing only on direct OTLP export

Changes from initial version

  • ✅ Removed Option 2 (file-based collection via OpenTelemetry Collector)
  • ✅ Removed Performance considerations section
  • ✅ Removed Further reading section
  • ✅ Fixed non-existent go.opentelemetry.io/contrib/bridges/otelzerolog by implementing custom OTLP hook
  • ✅ Simplified documentation to focus on direct OTLP export only

Structure

The documentation follows the same structure as the existing Logrus documentation for consistency:

  • Overview
  • Prerequisites
  • Setup with step-by-step instructions
  • Code examples for integration
  • Configuration examples
  • Troubleshooting guide
  • Link to example repository

Related

Testing

The documentation provides:

  • Direct OTLP export to SigNoz Cloud
  • Custom hook implementation for sending logs
  • Trace correlation between logs and traces

Please review and let me know if any changes are needed!

This documentation addresses issue SigNoz#1501 by providing a comprehensive guide for integrating Zerolog with SigNoz, including:

- Proper trace correlation setup (adding trace_id and span_id to logs)
- Multiple methods for sending logs to SigNoz (direct OTLP and file-based)
- Middleware examples for web frameworks like Gin
- Troubleshooting common issues
- Performance considerations

The guide follows the same structure as the existing Logrus documentation for consistency.
Copy link

vercel bot commented Jul 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
signoz-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 21, 2025 8:37pm

…ssue

- Removed Option 2 (file-based collection via OpenTelemetry Collector)
- Removed Performance considerations section
- Removed Further reading section
- Fixed non-existent otelzerolog bridge by implementing custom OTLP hook
- Simplified the documentation to focus on direct OTLP export only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DOCS] Add zerolog OpenTelemetry integration example to documentation
1 participant