Skip to content

Commit

Permalink
Add missing events
Browse files Browse the repository at this point in the history
  • Loading branch information
bryn committed Apr 23, 2024
1 parent 03e5b39 commit 5527727
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions apollo-router/src/plugins/telemetry/config_new/cost/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,17 @@ impl Instrumented for CostInstruments {
type Request = supergraph::Request;
type Response = supergraph::Response;

fn on_request(&self, _request: &Self::Request) {}
fn on_request(&self, request: &Self::Request) {
if let Some(cost_estimated) = &self.cost_estimated {
cost_estimated.on_request(request);
}
if let Some(cost_actual) = &self.cost_actual {
cost_actual.on_request(request);
}
if let Some(cost_delta) = &self.cost_delta {
cost_delta.on_request(request);
}
}

fn on_response(&self, response: &Self::Response) {
if let Some(cost_estimated) = &self.cost_estimated {
Expand All @@ -239,7 +249,17 @@ impl Instrumented for CostInstruments {
}
}

fn on_error(&self, _error: &BoxError, _ctx: &Context) {}
fn on_error(&self, error: &BoxError, ctx: &Context) {
if let Some(cost_estimated) = &self.cost_estimated {
cost_estimated.on_error(error, ctx);
}
if let Some(cost_actual) = &self.cost_actual {
cost_actual.on_error(error, ctx);
}
if let Some(cost_delta) = &self.cost_delta {
cost_delta.on_error(error, ctx);
}
}
}

#[derive(Deserialize, JsonSchema, Clone, Debug)]
Expand Down

0 comments on commit 5527727

Please sign in to comment.