From c3d7683bebf219fe4ba97a0c97f535b7944878bd Mon Sep 17 00:00:00 2001 From: bryn Date: Tue, 15 Mar 2022 10:51:42 +0100 Subject: [PATCH 1/8] Rename reporting plugin to telemetry --- apollo-router/src/configuration/mod.rs | 4 +- ...nfiguration__tests__schema_generation.snap | 361 +----------------- apollo-router/src/plugins/mod.rs | 2 +- ..._serde__tests__serialize_metadata_map.snap | 11 - .../plugins/{reporting.rs => telemetry.rs} | 14 +- .../{reporting => telemetry}/otlp/grpc.rs | 0 .../{reporting => telemetry}/otlp/http.rs | 0 .../{reporting => telemetry}/otlp/mod.rs | 0 ...serde__tests__serialize_metadata_map.snap} | 4 +- 9 files changed, 24 insertions(+), 372 deletions(-) delete mode 100644 apollo-router/src/plugins/reporting/otlp/snapshots/apollo_router__plugins__reporting__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap rename apollo-router/src/plugins/{reporting.rs => telemetry.rs} (98%) rename apollo-router/src/plugins/{reporting => telemetry}/otlp/grpc.rs (100%) rename apollo-router/src/plugins/{reporting => telemetry}/otlp/http.rs (100%) rename apollo-router/src/plugins/{reporting => telemetry}/otlp/mod.rs (100%) rename apollo-router/src/plugins/{reporting/otlp/snapshots/apollo_router__configuration__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap => telemetry/otlp/snapshots/apollo_router__plugins__telemetry__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap} (56%) diff --git a/apollo-router/src/configuration/mod.rs b/apollo-router/src/configuration/mod.rs index ef0b4679b9..1ad767b20b 100644 --- a/apollo-router/src/configuration/mod.rs +++ b/apollo-router/src/configuration/mod.rs @@ -88,7 +88,7 @@ impl Configuration { if is_global_subscriber_set() { // Add the reporting plugin, this will be overridden if such a plugin actually exists in the config. // Note that this can only be done if the global subscriber has been set, i.e. we're not unit testing. - plugins.push(("apollo.reporting".into(), Value::Object(Map::new()))); + plugins.push(("apollo.telemetry".into(), Value::Object(Map::new()))); } // Add all the apollo plugins @@ -106,7 +106,7 @@ impl Configuration { // Plugins must be sorted. For now this sort is hard coded, but we may add something generic. plugins.sort_by_key(|(name, _)| match name.as_str() { - "apollo.reporting" => -100, + "apollo.telemetry" => -100, "apollo.rhai" => 100, _ => 0, }); diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap index 50d2fba16c..aaeb38034e 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap @@ -1,6 +1,6 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 436 +assertion_line: 442 expression: "&schema" --- { @@ -21,12 +21,12 @@ expression: "&schema" }, { "required": [ - "reporting" + "rhai" ] }, { "required": [ - "rhai" + "telemetry" ] }, { @@ -66,9 +66,6 @@ expression: "&schema" "default": {}, "$ref": "#/definitions/Plugins" }, - "reporting": { - "$ref": "#/definitions/Conf" - }, "rhai": { "$ref": "#/definitions/Conf" }, @@ -80,6 +77,9 @@ expression: "&schema" }, "$ref": "#/definitions/Server" }, + "telemetry": { + "$ref": "#/definitions/Conf" + }, "test.always_fails_to_start": { "$ref": "#/definitions/Conf" }, @@ -96,21 +96,14 @@ expression: "&schema" "definitions": { "Conf": { "type": "object", + "required": [ + "filename" + ], "properties": { - "opentelemetry": { - "$ref": "#/definitions/OpenTelemetry", - "nullable": true - }, - "opentracing": { - "$ref": "#/definitions/OpenTracingConfig", - "nullable": true - }, - "spaceport": { - "$ref": "#/definitions/SpaceportConfig", - "nullable": true + "filename": { + "type": "string" } - }, - "additionalProperties": false + } }, "Config": { "type": "object", @@ -191,58 +184,6 @@ expression: "&schema" }, "additionalProperties": false }, - "Exporter": { - "oneOf": [ - { - "type": "object", - "required": [ - "grpc" - ], - "properties": { - "grpc": { - "$ref": "#/definitions/GrpcExporter", - "nullable": true - } - }, - "additionalProperties": false - } - ] - }, - "GrpcExporter": { - "type": "object", - "required": [ - "protocol" - ], - "properties": { - "endpoint": { - "default": null, - "type": "string", - "format": "uri", - "nullable": true - }, - "metadata": { - "default": null, - "type": "object", - "additionalProperties": true, - "nullable": true - }, - "protocol": { - "$ref": "#/definitions/ProtocolMirror", - "nullable": true - }, - "timeout": { - "type": "integer", - "format": "uint64", - "minimum": 0.0, - "nullable": true - }, - "tls_config": { - "$ref": "#/definitions/TlsConfig", - "nullable": true - } - }, - "additionalProperties": false - }, "Insert": { "type": "object", "required": [ @@ -259,53 +200,6 @@ expression: "&schema" }, "additionalProperties": false }, - "Jaeger": { - "type": "object", - "properties": { - "endpoint": { - "$ref": "#/definitions/JaegerEndpoint", - "nullable": true - }, - "service_name": { - "default": "router", - "type": "string" - }, - "trace_config": { - "$ref": "#/definitions/TraceConfig", - "nullable": true - } - }, - "additionalProperties": false - }, - "JaegerEndpoint": { - "oneOf": [ - { - "type": "object", - "required": [ - "agent" - ], - "properties": { - "agent": { - "type": "string" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "collector" - ], - "properties": { - "collector": { - "type": "string", - "format": "uri" - } - }, - "additionalProperties": false - } - ] - }, "ListenAddr": { "description": "Listening address.", "anyOf": [ @@ -319,46 +213,6 @@ expression: "&schema" } ] }, - "OpenTelemetry": { - "oneOf": [ - { - "type": "object", - "required": [ - "jaeger" - ], - "properties": { - "jaeger": { - "$ref": "#/definitions/Jaeger", - "nullable": true - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "otlp" - ], - "properties": { - "otlp": { - "$ref": "#/definitions/Otlp" - } - }, - "additionalProperties": false - } - ] - }, - "OpenTracingConfig": { - "type": "object", - "required": [ - "format" - ], - "properties": { - "format": { - "$ref": "#/definitions/PropagationFormat" - } - } - }, "Operation": { "oneOf": [ { @@ -399,23 +253,6 @@ expression: "&schema" } ] }, - "Otlp": { - "oneOf": [ - { - "type": "object", - "required": [ - "tracing" - ], - "properties": { - "tracing": { - "$ref": "#/definitions/Tracing", - "nullable": true - } - }, - "additionalProperties": false - } - ] - }, "Plugins": { "anyOf": [] }, @@ -457,20 +294,6 @@ expression: "&schema" } ] }, - "PropagationFormat": { - "type": "string", - "enum": [ - "jaeger", - "zipkin_b3" - ] - }, - "ProtocolMirror": { - "type": "string", - "enum": [ - "Grpc", - "HttpBinary" - ] - }, "Remove": { "oneOf": [ { @@ -499,59 +322,6 @@ expression: "&schema" } ] }, - "SamplerMirror": { - "oneOf": [ - { - "type": "string", - "enum": [ - "AlwaysOn", - "AlwaysOff" - ] - }, - { - "description": "Respects the parent span's sampling decision or delegates a delegate sampler for root spans. Not supported via yaml config Sample a given fraction of traces. Fractions >= 1 will always sample. If the parent span is sampled, then it's child spans will automatically be sampled. Fractions < 0 are treated as zero, but spans may still be sampled if their parent is.", - "type": "object", - "required": [ - "TraceIdRatioBased" - ], - "properties": { - "TraceIdRatioBased": { - "type": "number", - "format": "double" - } - }, - "additionalProperties": false - } - ] - }, - "Secret": { - "oneOf": [ - { - "type": "object", - "required": [ - "env" - ], - "properties": { - "env": { - "type": "string" - } - }, - "additionalProperties": false - }, - { - "type": "object", - "required": [ - "file" - ], - "properties": { - "file": { - "type": "string" - } - }, - "additionalProperties": false - } - ] - }, "Server": { "description": "Configuration options pertaining to the http server component.", "type": "object", @@ -569,113 +339,6 @@ expression: "&schema" } }, "additionalProperties": false - }, - "SpaceportConfig": { - "type": "object", - "required": [ - "external" - ], - "properties": { - "collector": { - "default": "https://127.0.0.1:50051", - "type": "string" - }, - "external": { - "type": "boolean" - }, - "listener": { - "default": "127.0.0.1:50051", - "type": "string" - } - }, - "additionalProperties": false - }, - "TlsConfig": { - "type": "object", - "properties": { - "ca": { - "$ref": "#/definitions/Secret", - "nullable": true - }, - "cert": { - "$ref": "#/definitions/Secret", - "nullable": true - }, - "domain_name": { - "type": "string", - "nullable": true - }, - "key": { - "$ref": "#/definitions/Secret", - "nullable": true - } - }, - "additionalProperties": false - }, - "TraceConfig": { - "type": "object", - "required": [ - "resource", - "sampler" - ], - "properties": { - "max_attributes_per_event": { - "type": "integer", - "format": "uint32", - "minimum": 0.0, - "nullable": true - }, - "max_attributes_per_link": { - "type": "integer", - "format": "uint32", - "minimum": 0.0, - "nullable": true - }, - "max_attributes_per_span": { - "type": "integer", - "format": "uint32", - "minimum": 0.0, - "nullable": true - }, - "max_events_per_span": { - "type": "integer", - "format": "uint32", - "minimum": 0.0, - "nullable": true - }, - "max_links_per_span": { - "type": "integer", - "format": "uint32", - "minimum": 0.0, - "nullable": true - }, - "resource": { - "type": "object", - "additionalProperties": true, - "nullable": true - }, - "sampler": { - "$ref": "#/definitions/SamplerMirror", - "nullable": true - } - }, - "additionalProperties": false - }, - "Tracing": { - "type": "object", - "required": [ - "exporter" - ], - "properties": { - "exporter": { - "$ref": "#/definitions/Exporter" - }, - "trace_config": { - "$ref": "#/definitions/TraceConfig", - "nullable": true - } - }, - "additionalProperties": false } } } diff --git a/apollo-router/src/plugins/mod.rs b/apollo-router/src/plugins/mod.rs index 5ce994e4c8..dfbdc56cdf 100644 --- a/apollo-router/src/plugins/mod.rs +++ b/apollo-router/src/plugins/mod.rs @@ -1,3 +1,3 @@ pub mod override_url; -mod reporting; pub mod rhai; +mod telemetry; diff --git a/apollo-router/src/plugins/reporting/otlp/snapshots/apollo_router__plugins__reporting__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap b/apollo-router/src/plugins/reporting/otlp/snapshots/apollo_router__plugins__reporting__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap deleted file mode 100644 index 213bcaaa9d..0000000000 --- a/apollo-router/src/plugins/reporting/otlp/snapshots/apollo_router__plugins__reporting__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: apollo-router/src/plugins/reporting/otlp/grpc.rs -assertion_line: 110 -expression: "std::str::from_utf8(&buffer).unwrap()" - ---- ---- -- foo: bar -- foo: baz -- bar: foo - diff --git a/apollo-router/src/plugins/reporting.rs b/apollo-router/src/plugins/telemetry.rs similarity index 98% rename from apollo-router/src/plugins/reporting.rs rename to apollo-router/src/plugins/telemetry.rs index 0c75ced3b4..bcfb2173b4 100644 --- a/apollo-router/src/plugins/reporting.rs +++ b/apollo-router/src/plugins/telemetry.rs @@ -174,7 +174,7 @@ impl fmt::Display for ReportingError { impl std::error::Error for ReportingError {} #[derive(Debug)] -struct Reporting { +struct Telemetry { config: Conf, tx: tokio::sync::mpsc::Sender, opentracing_layer: Option, @@ -209,11 +209,11 @@ fn studio_graph() -> Option { } #[async_trait::async_trait] -impl Plugin for Reporting { +impl Plugin for Telemetry { type Config = Conf; async fn startup(&mut self) -> Result<(), BoxError> { - tracing::debug!("starting: {}: {}", stringify!(Reporting), self.name()); + tracing::debug!("starting: {}: {}", stringify!(Telemetry), self.name()); replace_layer(self.try_build_layer()?)?; // Only check for notify if we have graph configuration @@ -284,7 +284,7 @@ impl Plugin for Reporting { opentracing_layer = OpenTracingLayer::new(opentracing_conf.clone()).into(); } - Ok(Reporting { + Ok(Telemetry { config: configuration, tx, opentracing_layer, @@ -303,7 +303,7 @@ impl Plugin for Reporting { } } -impl Reporting { +impl Telemetry { fn try_build_layer(&self) -> Result { tracing::debug!( "spaceport: {:?}, graph: {:?}", @@ -510,7 +510,7 @@ async fn do_listen(addr_str: String) -> bool { true } -register_plugin!("apollo", "reporting", Reporting); +register_plugin!("apollo", "telemetry", Telemetry); #[cfg(test)] mod tests { @@ -518,7 +518,7 @@ mod tests { #[tokio::test] async fn plugin_registered() { apollo_router_core::plugins() - .get("apollo.reporting") + .get("apollo.telemetry") .expect("Plugin not found") .create_instance(&serde_json::json!({ "opentelemetry": null })) .unwrap(); diff --git a/apollo-router/src/plugins/reporting/otlp/grpc.rs b/apollo-router/src/plugins/telemetry/otlp/grpc.rs similarity index 100% rename from apollo-router/src/plugins/reporting/otlp/grpc.rs rename to apollo-router/src/plugins/telemetry/otlp/grpc.rs diff --git a/apollo-router/src/plugins/reporting/otlp/http.rs b/apollo-router/src/plugins/telemetry/otlp/http.rs similarity index 100% rename from apollo-router/src/plugins/reporting/otlp/http.rs rename to apollo-router/src/plugins/telemetry/otlp/http.rs diff --git a/apollo-router/src/plugins/reporting/otlp/mod.rs b/apollo-router/src/plugins/telemetry/otlp/mod.rs similarity index 100% rename from apollo-router/src/plugins/reporting/otlp/mod.rs rename to apollo-router/src/plugins/telemetry/otlp/mod.rs diff --git a/apollo-router/src/plugins/reporting/otlp/snapshots/apollo_router__configuration__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap b/apollo-router/src/plugins/telemetry/otlp/snapshots/apollo_router__plugins__telemetry__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap similarity index 56% rename from apollo-router/src/plugins/reporting/otlp/snapshots/apollo_router__configuration__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap rename to apollo-router/src/plugins/telemetry/otlp/snapshots/apollo_router__plugins__telemetry__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap index e29738634d..1922d5cd07 100644 --- a/apollo-router/src/plugins/reporting/otlp/snapshots/apollo_router__configuration__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap +++ b/apollo-router/src/plugins/telemetry/otlp/snapshots/apollo_router__plugins__telemetry__otlp__grpc__header_map_serde__tests__serialize_metadata_map.snap @@ -1,7 +1,7 @@ --- -source: apollo-router/src/configuration/otlp/grpc.rs +source: apollo-router/src/plugins/telemetry/otlp/grpc.rs +assertion_line: 121 expression: "std::str::from_utf8(&buffer).unwrap()" - --- --- - foo: bar From 510c61cf8c3b0ca0488d1c69cc3ea3de8b3d27f3 Mon Sep 17 00:00:00 2001 From: bryn Date: Tue, 15 Mar 2022 11:04:18 +0100 Subject: [PATCH 2/8] Changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1792e69e5b..458c6c7125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,11 +62,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm Having plugins and layers as configurable items in yaml was creating confusion as to when it was appropriate to use a layer vs a plugin. As the layer API is a subset of the plugin API the layer option has been removed. -- **Move Apollo plugins to top level configuration** +- **Move Apollo plugins to top level configuration** ([PR #623](https://github.com/apollographql/router/pull/623)) Previously plugins were all under the `plugins:` section of the yaml config. However, now apollo plugins are promoted to the top level of the config. This reflects the fact that these plugins provide core functionality even though they are implemented as plugins under the hood. +- **Reporting config name changed to telemetry** ([PR #651](https://github.com/apollographql/router/pull/651)) +All configuration that was previously under the `reporting` header is now under `telemetry` + ## 🚀 Features - **Add Rhai plugin** ([PR #548](https://github.com/apollographql/router/pull/484)) From 16e17a93479b92ad2c76afdb6654a24f1f7dd6eb Mon Sep 17 00:00:00 2001 From: bryn Date: Tue, 15 Mar 2022 11:49:29 +0100 Subject: [PATCH 3/8] Fix schema generation. As we are now inlining subschemas the generation does not need to include references. --- apollo-router/src/configuration/mod.rs | 23 ++------- ...nfiguration__tests__schema_generation.snap | 50 ++----------------- apollo-router/src/plugins/rhai.rs | 1 + 3 files changed, 10 insertions(+), 64 deletions(-) diff --git a/apollo-router/src/configuration/mod.rs b/apollo-router/src/configuration/mod.rs index 1ad767b20b..0aede05ad7 100644 --- a/apollo-router/src/configuration/mod.rs +++ b/apollo-router/src/configuration/mod.rs @@ -6,8 +6,8 @@ use derivative::Derivative; use displaydoc::Display; use itertools::Itertools; use schemars::gen::SchemaGenerator; -use schemars::schema::{ObjectValidation, Schema, SchemaObject, SubschemaValidation}; -use schemars::{JsonSchema, Set}; +use schemars::schema::{ObjectValidation, Schema, SchemaObject}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_json::Map; use serde_json::Value; @@ -53,6 +53,7 @@ pub enum ConfigurationError { /// Currently maintains a mapping of subgraphs. #[derive(Clone, Derivative, Deserialize, Serialize, TypedBuilder, JsonSchema)] #[derivative(Debug)] +#[serde(deny_unknown_fields)] pub struct Configuration { /// Configuration options pertaining to the http server component. #[serde(default)] @@ -131,26 +132,10 @@ impl FromStr for Configuration { } fn gen_schema(plugins: schemars::Map) -> Schema { - let plugins_refs = plugins - .keys() - .map(|name| { - Schema::Object(SchemaObject { - object: Some(Box::new(ObjectValidation { - required: Set::from([name.to_string()]), - ..Default::default() - })), - ..Default::default() - }) - }) - .collect::>(); - let plugins_object = SchemaObject { object: Some(Box::new(ObjectValidation { properties: plugins, - ..Default::default() - })), - subschemas: Some(Box::new(SubschemaValidation { - any_of: Some(plugins_refs), + additional_properties: Option::Some(Box::new(Schema::Bool(false))), ..Default::default() })), ..Default::default() diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap index aaeb38034e..5b9e833cee 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap @@ -1,6 +1,6 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 442 +assertion_line: 427 expression: "&schema" --- { @@ -8,48 +8,6 @@ expression: "&schema" "title": "Configuration", "description": "The configuration for the router. Currently maintains a mapping of subgraphs.", "type": "object", - "anyOf": [ - { - "required": [ - "headers" - ] - }, - { - "required": [ - "override_subgraph_url" - ] - }, - { - "required": [ - "rhai" - ] - }, - { - "required": [ - "telemetry" - ] - }, - { - "required": [ - "test.always_fails_to_start" - ] - }, - { - "required": [ - "test.always_fails_to_start_and_stop" - ] - }, - { - "required": [ - "test.always_fails_to_stop" - ] - }, - { - "required": [ - "test.always_starts_and_stops" - ] - } - ], "properties": { "headers": { "$ref": "#/definitions/Config" @@ -93,6 +51,7 @@ expression: "&schema" "$ref": "#/definitions/Conf" } }, + "additionalProperties": false, "definitions": { "Conf": { "type": "object", @@ -103,7 +62,8 @@ expression: "&schema" "filename": { "type": "string" } - } + }, + "additionalProperties": false }, "Config": { "type": "object", @@ -254,7 +214,7 @@ expression: "&schema" ] }, "Plugins": { - "anyOf": [] + "additionalProperties": false }, "Propagate": { "anyOf": [ diff --git a/apollo-router/src/plugins/rhai.rs b/apollo-router/src/plugins/rhai.rs index f505629eec..546b71c0d0 100644 --- a/apollo-router/src/plugins/rhai.rs +++ b/apollo-router/src/plugins/rhai.rs @@ -79,6 +79,7 @@ struct Rhai { } #[derive(Deserialize, JsonSchema)] +#[serde(deny_unknown_fields)] struct Conf { filename: PathBuf, } From 6f3ffdab8c2035ff02a11a328c80b38e0b3a448e Mon Sep 17 00:00:00 2001 From: bryn Date: Tue, 15 Mar 2022 12:39:18 +0100 Subject: [PATCH 4/8] Make plugins optional. This way we can leave a plugins section in the config but have it empty. --- apollo-router/src/configuration/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apollo-router/src/configuration/mod.rs b/apollo-router/src/configuration/mod.rs index 0aede05ad7..bbcf4abc54 100644 --- a/apollo-router/src/configuration/mod.rs +++ b/apollo-router/src/configuration/mod.rs @@ -53,7 +53,6 @@ pub enum ConfigurationError { /// Currently maintains a mapping of subgraphs. #[derive(Clone, Derivative, Deserialize, Serialize, TypedBuilder, JsonSchema)] #[derivative(Debug)] -#[serde(deny_unknown_fields)] pub struct Configuration { /// Configuration options pertaining to the http server component. #[serde(default)] @@ -101,8 +100,10 @@ impl Configuration { } // Add all the user plugins - for (plugin, config) in &self.plugins.plugins { - plugins.push((plugin.clone(), config.clone())); + if let Some(config_map) = self.plugins.plugins.as_ref() { + for (plugin, config) in config_map { + plugins.push((plugin.clone(), config.clone())); + } } // Plugins must be sorted. For now this sort is hard coded, but we may add something generic. @@ -177,7 +178,7 @@ impl JsonSchema for ApolloPlugins { #[derive(Clone, Debug, Default, Deserialize, Serialize, TypedBuilder)] #[serde(transparent)] pub struct UserPlugins { - pub plugins: Map, + pub plugins: Option>, } impl JsonSchema for UserPlugins { From 074cbffd32eb220b88183d3af14a3234cb85e19b Mon Sep 17 00:00:00 2001 From: bryn Date: Tue, 15 Mar 2022 12:43:16 +0100 Subject: [PATCH 5/8] Fix tests --- ...n__tests__ensure_configuration_api_does_not_change-2.snap | 4 ++-- ...n__tests__ensure_configuration_api_does_not_change-3.snap | 4 ++-- ...n__tests__ensure_configuration_api_does_not_change-4.snap | 4 ++-- ...ion__tests__ensure_configuration_api_does_not_change.snap | 4 ++-- ...sts__ensure_configuration_api_does_not_change_grpc-2.snap | 4 ++-- ...tests__ensure_configuration_api_does_not_change_grpc.snap | 4 ++-- ..._ensure_configuration_api_does_not_change_tls_config.snap | 4 ++-- ...ollo_router__configuration__tests__schema_generation.snap | 5 ++--- ...outer__configuration__tests__supergraph_config_serde.snap | 4 ++-- 9 files changed, 18 insertions(+), 19 deletions(-) diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-2.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-2.snap index fc65bdb662..b34ca62913 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-2.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-2.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 443 +assertion_line: 439 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-3.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-3.snap index ef10701f51..c2a07bb545 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-3.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-3.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 444 +assertion_line: 440 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: ~ diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-4.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-4.snap index 14de397fd0..7731d8bb85 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-4.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change-4.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 445 +assertion_line: 441 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: ~ diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change.snap index 9acbdb9157..651efd6d3b 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 442 +assertion_line: 438 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: ~ diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_grpc-2.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_grpc-2.snap index 6ae58fed05..71514c7eba 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_grpc-2.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_grpc-2.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 471 +assertion_line: 467 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: ~ diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_grpc.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_grpc.snap index 14c113cd39..c38dc6e977 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_grpc.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_grpc.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 470 +assertion_line: 466 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: ~ diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_tls_config.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_tls_config.snap index 054266b96e..9f37c3a0f4 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_tls_config.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_tls_config.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 484 +assertion_line: 480 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: ~ diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap index 5b9e833cee..5ca7ac8169 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap @@ -1,6 +1,6 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 427 +assertion_line: 428 expression: "&schema" --- { @@ -21,7 +21,7 @@ expression: "&schema" }, "plugins": { "description": "Plugin configuration", - "default": {}, + "default": null, "$ref": "#/definitions/Plugins" }, "rhai": { @@ -51,7 +51,6 @@ expression: "&schema" "$ref": "#/definitions/Conf" } }, - "additionalProperties": false, "definitions": { "Conf": { "type": "object", diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__supergraph_config_serde.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__supergraph_config_serde.snap index 9e4b532271..fe9ffbad52 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__supergraph_config_serde.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__supergraph_config_serde.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 437 +assertion_line: 433 expression: config --- -plugins: {} +plugins: ~ server: listen: "127.0.0.1:4001" cors: From 5d567254e43a89386157f3ade96606532cd60e36 Mon Sep 17 00:00:00 2001 From: bryn Date: Tue, 15 Mar 2022 12:52:16 +0100 Subject: [PATCH 6/8] Fix tests --- ...ests__ensure_configuration_api_does_not_change_http-2.snap | 2 +- ..._tests__ensure_configuration_api_does_not_change_http.snap | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_http-2.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_http-2.snap index 7682558e93..5e07d3734c 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_http-2.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_http-2.snap @@ -3,7 +3,7 @@ source: apollo-router/src/configuration/mod.rs assertion_line: 488 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: ~ diff --git a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_http.snap b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_http.snap index 0414e0b948..005a28b52d 100644 --- a/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_http.snap +++ b/apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__ensure_configuration_api_does_not_change_http.snap @@ -1,9 +1,9 @@ --- source: apollo-router/src/configuration/mod.rs -assertion_line: 487 +assertion_line: 473 expression: config --- -plugins: {} +plugins: ~ server: listen: "1.2.3.4:5" cors: ~ From 9acb869f9d02ecf94f3d46cb4ef8a9ccf29d285a Mon Sep 17 00:00:00 2001 From: bryn Date: Tue, 15 Mar 2022 13:04:17 +0100 Subject: [PATCH 7/8] Update examples and readme --- DEVELOPMENT.md | 2 +- examples/config-jaeger.yml | 17 ----------------- examples/config/config-jaeger.yml | 4 ---- .../telemetry/external-spaceport.router.yaml | 14 ++++++++++++++ examples/telemetry/jaeger.router.yaml | 4 ++++ 5 files changed, 19 insertions(+), 22 deletions(-) delete mode 100644 examples/config-jaeger.yml delete mode 100644 examples/config/config-jaeger.yml create mode 100644 examples/telemetry/external-spaceport.router.yaml create mode 100644 examples/telemetry/jaeger.router.yaml diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 524e06275a..555a7847be 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -74,7 +74,7 @@ requires that the `federation-demo` project is running: Once the subgraphs are up and running, run Apollo Router with this command: ```shell -cargo run --release -- -s ./examples/graphql/local.graphql -c examples/config/config-jaeger.yml +cargo run --release -- -s ./examples/graphql/local.graphql -c examples/telemetry/jaeger.router.yaml ``` Go to https://studio.apollographql.com/sandbox/explorer to make queries and diff --git a/examples/config-jaeger.yml b/examples/config-jaeger.yml deleted file mode 100644 index 691cefeb84..0000000000 --- a/examples/config-jaeger.yml +++ /dev/null @@ -1,17 +0,0 @@ -server: - listen: 127.0.0.1:4000 -plugins: - apollo.reporting: - spaceport: - # By default, Apollo Router runs an internal collector. You can override - # this default behavior by setting `external: true`. If `true`, no reporting - # agent spawns, and the router instead communicates with `collector` below. - external: false - - # If `external` is `true`, this should be the location of a spaceport - # that's running external from the Router. Omit otherwise. - collector: https://127.0.0.1:50051 - - # If `external` is `false`, this is the interface and port to listen on. - # Omit otherwise. - listener: 127.0.0.1:50051 diff --git a/examples/config/config-jaeger.yml b/examples/config/config-jaeger.yml deleted file mode 100644 index ef6b6d6e71..0000000000 --- a/examples/config/config-jaeger.yml +++ /dev/null @@ -1,4 +0,0 @@ -plugins: - apollo.reporting: - opentelemetry: - jaeger: diff --git a/examples/telemetry/external-spaceport.router.yaml b/examples/telemetry/external-spaceport.router.yaml new file mode 100644 index 0000000000..a6c8fddf02 --- /dev/null +++ b/examples/telemetry/external-spaceport.router.yaml @@ -0,0 +1,14 @@ +telemetry: + spaceport: + # By default, Apollo Router runs an internal collector. You can override + # this default behavior by setting `external: true`. If `true`, no reporting + # agent spawns, and the router instead communicates with `collector` below. + external: false + + # If `external` is `true`, this should be the location of a spaceport + # that's running external from the Router. Omit otherwise. + collector: https://127.0.0.1:50051 + + # If `external` is `false`, this is the interface and port to listen on. + # Omit otherwise. + listener: 127.0.0.1:50051 diff --git a/examples/telemetry/jaeger.router.yaml b/examples/telemetry/jaeger.router.yaml new file mode 100644 index 0000000000..c0b7042ceb --- /dev/null +++ b/examples/telemetry/jaeger.router.yaml @@ -0,0 +1,4 @@ +telemetry: + opentelemetry: + jaeger: + service_name: router From 2692eaf1b05a2c9df3ed75c4075b5e89eb045d21 Mon Sep 17 00:00:00 2001 From: bryn Date: Tue, 15 Mar 2022 13:07:52 +0100 Subject: [PATCH 8/8] rename spaceport file --- .../{external-spaceport.router.yaml => spaceport.router.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/telemetry/{external-spaceport.router.yaml => spaceport.router.yaml} (100%) diff --git a/examples/telemetry/external-spaceport.router.yaml b/examples/telemetry/spaceport.router.yaml similarity index 100% rename from examples/telemetry/external-spaceport.router.yaml rename to examples/telemetry/spaceport.router.yaml