[package]
name = "apollo-router"
version = "2.12.1"
authors = ["Apollo Graph, Inc. <packages@apollographql.com>"]
repository = "https://github.com/apollographql/router/"
documentation = "https://docs.rs/apollo-router"
description = "A configurable, high-performance routing runtime for Apollo Federation 🚀"
license = "Elastic-2.0"

# renovate-automation: rustc version
rust-version = "1.91.1"
edition = "2024"
build = "build/main.rs"
default-run = "router"

[[bin]]
name = "router"
path = "src/main.rs"
# Don’t recompile main.rs to run unit tests, there aren’t any there:
test = false

[lib]
# Disabled as they are low value compared to the pathological amount of time and RAM
# needed to link an executable for each individual doctest:
doctest = false

[features]
default = ["global-allocator"]

# Set the Rust global allocator on some platforms
# https://doc.rust-lang.org/std/alloc/index.html#the-global_allocator-attribute
# Enabled by default. Disable default features in library crates or to set it yourself:
# ```
# [dependencies]
# apollo-router = {version = "1.20", default-features = false}
# ```
global-allocator = ["tikv-jemallocator/profiling", "tikv-jemalloc-ctl/stats", "tikv-jemalloc-ctl/profiling"]

# if you are doing heap profiling
dhat-heap = ["dhat"]
dhat-ad-hoc = ["dhat"]

# Prevents the query execution to continue if any error occurs while fetching
# the data of a subgraph. This is useful in development as you want to be
# alerted early when something is wrong instead of receiving an invalid result.
failfast = []

# Enables the use of new telemetry features that are under development
# and not yet ready for production use.
telemetry_next = []

# is set when ci builds take place. It allows us to disable some tests when CI is running on certain platforms.
ci = []

# Enables the HTTP snapshot server for testing
snapshot = []

[dependencies]
addr2line = "0.25.0"
anyhow = "1.0.86"
apollo-compiler.workspace = true
apollo-federation = { path = "../apollo-federation", version = "=2.12.1" }
async-compression = { version = "0.4.6", features = [
    "tokio",
    "futures-io",
    "brotli",
    "gzip",
    "deflate",
] }
async-trait.workspace = true
axum = { version = "0.8.1", features = ["http2"] }
base64 = "0.22.0"
bloomfilter = "3.0.0"
buildstructor = "0.6.0"
bytes = "1.6.0"
clap = { version = "4.5.8", default-features = false, features = [
    "env",
    "derive",
    "std",
    "help",
] }
cookie = { version = "0.18.0", default-features = false }
crossbeam-channel = "0.5.15"
ci_info = { version = "0.14.14", features = ["serde-1"] }
dashmap = { version = "6.0.0", features = ["serde"] }
docker_credential = "1.3.1"
derivative = "2.2.0"
derive_more = { version = "2.0.0", default-features = false, features = [
    "from",
    "display",
] }
dhat = { version = "0.3.3", optional = true }
diff = "0.1.13"
displaydoc = "0.2"
flate2 = "1.0.30"
fred = { version = "10.1.0", features = [
    "enable-rustls-ring",
    "i-cluster",
    "tcp-user-timeouts",
    "metrics",
    "serde-json",
    "replicas"
] }
futures = { version = "0.3.30", features = ["thread-pool"] }
graphql_client = "0.14.0"
hex.workspace = true
http.workspace = true
http-body = "1.0.1"
http-body-util = { version = "0.1.2" }
heck = "0.5.0"
humantime = "2.1.0"
humantime-serde = "1.1.1"
hyper = { version = "1.5.1", features = ["full"] }
hyper-util = { version = "0.1.16", features = [
    "client",
    "client-legacy",
    "server",
    "server-graceful",
    "http1",
    "http2",
    "tokio",
    # omit "tracing" feature as it breaks apollo_otel_traces tests, maybe re-add later?
    # https://github.com/apollographql/router/pull/7575
] }
hyper-rustls = { version = "0.27.3", default-features = false, features = [
    "http1",
    "http2",
    "rustls-native-certs",
] }
indexmap = { version = "2.2.6", features = ["serde"] }
itertools = "0.14.0"
jsonpath_lib = "0.3.0"
jsonpath-rust = "0.3.5"
jsonschema = { version = "0.36.0", default-features = false }
jsonwebtoken = { version = "10.0.0", features = ["rust_crypto"] }
libc = "0.2.155"
linkme = "0.3.30"
lru = "0.16.0"
mediatype = "0.21.0"
mockall = "0.14.0"
mime = "0.3.17"
multer = "3.1.0"
multimap = "0.9.1" # Warning: part of the public API
# To avoid tokio issues
notify = { version = "8.0.0", default-features = false, features = [
    "macos_kqueue",
] }
nu-ansi-term = "0.50"
num-traits = "0.2.19"
oci-client = { version = "0.15.0", default-features = false, features = ["rustls-tls", "rustls-tls-native-roots", "trust-dns"] }
once_cell = "1.19.0"

