Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconcile dev after merge to main for v1.41.0 #4772

Merged
merged 20 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changesets/feat_geal_entity_cache_span.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changesets/feat_geal_redis_fail_open.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changesets/feat_glasser_pq_gzip.md

This file was deleted.

15 changes: 0 additions & 15 deletions .changesets/fix_bnjjj_fix_4699.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/fix_geal_non_blocking_stdout.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changesets/fix_geal_subgraph_streaming_compression.md

This file was deleted.

42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,48 @@ All notable changes to Router will be documented in this file.

This project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html).

# [1.41.0] - 2024-03-08

## 🚀 Features

### Entity caching: Add tracing spans around Redis interactions ([PR #4667](https://github.com/apollographql/router/pull/4667))

This adds `cache_lookup` and `cache_store` spans to traces which show Redis calls related to our recently announced [entity caching](https://www.apollographql.com/docs/router/configuration/entity-caching/) feature. This also changes the behavior slightly so that storing in Redis does not stop the execution of the rest of the query.

By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/4667

### Use Gzip compression when downloading Persisted Query manifests ([PR #4622](https://github.com/apollographql/router/pull/4622))

Router will now request Gzip compression when downloading Persisted Query manifests for improved network efficiency.

By [@glasser](https://github.com/glasser) in https://github.com/apollographql/router/pull/4622

### Redis: add a fail open option ([Issue #4334](https://github.com/apollographql/router/issues/4334))

This option configures the Router's behavior in case it cannot connect to Redis:
- By default, the router will start and all requests will be handled in a degraded state.
- Alternatively, this option can be configured to prevent the router from starting if it can't connect to Redis.

By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/4534

## 🐛 Fixes

### Default header now correctly set when `experimental_response_trace_id` is enabled ([Issue #4699](https://github.com/apollographql/router/issues/4699))

When configuring the `experimental_response_trace_id` without an explicit header it now correctly takes the default one `apollo-trace-id`.

Example of configuration:

```yaml
telemetry:
exporters:
tracing:
experimental_response_trace_id:
enabled: true
```

By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/4702

# [1.40.2] - 2024-03-06

## 🔒 Security
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ dependencies = [

[[package]]
name = "apollo-router"
version = "1.40.2"
version = "1.41.0"
dependencies = [
"access-json",
"anyhow",
Expand Down Expand Up @@ -408,7 +408,7 @@ dependencies = [

[[package]]
name = "apollo-router-benchmarks"
version = "1.40.2"
version = "1.41.0"
dependencies = [
"apollo-parser",
"apollo-router",
Expand All @@ -424,7 +424,7 @@ dependencies = [

[[package]]
name = "apollo-router-scaffold"
version = "1.40.2"
version = "1.41.0"
dependencies = [
"anyhow",
"cargo-scaffold",
Expand Down
2 changes: 1 addition & 1 deletion apollo-router-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "apollo-router-benchmarks"
version = "1.40.2"
version = "1.41.0"
authors = ["Apollo Graph, Inc. <[email protected]>"]
edition = "2021"
license = "Elastic-2.0"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router-scaffold/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "apollo-router-scaffold"
version = "1.40.2"
version = "1.41.0"
authors = ["Apollo Graph, Inc. <[email protected]>"]
edition = "2021"
license = "Elastic-2.0"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router-scaffold/templates/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apollo-router = { path ="{{integration_test}}apollo-router" }
apollo-router = { git="https://github.com/apollographql/router.git", branch="{{branch}}" }
{{else}}
# Note if you update these dependencies then also update xtask/Cargo.toml
apollo-router = "1.40.2"
apollo-router = "1.41.0"
{{/if}}
{{/if}}
async-trait = "0.1.52"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router-scaffold/templates/base/xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ apollo-router-scaffold = { path ="{{integration_test}}apollo-router-scaffold" }
{{#if branch}}
apollo-router-scaffold = { git="https://github.com/apollographql/router.git", branch="{{branch}}" }
{{else}}
apollo-router-scaffold = { git = "https://github.com/apollographql/router.git", tag = "v1.40.2" }
apollo-router-scaffold = { git = "https://github.com/apollographql/router.git", tag = "v1.41.0" }
{{/if}}
{{/if}}
anyhow = "1.0.58"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "apollo-router"
version = "1.40.2"
version = "1.41.0"
authors = ["Apollo Graph, Inc. <[email protected]>"]
repository = "https://github.com/apollographql/router/"
documentation = "https://docs.rs/apollo-router"
Expand Down
29 changes: 0 additions & 29 deletions apollo-router/src/executable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,6 @@ impl Executable {
return Ok(());
}

// mark stdout and stderr as non blocking. If they are blocking and piped
// to a program that does not consume them, the router starts hanging on
// all requests: https://github.com/apollographql/router/issues/4612
#[cfg(not(target_os = "windows"))]
{
let _ = set_blocking(libc::STDOUT_FILENO, false);
let _ = set_blocking(libc::STDERR_FILENO, false);
}

copy_args_to_env();

let apollo_telemetry_initialized = if graph_os() {
Expand Down Expand Up @@ -753,26 +744,6 @@ fn copy_args_to_env() {
});
}

#[cfg(not(target_os = "windows"))]
fn set_blocking(fd: std::os::fd::RawFd, blocking: bool) -> std::io::Result<()> {
let flags = unsafe { libc::fcntl(fd, libc::F_GETFL, 0) };
if flags < 0 {
return Err(std::io::Error::last_os_error());
}

let flags = if blocking {
flags & !libc::O_NONBLOCK
} else {
flags | libc::O_NONBLOCK
};
let res = unsafe { libc::fcntl(fd, libc::F_SETFL, flags) };
if res != 0 {
return Err(std::io::Error::last_os_error());
}

Ok(())
}

#[cfg(test)]
mod tests {
use crate::executable::add_log_filter;
Expand Down
8 changes: 1 addition & 7 deletions apollo-router/src/plugins/telemetry/fmt_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::cell::RefCell;
use std::collections::HashMap;
use std::collections::HashSet;
use std::io::IsTerminal;
use std::io::Write;
use std::marker::PhantomData;

use opentelemetry::Key;
Expand Down Expand Up @@ -183,12 +182,7 @@ where
if self.fmt_event.format_event(&ctx, &mut buf, event).is_ok() {
let mut writer = self.make_writer.make_writer();
if let Err(err) = std::io::Write::write_all(&mut writer, buf.as_bytes()) {
if err.kind() != std::io::ErrorKind::WouldBlock {
let _ = std::io::stderr().write_all(
format!("cannot flush the logging buffer, this is a bug: {err:?}")
.as_bytes(),
);
}
eprintln!("cannot flush the logging buffer, this is a bug: {err:?}");
}
}
buf.clear();
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/tracing/docker-compose.datadog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:

apollo-router:
container_name: apollo-router
image: ghcr.io/apollographql/router:v1.40.2
image: ghcr.io/apollographql/router:v1.41.0
volumes:
- ./supergraph.graphql:/etc/config/supergraph.graphql
- ./router/datadog.router.yaml:/etc/config/configuration.yaml
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/tracing/docker-compose.jaeger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
apollo-router:
container_name: apollo-router
#build: ./router
image: ghcr.io/apollographql/router:v1.40.2
image: ghcr.io/apollographql/router:v1.41.0
volumes:
- ./supergraph.graphql:/etc/config/supergraph.graphql
- ./router/jaeger.router.yaml:/etc/config/configuration.yaml
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/tracing/docker-compose.zipkin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
apollo-router:
container_name: apollo-router
build: ./router
image: ghcr.io/apollographql/router:v1.40.2
image: ghcr.io/apollographql/router:v1.41.0
volumes:
- ./supergraph.graphql:/etc/config/supergraph.graphql
- ./router/zipkin.router.yaml:/etc/config/configuration.yaml
Expand Down
18 changes: 0 additions & 18 deletions docs/source/customizations/native.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,6 @@ tracing::info!(
);
```

## Logging

The Router has a logging infrastructure based on the [tracing macros](https://docs.rs/tracing/latest/tracing/index.html#macros), like metrics, and those should be the preferred way to write logs, as they will be configurable through the Router's telemetry infrastructure.

Example usage:

```rust
tracing::info!(service_name = name, "received request");
```

If writing to stdout or stderr directly is still needed, additional steps should be taken to prevent errors: due to the Router using non blocking IO for stdout and stderr, `println!` and `eprintln!` cannot be used, as they would panic if those streams were blocking.
As an example, writing to stdout would be done like this:

```rust
use std::io::Write;
let _ = writeln!(std::io::stdout(), "value={}", 1);
```

## Plugin Lifecycle

Like individual requests, plugins follow their own strict lifecycle that helps provide structure to the Apollo Router's execution.
Expand Down
4 changes: 2 additions & 2 deletions helm/chart/router/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ type: application
# so it matches the shape of our release process and release automation.
# By proxy of that decision, this version uses SemVer 2.0.0, though the prefix
# of "v" is not included.
version: 1.40.2
version: 1.41.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v1.40.2"
appVersion: "v1.41.0"
6 changes: 3 additions & 3 deletions helm/chart/router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[router](https://github.com/apollographql/router) Rust Graph Routing runtime for Apollo Federation

![Version: 1.40.2](https://img.shields.io/badge/Version-1.40.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.40.2](https://img.shields.io/badge/AppVersion-v1.40.2-informational?style=flat-square)
![Version: 1.41.0](https://img.shields.io/badge/Version-1.41.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.41.0](https://img.shields.io/badge/AppVersion-v1.41.0-informational?style=flat-square)

## Prerequisites

Expand All @@ -11,15 +11,15 @@
## Get Repo Info

```console
helm pull oci://ghcr.io/apollographql/helm-charts/router --version 1.40.2
helm pull oci://ghcr.io/apollographql/helm-charts/router --version 1.41.0
```

## Install Chart

**Important:** only helm3 is supported

```console
helm upgrade --install [RELEASE_NAME] oci://ghcr.io/apollographql/helm-charts/router --version 1.40.2 --values my-values.yaml
helm upgrade --install [RELEASE_NAME] oci://ghcr.io/apollographql/helm-charts/router --version 1.41.0 --values my-values.yaml
```

_See [configuration](#configuration) below._
Expand Down
Loading
Loading