-
Notifications
You must be signed in to change notification settings - Fork 0
observability #47
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
observability #47
Conversation
pan93412
commented
Dec 28, 2025
- chore: upgrade dependencies
- chore: update nix lockfile
- feat: implement OpenTelemetry and Prometheus basic infra
- feat: implement otelgqlgen
- feat: add slog-gin and trace ID header
- docs: add OpenTelemetry and Prometheus instruction
- feat: inject trace_id to GraphQL error
- feat: add otelpgx
- feat: add rueidisotel
- feat(graph): implement OpenTelemetry tracing for GraphQL resolvers
- feat(httpapi): implement OpenTelemetry tracing for HTTP APIs
- feat(auth): implement OpenTelemetry tracing for auth service
- feat(backend): setup otel sdk
- feat(events): implement OpenTelemetry tracing for events service
- feat(ranking): implement OpenTelemetry tracing for ranking service
- feat(sqlrunner): implement OpenTelemetry tracing for sqlrunner service
- feat(submission): implement OpenTelemetry tracing for submission service
- feat(useraccount): implement OpenTelemetry tracing for useraccount service
- chore: tidy up imports
- test(auth): handle OpenTelemetry wrapped case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements comprehensive OpenTelemetry and Prometheus observability infrastructure across the entire backend application, adding distributed tracing, logging, and metrics capabilities.
Key Changes
- Added OpenTelemetry SDK setup with support for multiple exporters (console, OTLP) for traces and logs
- Instrumented all service layers with tracing spans including useraccount, submission, sqlrunner, ranking, events, and auth services
- Implemented automatic tracing for HTTP APIs, GraphQL resolvers, and database operations (pgx, Redis)
- Integrated Prometheus metrics endpoint at
/metricswith Gin middleware instrumentation
Reviewed changes
Copilot reviewed 33 out of 35 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/otelprovider/otelprovider.go | New OpenTelemetry SDK provider with configurable exporters for traces and logs |
| internal/useraccount/*.go | Added tracing spans for token operations, user registration, and verification |
| internal/submission/submission.go | Instrumented answer submission and execution with detailed span events |
| internal/sqlrunner/sqlrunner.go | Added HTTP client tracing and database query instrumentation |
| internal/ranking/ranking.go | Implemented tracing for ranking calculations and database queries |
| internal/events/*.go | Added comprehensive tracing for event handling and points granting logic |
| internal/auth/*.go | Instrumented authentication middleware and Redis storage operations |
| httpapi/auth/*.go | Added OAuth 2.0 flow tracing with PKCE validation spans |
| graph/*.resolvers.go | Instrumented all GraphQL resolvers with tracing spans |
| internal/deps/deps.go | Updated to use otelpgx and rueidisotel for database/Redis tracing |
| cmd/backend/dependencies.go | Integrated OTel SDK lifecycle, Prometheus metrics, and trace ID headers |
| docs/config.md | Added comprehensive OpenTelemetry configuration documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.