# Any package that starts with `opentelemetry` needs to be updated with care
# because it is tightly intertwined with the `tracing` packages on account of
# the `opentelemetry-tracing` package.
#
# We are constrained in our ability to update the `tracing` packages and that is
# tracked in https://github.com/apollographql/router/issues/1407.
#
# To codify this with code, a rule in our Renovate configuration constraints and
# groups `^tracing` and `^opentelemetry*` dependencies together as of
# https://github.com/apollographql/router/pull/1509.  A comment which exists
# there (and on `tracing` packages below) should be updated should this change.
opentelemetry = { version = "0.24.0", features = ["trace", "metrics"] }
opentelemetry_sdk = { version = "0.24.1", default-features = false, features = [
    "rt-tokio",
    "trace",
] }
opentelemetry-aws = "0.12.0"
# START TEMP DATADOG Temporarily remove until we upgrade otel to the latest version
# This means including the rmp library
# opentelemetry-datadog = { version = "0.12.0", features = ["reqwest-client"] }
rmp = "0.8"
# END TEMP DATADOG
opentelemetry-http = "0.13.0"
opentelemetry-jaeger-propagator = "0.3.0"
opentelemetry-otlp = { version = "0.17.0", default-features = false, features = [
    "grpc-tonic",
    "gzip-tonic",
    "tonic",
    "tls",
    "http-proto",
    "metrics",
    "reqwest-client",
    "trace",
] }
opentelemetry-semantic-conventions = "0.16.0"
opentelemetry-zipkin = { version = "0.22.0", default-features = false, features = [
    "reqwest-client",
    "reqwest-rustls",
] }
opentelemetry-prometheus = "0.17.0"
paste = "1.0.15"
pin-project-lite = "0.2.14"
prometheus = "0.13"
prost = "0.13.0"
prost-types = "0.13.0"
proteus = "0.5.0"
rand = "0.9.0"
rhai = { version = "1.23.6", features = ["sync", "serde", "internals"] }
regex = "1.10.5"
reqwest = { workspace = true, default-features = false, features = [
    "rustls-tls",
    "rustls-tls-native-roots",
    "gzip",
    "json",
    "stream",
] }

rust-embed = { version = "8.4.0", features = ["include-exclude"] }
rustls = { version = "0.23.19", default-features = false }
rustls-native-certs = "0.8.1"
rustls-pemfile = "2.2.0"
schemars.workspace = true
shellexpand = "3.1.0"
sha2 = "0.10.8"
semver = "1.0.23"
serde.workspace = true
serde_derive_default = "0.1"
serde_json_bytes.workspace = true
serde_json.workspace = true
serde_regex = { version = "1.1.0" }
serde_urlencoded = "0.7.1"
serde_yaml = "0.8.26"
static_assertions = "1.1.0"
strum = { version = "0.27.0", features = ["derive"] }
sys-info = "0.9.1"
sysinfo = { version = "0.37.0", features = [
    "system",
    "windows",
], default-features = false }
thiserror = "2.0.0"
tokio.workspace = true
tokio-stream = { version = "0.1.15", features = ["sync", "net", "fs"] }
tokio-util = { version = "0.7.11", features = ["net", "codec", "time", "compat"] }
tonic = { version = "0.12.3", features = [
    "transport",
    "tls",
    "tls-roots",
    "gzip",
] }
tower.workspace = true
tower-http = { version = "0.6.2", features = ["full"] }
tower-service = "0.3.2"
tracing = "0.1.40"
tracing-core = "0.1.32"
tracing-futures = { version = "0.2.5", features = ["futures-03"] }
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "json"] }
url = { version = "2.5.4", features = ["serde"] }
urlencoding = "2.1.3"
uuid = { version = "1.9.1", features = ["serde", "v4"] }
yaml-rust = "0.4.5"
wiremock = "0.6"
wsl = "0.1.0"
tokio-tungstenite = { version = "0.28.0", features = [
    "rustls-tls-native-roots",
] }
tokio-rustls = { version = "0.26.0", default-features = false }
hickory-resolver = "0.25.0"
http-serde = "2.1.1"
hmac = "0.12.1"
parking_lot = { version = "0.12.3", features = ["serde"] }
memchr = "2.7.4"
brotli = "8.0.0"
zstd = "0.13.1"
zstd-safe = "7.1.0"
# note: AWS dependencies should always use the same version
# note: hyper 1.0 update seems to mean this isn't true...
aws-sigv4 = "1.2.6"
aws-credential-types = "1.2.1" # XXX: This is the latest version
aws-config = { version = "1.5.5", default-features = false }
aws-types = "1.3.3"
aws-smithy-async = { version = "1.2.5", features = ["rt-tokio"] }
aws-smithy-http-client = { version = "1.0.1", default-features = false, features = [
    "default-client",
    "rustls-ring",
] }
aws-smithy-runtime-api = { version = "1.7.3", features = ["client"] }
sha1.workspace = true
tracing-serde = "0.2.0"
time = { version = "0.3.36", features = ["serde"] }
similar.workspace = true
console = "0.16.0"
bytesize = { version = "1.3.0", features = ["serde"] }
ahash = "0.8.11"
itoa = "1.0.9"
ryu = "1.0.15"
apollo-environment-detector = "0.1.0"
log = "0.4.22"
scopeguard = "1.2.0"
tokio-tar = { package = "astral-tokio-tar", version = "0.5.3" }
blake3 = { version = "1.8.2", features = ["serde"] }

