Skip to content

Add CloudTrace support to investigate heavy tasks#371

Merged
kyasbal merged 5 commits into
GoogleCloudPlatform:mainfrom
kyasbal:feat/cloud-trace
Nov 20, 2025
Merged

Add CloudTrace support to investigate heavy tasks#371
kyasbal merged 5 commits into
GoogleCloudPlatform:mainfrom
kyasbal:feat/cloud-trace

Conversation

@kyasbal

@kyasbal kyasbal commented Nov 19, 2025

Copy link
Copy Markdown
Member

Motivation

Enable TaskRunner and InspectionTaskRunner to have interceptor which enables extender to run a function before/after running a task or running an inspection. This is a prerequisite enhancement to add CloudTrace for debugging purpose.

@kyasbal kyasbal added enhancement New feature or request backend:core labels Nov 19, 2025
@kyasbal kyasbal marked this pull request as ready for review November 19, 2025 07:30
@kyasbal

kyasbal commented Nov 19, 2025

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces interceptor support for LocalRunner and InspectionTaskRunner, which is a great enhancement for adding cross-cutting concerns like tracing and logging. The implementation correctly applies the interceptor pattern and refactors the logging logic into a default interceptor. However, I've found a critical issue in the Run method of the InspectionTaskRunner related to concurrency and error handling that could lead to deadlocks and silent failures. My review includes detailed comments on how to address this.

Comment thread pkg/core/inspection/runner.go Outdated
Comment thread pkg/core/inspection/runner.go
This commit integrates Cloud Trace to visualize the execution time and details of inspection tasks.

Changes:
- Add `--cloud-trace` and `--cloud-trace-project-id` debug flags.
- Implement InspectionTraceInterceptor to generate OpenTelemetry spans for inspections and individual tasks.
- Update TaskRunner interface and LocalRunner to support dynamic interceptor registration via AddInterceptor.
- Instrument key inspection tasks (LogSerializer, HistoryModifier, etc.) to add trace attributes like log counts.
- Initialize OpenTelemetry provider in `DefaultInitExtension`.
@kyasbal kyasbal changed the title feat: add Interceptor support to LocalRunner and InspectionTaskRunner Add CloudTrace support to investigate heavy tasks Nov 20, 2025
@kyasbal kyasbal merged commit cf5614d into GoogleCloudPlatform:main Nov 20, 2025
7 of 8 checks passed
@kyasbal kyasbal deleted the feat/cloud-trace branch November 20, 2025 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:core enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants