Skip to content

feat(cogs): publish backend change streams to Kafka - #597

Open
matt-codecov wants to merge 1 commit into
matth/storage-inventory-tracker-3from
matth/storage-inventory-tracker-4
Open

feat(cogs): publish backend change streams to Kafka#597
matt-codecov wants to merge 1 commit into
matth/storage-inventory-tracker-3from
matth/storage-inventory-tracker-4

Conversation

@matt-codecov

@matt-codecov matt-codecov commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Ref FS-210

Add CostTrackerConfig struct to objectstore-server's config. This allows storage COGS to be configured end-to-end; CostTrackerConfig on objectstore-server's config and CostTrackerStreamConfig on each Backend impl will produce a CostTrackerStream that holds a shared Kafka producer and streams change messages on the shared-resources-inventory topic.

While ChangeStream is abstract, the abstraction is not exposed in config. It's assumed each ChangeStream impl will name itself explicitly in dedicated config sections.


Stack created with GitHub Stacks CLIGive Feedback 💬

@matt-codecov
matt-codecov requested a review from a team as a code owner August 11, 2026 06:15
Comment thread objectstore-server/src/config.rs Outdated
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.46%. Comparing base (da74fdb) to head (9951ac3).

Files with missing lines Patch % Lines
objectstore-server/src/config.rs 95.00% 2 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                          @@
##           matth/storage-inventory-tracker-3     #597      +/-   ##
=====================================================================
+ Coverage                              88.39%   88.46%   +0.07%     
=====================================================================
  Files                                    104      104              
  Lines                                  17118    17162      +44     
=====================================================================
+ Hits                                   15131    15182      +51     
+ Misses                                  1987     1980       -7     
Components Coverage Δ
Rust Backend 92.48% <95.65%> (+0.03%) ⬆️
Rust Client 81.97% <ø> (ø)
Python Client 93.31% <ø> (ø)

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matt-codecov
matt-codecov force-pushed the matth/storage-inventory-tracker-4 branch from 5c30b31 to 644c7af Compare August 11, 2026 21:34
Comment thread objectstore-server/src/config.rs Outdated

let sink = config.change_stream.kafka.as_ref().expect("kafka sink");
assert_eq!(sink.topic, "my-topic");
assert_eq!(sink.bootstrap_servers, ["kafka:9092"]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: A partial Kafka configuration with a topic but no bootstrap_servers will be accepted at startup but will silently fail to send messages at runtime.
Severity: HIGH

Suggested Fix

Validate the SinkConfig to ensure that if the Kafka sink is enabled, the bootstrap_servers field is not empty. This check should be performed during configuration loading to cause a startup failure with a clear error message, preventing silent failures in production.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: objectstore-server/src/config.rs#L930

Potential issue: If the service is configured with a partial Kafka configuration,
specifically providing a topic but omitting the `bootstrap_servers`, the application
will start without error. The underlying `librdkafka` library accepts an empty list of
bootstrap servers during producer creation, so no startup error is logged. However, the
producer will be unable to connect to any brokers, causing all change stream messages to
be silently dropped. This can lead to an operator being unaware that their intended
configuration is not active, resulting in a loss of inventory tracking data.

Also affects:

  • objectstore-inventory-tracker/src/kafka.rs:105
  • objectstore-service/src/change_stream/kafka.rs:80

@matt-codecov
matt-codecov force-pushed the matth/storage-inventory-tracker-4 branch from 644c7af to d5d5bef Compare August 11, 2026 22:37
@matt-codecov
matt-codecov force-pushed the matth/storage-inventory-tracker-4 branch from d5d5bef to 329169e Compare August 15, 2026 03:32
@linear-code

linear-code Bot commented Aug 17, 2026

Copy link
Copy Markdown

FS-210

@matt-codecov
matt-codecov force-pushed the matth/storage-inventory-tracker-4 branch from 329169e to 914f849 Compare August 17, 2026 22:02
@matt-codecov
matt-codecov force-pushed the matth/storage-inventory-tracker-4 branch from 914f849 to 9951ac3 Compare August 18, 2026 23:07
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