[target.'cfg(unix)'.dependencies]
uname = "0.1.1"
hyperlocal = { version = "0.9.1", default-features = false, features = [
    "client",
] }
tikv-jemallocator = { version = "0.6.0", features = ["profiling"], optional = true }
tikv-jemalloc-ctl = { version = "0.6.0", features = ["stats", "profiling"], optional = true }
tikv-jemalloc-sys = { version = "0.6.0", features = ["profiling"] }

[dev-dependencies]
axum = { version = "0.8.1", features = ["http2", "ws"] }
ctor = "0.6.0"
ecdsa = { version = "0.16.9", features = ["signing", "pem", "pkcs8"] }
encoding_rs.workspace = true
fred = { version = "10.1.0", features = [
    "enable-rustls-ring",
    "mocks",
    "i-cluster",
    "tcp-user-timeouts",
    "replicas",
] }
futures-test = "0.3.30"
insta.workspace = true
maplit = "1.0.2"
memchr = { version = "2.7.4", default-features = false }
mockall = "0.14.0"
num-traits = "0.2.19"
once_cell.workspace = true
opentelemetry-stdout = { version = "0.5.0", features = ["trace"] }
opentelemetry = { version = "0.24.0", features = ["testing"] }
opentelemetry_sdk = { version = "0.24.1", features = ["testing"] }
opentelemetry-proto = { version = "0.7.0", features = [
    "metrics",
    "trace",
    "gen-tonic-messages",
    "with-serde",
] }
opentelemetry-datadog = { version = "0.12.0", features = ["reqwest-client"] }
p256 = "0.13.2"
pretty_assertions = "1.4.1"
reqwest = { version = "0.12.9", default-features = false, features = [
    "json",
    "multipart",
    "stream",
] }
rhai = { version = "1.23.6", features = [
    "sync",
    "serde",
    "internals",
    "testing-environ",
] }
tempfile.workspace = true
test-log = { version = "0.2.16", default-features = false, features = [
    "trace",
] }
tower-test = "0.4.0"
multer = { version = "3.1.0", features = ["json"] }

# See note above in this file about `^tracing` packages which also applies to
# these dev dependencies.
tracing-subscriber = { version = "0.3.20", default-features = false, features = [
    "env-filter",
    "fmt",
] }
tracing-opentelemetry = "0.25.0"
tracing-test = "=0.2.5"
tracing-mock = "0.1.0-beta.1"
walkdir = "2.5.0"
wiremock = "0.6"
libtest-mimic = "0.8.0"
rstest = "0.26.0"

[target.'cfg(target_os = "linux")'.dev-dependencies]
rstack = { version = "0.3.3", features = ["dw"], default-features = false }

[target.'cfg(unix)'.dev-dependencies]
hyperlocal = { version = "0.9.1", default-features = false, features = [
    "client",
    "server",
] }

[build-dependencies]
tonic-build = "0.12.3"
serde_json.workspace = true

[package.metadata.cargo-machete]
ignored = [
    "serde_regex", # Referenced only as a string in a macro
]

[[test]]
name = "integration_tests"
path = "tests/integration_tests.rs"

[[test]]
name = "samples"
path = "tests/samples_tests.rs"
harness = false

[[test]]
# This test is separated because it needs to run in a dedicated process.
# nextest does this by default, but using a separate [[test]] also makes it work with `cargo test`.
name = "compute_backpressure"
path = "tests/compute_backpressure.rs"

[[test]]
name = "telemetry_resources"
path = "tests/telemetry_resource_tests.rs"
harness = false

[[bin]]
name = "snapshot"
path = "src/test_harness/http_snapshot_main.rs"
test = false
required-features = ["snapshot"]

[[bench]]
name = "huge_requests"
harness = false

[[bench]]
name = "deeply_nested"
harness = false

[[example]]
name = "planner"

[lints.rust]

# Compatibility with the 2024 edition, remove after switching to it:
boxed-slice-into-iter = "warn"
dependency-on-unit-never-type-fallback = "warn"
deprecated-safe-2024 = "warn"
impl-trait-overcaptures = "warn"
keyword-idents-2024 = "warn"
missing-unsafe-on-extern = "warn"
never-type-fallback-flowing-into-unsafe = "warn"
rust-2024-guarded-string-incompatible-syntax = "warn"
rust-2024-incompatible-pat = "warn"
rust-2024-prelude-collisions = "warn"
static-mut-refs = "warn"
unsafe-attr-outside-unsafe = "warn"
unsafe-op-in-unsafe-fn = "warn"
