diff --git a/.changesets/fix_geal_coprocessor_metrics.md b/.changesets/fix_geal_coprocessor_metrics.md new file mode 100644 index 0000000000..03248ee1ba --- /dev/null +++ b/.changesets/fix_geal_coprocessor_metrics.md @@ -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 \ No newline at end of file diff --git a/apollo-router/src/plugins/coprocessor/mod.rs b/apollo-router/src/plugins/coprocessor/mod.rs index a79ff4da2b..2914f20ec5 100644 --- a/apollo-router/src/plugins/coprocessor/mod.rs +++ b/apollo-router/src/plugins/coprocessor/mod.rs @@ -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 } @@ -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 } @@ -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 } @@ -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 } diff --git a/apollo-router/src/plugins/coprocessor/supergraph.rs b/apollo-router/src/plugins/coprocessor/supergraph.rs index 7e6e313f42..79202a0eb0 100644 --- a/apollo-router/src/plugins/coprocessor/supergraph.rs +++ b/apollo-router/src/plugins/coprocessor/supergraph.rs @@ -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 } @@ -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 }