Skip to content

Conversation

@ravilock
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a 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 pull request adds a feature to automatically upscale BuildKit when builds are waiting too long for available resources. The implementation includes a new metrics system, refactored pod discovery and leasing logic, and enhanced scaling capabilities.

Key changes:

  • Introduced Prometheus metrics to track build waiting times, active builds, and build durations
  • Refactored pod discovery logic by splitting it into separate components: podNotifier for watching pods and leaser for managing lease acquisition
  • Added metrics server endpoint on port 9090 to expose build-related metrics
  • Updated protobuf generated code to newer versions (protoc-gen-go v1.36.6, protoc-gen-go-grpc v1.5.1)
  • Changed UnimplementedBuildServer embedding from pointer to value to prevent nil pointer dereferences

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
pkg/build/server.go Changed UnimplementedBuildServer from pointer to value embedding per new protobuf guidelines
pkg/build/grpc_build_v1/build_service_grpc.pb.go Regenerated gRPC service code with v1.5.1, includes new generic stream types and lease validation
pkg/build/grpc_build_v1/build_service.pb.go Regenerated protobuf message code with v1.36.6, includes memory optimizations
pkg/build/buildkit/scaler/downscaler_test.go Updated test calls from RunDownscaler to runDownscaler (function made private)
pkg/build/buildkit/scaler/downscaler.go Made runDownscaler private and removed unnecessary blank lines
pkg/build/buildkit/metrics/metrics.go New file defining Prometheus metrics for tracking builds
pkg/build/buildkit/build.go Integrated metrics tracking for build operations and namespace detection
pkg/build/buildkit/autodiscovery/podNotifier.go New component to watch and filter pod events before lease acquisition
pkg/build/buildkit/autodiscovery/leaser.go New component to manage distributed leases across BuildKit pods
pkg/build/buildkit/autodiscovery/k8s_test.go Expanded tests for namespace discovery, pod readiness, and upscaling logic
pkg/build/buildkit/autodiscovery/k8s.go Refactored discovery to use new notifier/leaser pattern with metrics support
main.go Added metrics server startup on configurable port (default 9090)
go.sum Updated checksums for new and upgraded dependencies
go.mod Added prometheus client library and updated protobuf, sync, and other dependencies
Makefile Added protoc plugin installation commands to setup target

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@wpjunior wpjunior left a comment

Choose a reason for hiding this comment

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

@ravilock Nice MR, let's do a progressive rollout, please bump the minor and let's find a possible bug in the whole deploy process

@ravilock ravilock merged commit cdd5968 into tsuru:main Dec 9, 2025
4 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.

3 participants