diff --git a/apollo-router/src/query_planner/execution.rs b/apollo-router/src/query_planner/execution.rs index 7e55e28106..4b26d1c21f 100644 --- a/apollo-router/src/query_planner/execution.rs +++ b/apollo-router/src/query_planner/execution.rs @@ -24,6 +24,7 @@ use crate::json_ext::Path; use crate::json_ext::Value; use crate::json_ext::ValueExt; use crate::plugins::subscription::SubscriptionConfig; +use crate::query_planner::fetch::FetchNode; use crate::query_planner::fetch::Variables; use crate::query_planner::FlattenNode; use crate::query_planner::Primary; @@ -252,7 +253,6 @@ impl PlanNode { .supergraph_request(parameters.supergraph_request.clone()) .variables(variables) .current_dir(current_dir.clone()) - .deferred_fetches(parameters.deferred_fetches.clone()) .build(); (value, errors) = match service.oneshot(request).await { Ok(r) => r, @@ -264,6 +264,13 @@ impl PlanNode { .build()], ), }; + FetchNode::deferred_fetches( + current_dir, + &fetch_node.id, + parameters.deferred_fetches, + &value, + &errors, + ); } None => { value = Value::Object(Object::default()); diff --git a/apollo-router/src/query_planner/fetch.rs b/apollo-router/src/query_planner/fetch.rs index 65edb72153..ed02917d8b 100644 --- a/apollo-router/src/query_planner/fetch.rs +++ b/apollo-router/src/query_planner/fetch.rs @@ -10,7 +10,6 @@ use serde::Deserialize; use serde::Serialize; use serde_json_bytes::ByteString; use serde_json_bytes::Map; -use tokio::sync::broadcast; use tokio::sync::broadcast::Sender; use tower::ServiceExt; use tracing::instrument; @@ -378,8 +377,6 @@ impl FetchNode { output_rewrites: &Option>, schema: &Schema, paths: Vec>, - id: Option, - deferred_fetches: &HashMap)>>, operation_str: &str, variables: Map, ) -> (Value, Vec) { @@ -436,13 +433,12 @@ impl FetchNode { output_rewrites, service_name, ); - Self::deferred_fetches(current_dir, id, deferred_fetches, &value, &errors); (value, errors) } pub(crate) fn deferred_fetches( current_dir: &Path, - id: Option, + id: &Option, deferred_fetches: &HashMap)>>, value: &Value, errors: &[Error], diff --git a/apollo-router/src/services/connector_service.rs b/apollo-router/src/services/connector_service.rs index 9842de3e73..0eaaa0a3ed 100644 --- a/apollo-router/src/services/connector_service.rs +++ b/apollo-router/src/services/connector_service.rs @@ -87,8 +87,8 @@ impl tower::Service for ConnectorService { "otel.kind" = "INTERNAL", "apollo.connector.type" = CONNECTOR_TYPE_HTTP, "apollo.connector.detail" = tracing::field::Empty, - "apollo.connector.field.name" = connector.field_name().to_string(), - "apollo.connector.selection" = connector.selection.to_string(), + "apollo.connector.field.name" = %connector.field_name(), + "apollo.connector.selection" = %connector.selection, "apollo.connector.source.name" = tracing::field::Empty, "apollo.connector.source.detail" = tracing::field::Empty, "apollo_private.sent_time_offset" = fetch_time_offset, diff --git a/apollo-router/src/services/fetch.rs b/apollo-router/src/services/fetch.rs index a6071a90ed..2a452a584b 100644 --- a/apollo-router/src/services/fetch.rs +++ b/apollo-router/src/services/fetch.rs @@ -1,10 +1,8 @@ #![allow(missing_docs)] // FIXME -use std::collections::HashMap; use std::sync::Arc; use serde_json_bytes::Value; -use tokio::sync::broadcast; use tower::BoxError; use crate::error::Error; @@ -23,7 +21,6 @@ pub(crate) struct Request { pub(crate) supergraph_request: Arc>, pub(crate) variables: Variables, pub(crate) current_dir: Path, - pub(crate) deferred_fetches: HashMap)>>, } pub(crate) type Response = (Value, Vec); @@ -40,7 +37,6 @@ impl Request { supergraph_request: Arc>, variables: Variables, current_dir: Path, - deferred_fetches: HashMap)>>, ) -> Self { Self { context, @@ -48,7 +44,6 @@ impl Request { supergraph_request, variables, current_dir, - deferred_fetches, } } } diff --git a/apollo-router/src/services/fetch_service.rs b/apollo-router/src/services/fetch_service.rs index ca358a56bc..875ca16692 100644 --- a/apollo-router/src/services/fetch_service.rs +++ b/apollo-router/src/services/fetch_service.rs @@ -98,7 +98,6 @@ impl FetchService { let FetchRequest { fetch_node, supergraph_request, - deferred_fetches, variables, context, current_dir, @@ -110,7 +109,6 @@ impl FetchService { service_name, requires, output_rewrites, - id, .. } = fetch_node; @@ -142,7 +140,6 @@ impl FetchService { &output_rewrites, &service_name, ); - FetchNode::deferred_fetches(¤t_dir, id, &deferred_fetches, &value, &errors); Ok((value, errors)) }) } @@ -156,7 +153,6 @@ impl FetchService { let FetchRequest { fetch_node, supergraph_request, - deferred_fetches, variables, current_dir, context, @@ -169,7 +165,6 @@ impl FetchService { operation_name, requires, output_rewrites, - id, .. } = fetch_node; @@ -210,7 +205,6 @@ impl FetchService { let aqs = aliased_operation.to_string(); // TODO let sns = service_name.clone(); let current_dir = current_dir.clone(); - let deferred_fetches = deferred_fetches.clone(); let service = subgraph_service_factory .create(&sns) .expect("we already checked that the service exists during planning; qed"); @@ -247,8 +241,6 @@ impl FetchService { &output_rewrites, &schema, variables.inverted_paths, - id, - &deferred_fetches, &aqs, variables.variables, )