Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KafkaSinkCluster: increment out_of_rack_requests metric for all out of rack requests #1639

Merged
merged 2 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions shotover/src/transforms/kafka/sink_cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,9 @@ impl KafkaSinkCluster {
{
node.broker_id
} else {
self.out_of_rack_requests.increment(1);
tracing::debug!(
"Routing fetch request to replica outside of shotover's rack"
);
self.nodes
.iter_mut()
.filter(|node| {
Expand Down Expand Up @@ -1008,17 +1010,28 @@ impl KafkaSinkCluster {
}

for (destination, requests) in broker_to_routed_requests {
self.nodes
let node = self
.nodes
.iter_mut()
.find(|x| x.broker_id == destination)
.unwrap()
.get_connection(
&self.connection_factory,
&self.authorize_scram_over_mtls,
&self.sasl_mechanism,
)
.await?
.send(requests.requests)?;
.unwrap();

if node
.rack
.as_ref()
.map(|rack| rack != &self.rack)
.unwrap_or(false)
{
self.out_of_rack_requests.increment(1);
}

node.get_connection(
&self.connection_factory,
&self.authorize_scram_over_mtls,
&self.sasl_mechanism,
)
.await?
.send(requests.requests)?;
}

Ok(())
Expand Down Expand Up @@ -1311,6 +1324,7 @@ impl KafkaSinkCluster {
self.nodes.choose(&mut self.rng).unwrap().broker_id
}
};

self.pending_requests.push_back(PendingRequest {
ty: PendingRequestTy::Routed {
destination,
Expand Down