Repository navigation
fix(e2e): wait for worker Kafka subscriptions before tests - #5382
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Track Kafka subscription initialization openmeter/watermill/driver/kafka/subscriber.go, openmeter/watermill/driver/kafka/subscriptions.go, openmeter/watermill/driver/kafka/subscriptions_test.go |
SubscriberOptions can accept a status tracker. The tracker reports configured topics, active sessions, assigned partitions, and initialized partitions. Its HTTP handler returns 503 when the status is not ready. Tests cover readiness and session and claim lifecycle changes. |
Expose readiness from worker services app/common/telemetry.go, app/common/openmeter_*worker.go, app/common/openmeter_billingworker_test.go, cmd/balance-worker/wire_gen.go, cmd/billing-worker/wire_gen.go, cmd/notification-service/*, cmd/server/wire_gen.go, cmd/sink-worker/wire_gen.go |
TelemetryServer supports additional routes. Billing, balance, and notification services register /healthz/subscriptions and pass status trackers to their Kafka subscribers. Generated wiring passes the new dependencies. A test checks that existing health responses remain unchanged. |
Wait for readiness during startup .github/scripts/run-e2e.sh, .github/scripts/run-quickstart.sh, e2e/Makefile, openmeter/watermill/driver/kafka/README.md |
E2E and Quickstart scripts wait for subscriptions endpoints before running tests. The README describes the endpoint’s readiness conditions and response fields. |
Priority:
Estimated code review effort: 4 (Complex) | ~45 minutes
Sequence Diagram(s)
sequenceDiagram
participant Worker
participant NewSubscriber
participant ConsumerGroupHandler
participant SubscriptionStatus
participant HealthClient
Worker->>NewSubscriber: Supplies SubscriptionStatus
NewSubscriber->>ConsumerGroupHandler: Installs observer for consumer-group events
ConsumerGroupHandler->>SubscriptionStatus: Records sessions and initialized claims
HealthClient->>SubscriptionStatus: Requests GET /healthz/subscriptions
SubscriptionStatus-->>HealthClient: Returns readiness snapshot with 200 or 503
Possibly related PRs
- openmeterio/openmeter#5355: Both changes update Quickstart startup synchronization; this PR adds waits for Kafka subscription health endpoints.
Suggested reviewers: galexihu, chrisgacsal
Merge Risk: 
Minimal · up to 8cf3c
-
The subscription-readiness change has no established blocker in the supplied evidence and is mergeable after normal checks.
Pre-merge checks: 
4
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Overview
A fresh test stack can accept a subscription request after
/healthzsucceeds but before the billing consumer selects its starting offsets. With the existing newest-offset policy, that event can be skipped and invoice polling times out.Expose
/healthz/subscriptionson the billing, balance, and notification workers, and wait for it before quickstart and E2E fixtures run. Readiness follows consumer-group sessions and initialized partition claims, including all three balance-worker topic subscriptions.TelemetryServer.Handleprovides the route registration API.Notes for reviewer
The existing Kubernetes health endpoints and Kafka offset policy keep their behavior. This endpoint reports subscription initialization independently of backlog processing and becomes unready when sessions or claims stop. Sink consumer readiness is outside this change; its generated wiring is refreshed for the shared telemetry type.
Validation:
make lint-go-fastpassed.