Add Zerolog and OTEL integration with per-job tracing - #5
Conversation
- Add `pkg/telemetry` for OTEL setup and Zerolog helpers. - Refactor `Worker` to use `zerolog` and `trace.Tracer`. - Update `handleJob` to start a span and inject a logger with trace ID into the context. - Update `cmd/worker/main.go` to support `--queue` and `--workers` flags. - Update `ExampleHandler` to demonstrate context-aware logging. - Ensure all related logs include the job's trace ID.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Integrate `zerolog` for structured logging with per-job Trace IDs. - Integrate `OpenTelemetry` for distributed tracing, ensuring each job has a unique trace. - Implement `github.com/spf13/cobra` as the CLI framework. - Create `pkg/root` for the root command and `pkg/console` for the worker command. - Refactor `cmd/worker/main.go` to use the new CLI structure. - Add `--queue` and `--workers` flags to the worker command. - Update `Worker` to propagate context with logger and tracer to handlers. - Update tests to support new worker signature.
- Update `.github/workflows/ci.yml` to use Go 1.24 for lint and test jobs, matching the project's Go version.
- Add `SetInfo` to `pkg/root` to allow configuring Use, Short, and Long fields of the root Cobra command.
- Upgrade `golangci-lint` to `v1.64.5` in CI workflow to support Go 1.24.
- Add `GetArg` helper method to `Job` struct in `pkg/queue/interfaces.go` to simplify accessing properties of the unserialized job command. - Update `ExampleHandler` to demonstrate usage of `GetArg`.
Implemented structured logging using Zerolog and distributed tracing using OpenTelemetry. The worker now generates a unique Trace ID for each job, which is propagated to the logger and context. All logs within the job scope (including those from the handler) now include this Trace ID. Also added command-line flags to configure concurrency and queue name.
PR created automatically by Jules for task 2379741403127200922 started by @ngoyal16