Open
Conversation
KirillPamPam
reviewed
Apr 6, 2026
There was a problem hiding this comment.
Pull request overview
This PR introduces a protobuf-based “stats batch” payload and wiring to upload aggregated stats to the DRPC backend, adding an outbox mechanism (Redis/Postgres/noop) intended to persist and retry failed uploads.
Changes:
- Extend
IntegrationClientstats processing to produce/upload a protobuf-encoded stats batch (plus a “raw upload” path). - Add an outbox storage subsystem (Redis/Postgres/noop) and pass it into the stats service for retrying failed batches.
- Add protobuf definitions + generated Go types and a
maketarget for generating them; update config/mocks/tests accordingly.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/test_utils/mocks/integration.go | Updates integration mock for new stats interfaces (needs return wiring). |
| pkg/test_utils/mocks/connector.go | Adds UploadStats mock method (currently not using Called). |
| pkg/test_utils/mocks/cache.go | Adds outbox methods to cache mocks (interface compliance). |
| Makefile | Adds stats protobuf generation target. |
| internal/stats/stats_service.go | Changes stats service Start signature to accept an outbox storer. |
| internal/stats/protobuf/stats_request.proto | Defines protobuf schema for stats upload. |
| internal/stats/base_stats_service.go | Implements flush + outbox persistence/retry + compression utilities. |
| internal/stats/base_stats_service_test.go | Updates tests to pass an outbox stub to Start(). |
| internal/stats/api/stats_request.pb.go | Generated protobuf Go types for stats payload. |
| internal/outbox/storage.go | Adds outbox factory and wrapper for different storage backends. |
| internal/outbox/redis.go | Implements Redis-backed outbox storage. |
| internal/outbox/postgres.go | Implements Postgres-backed outbox storage. |
| internal/outbox/noop.go | Adds noop outbox storage implementation. |
| internal/integration/local_integration.go | Updates local integration to new stats interface methods. |
| internal/integration/integration.go | Updates IntegrationClient interface for new stats methods. |
| internal/integration/drpc/drpc_http.go | Adds UploadStats HTTP method to DRPC connector. |
| internal/integration/drpc_integration.go | Marshals aggregated stats to protobuf and uploads to DRPC. |
| internal/config/stats_config.go | Adds storage_type to stats config. |
| internal/caches/postgres_connector.go | Refactors ctor placement; includes a duplicate/wrong log line. |
| internal/app/app.go | Instantiates outbox storage and passes it to stats service Start(). |
Comments suppressed due to low confidence (1)
internal/config/stats_config.go:23
- StatsConfig gained StorageType, but validate()/defaults don't enforce or populate it. Since outbox.NewOutboxStorage uses StorageType to select a storage, enabling stats with an empty storage_type will fail at runtime. Consider validating StorageType when Enabled is true (and/or providing a default/noop value).
type StatsConfig struct {
Enabled bool `yaml:"enabled"`
StorageType string `yaml:"storage_type"`
Type IntegrationType `yaml:"type"`
FlushInterval time.Duration `yaml:"flush-interval"`
}
func (s *StatsConfig) validate() error {
if err := s.Type.validate(); err != nil {
return fmt.Errorf("stats type validation error - %s", err.Error())
}
if s.FlushInterval.Minutes() < 3 {
return errors.New("stats flush-interval must be greater than 3 minutes")
}
return nil
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
KirillPamPam
reviewed
Apr 9, 2026
KirillPamPam
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.