Skip to content

Commit

Permalink
align coprocessor metric creation (#4930)
Browse files Browse the repository at this point in the history
There are currently 2 different ways to create metrics, with slight
incompatibilities. This makes sure that the execution stage coprocessor
metrics are generated in the same way as the other stages
  • Loading branch information
Geal committed Apr 12, 2024
1 parent 0319f15 commit 54d299a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .changesets/fix_geal_coprocessor_metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### align coprocessor metric creation ([PR #4930](https://github.com/apollographql/router/pull/4930))

There are currently 2 different ways to create metrics, with slight incompatibilities. This makes sure that the execution stage coprocessor metrics are generated in the same way as the other stages

By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/4930
44 changes: 24 additions & 20 deletions apollo-router/src/plugins/coprocessor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,12 @@ impl RouterStage {
);
error
});
tracing::info!(
monotonic_counter.apollo.router.operations.coprocessor = 1u64,
coprocessor.stage = %PipelineStep::RouterRequest,
coprocessor.succeeded = succeeded,
"Total operations with co-processors enabled"
u64_counter!(
"apollo.router.operations.coprocessor",
"Total operations with co-processors enabled",
1,
"coprocessor.stage" = PipelineStep::RouterRequest,
"coprocessor.succeeded" = succeeded
);
result
}
Expand Down Expand Up @@ -397,11 +398,12 @@ impl RouterStage {
);
error
});
tracing::info!(
monotonic_counter.apollo.router.operations.coprocessor = 1u64,
coprocessor.stage = %PipelineStep::RouterResponse,
coprocessor.succeeded = succeeded,
"Total operations with co-processors enabled"
u64_counter!(
"apollo.router.operations.coprocessor",
"Total operations with co-processors enabled",
1,
"coprocessor.stage" = PipelineStep::RouterResponse,
"coprocessor.succeeded" = succeeded
);
result
}
Expand Down Expand Up @@ -491,11 +493,12 @@ impl SubgraphStage {
);
error
});
tracing::info!(
monotonic_counter.apollo.router.operations.coprocessor = 1u64,
coprocessor.stage = %PipelineStep::SubgraphRequest,
coprocessor.succeeded = succeeded,
"Total operations with co-processors enabled"
u64_counter!(
"apollo.router.operations.coprocessor",
"Total operations with co-processors enabled",
1,
"coprocessor.stage" = PipelineStep::SubgraphRequest,
"coprocessor.succeeded" = succeeded
);
result
}
Expand Down Expand Up @@ -530,11 +533,12 @@ impl SubgraphStage {
);
error
});
tracing::info!(
monotonic_counter.apollo.router.operations.coprocessor = 1u64,
coprocessor.stage = %PipelineStep::SubgraphResponse,
coprocessor.succeeded = succeeded,
"Total operations with co-processors enabled"
u64_counter!(
"apollo.router.operations.coprocessor",
"Total operations with co-processors enabled",
1,
"coprocessor.stage" = PipelineStep::SubgraphResponse,
"coprocessor.succeeded" = succeeded
);
result
}
Expand Down
22 changes: 12 additions & 10 deletions apollo-router/src/plugins/coprocessor/supergraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ impl SupergraphStage {
);
error
});
tracing::info!(
monotonic_counter.apollo.router.operations.coprocessor = 1u64,
coprocessor.stage = %PipelineStep::SupergraphRequest,
coprocessor.succeeded = succeeded,
"Total operations with co-processors enabled"
u64_counter!(
"apollo.router.operations.coprocessor",
"Total operations with co-processors enabled",
1,
"coprocessor.stage" = PipelineStep::SupergraphRequest,
"coprocessor.succeeded" = succeeded
);
result
}
Expand Down Expand Up @@ -144,11 +145,12 @@ impl SupergraphStage {
);
error
});
tracing::info!(
monotonic_counter.apollo.router.operations.coprocessor = 1u64,
coprocessor.stage = %PipelineStep::SupergraphResponse,
coprocessor.succeeded = succeeded,
"Total operations with co-processors enabled"
u64_counter!(
"apollo.router.operations.coprocessor",
"Total operations with co-processors enabled",
1,
"coprocessor.stage" = PipelineStep::SupergraphResponse,
"coprocessor.succeeded" = succeeded
);
result
}
Expand Down

0 comments on commit 54d299a

Please sign in to comment.