Skip to content

Add Zerolog and OTEL integration with per-job tracing - #5

Merged
ngoyal16 merged 6 commits into
mainfrom
feature/logger-otel-integration-2379741403127200922
Jan 3, 2026
Merged

Add Zerolog and OTEL integration with per-job tracing#5
ngoyal16 merged 6 commits into
mainfrom
feature/logger-otel-integration-2379741403127200922

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

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

- 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.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

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`.
@ngoyal16
ngoyal16 marked this pull request as ready for review January 3, 2026 13:44
@ngoyal16
ngoyal16 merged commit 2381294 into main Jan 3, 2026
2 checks passed
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.

1 participant