From 310d7cb993b7e0c429ffd3425f9103d60359927b Mon Sep 17 00:00:00 2001 From: shashitnak Date: Sun, 10 Mar 2024 16:59:31 +0530 Subject: [PATCH] feat(apollo): apollo studio integration (#1268) Co-authored-by: Tushar Mathur Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 9 + .github/workflows/lint.yml | 2 + Cargo.lock | 1001 ++++++++++++++--- Cargo.toml | 9 + autogen/src/gen_gql_schema.rs | 1 + aws-lambda/src/runtime.rs | 1 + benches/data_loader_bench.rs | 1 + ...impl_path_string_for_evaluation_context.rs | 1 + cloudflare/src/runtime.rs | 1 + examples/apollo-tracing.graphql | 17 + generated/.tailcallrc.graphql | 23 + generated/.tailcallrc.schema.json | 44 + src/app_context.rs | 5 +- src/blueprint/blueprint.rs | 15 +- src/blueprint/operation.rs | 2 +- src/blueprint/telemetry.rs | 51 +- src/cli/runtime/mod.rs | 1 + src/cli/server/server_config.rs | 26 +- src/cli/telemetry.rs | 3 + src/config/apollo.rs | 61 + src/config/mod.rs | 2 + src/config/telemetry.rs | 25 +- src/lib.rs | 1 + src/runtime.rs | 19 + src/schema_extension.rs | 18 + tests/execution/apollo-tracing.md | 36 + tests/execution_spec.rs | 2 + tests/server_spec.rs | 2 + ...tion_spec__apollo-tracing.md_assert_0.snap | 15 + ...cution_spec__apollo-tracing.md_client.snap | 11 + ...cution_spec__apollo-tracing.md_merged.snap | 11 + 31 files changed, 1251 insertions(+), 165 deletions(-) create mode 100644 examples/apollo-tracing.graphql create mode 100644 src/config/apollo.rs create mode 100644 src/schema_extension.rs create mode 100644 tests/execution/apollo-tracing.md create mode 100644 tests/snapshots/execution_spec__apollo-tracing.md_assert_0.snap create mode 100644 tests/snapshots/execution_spec__apollo-tracing.md_client.snap create mode 100644 tests/snapshots/execution_spec__apollo-tracing.md_merged.snap diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fa489689c..db0769d1ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,9 @@ jobs: - name: Install cargo-lambda run: pip install cargo-lambda + - name: Install protobuf-compiler + run: sudo apt-get install -y protobuf-compiler + - name: Build run: cargo lambda build @@ -97,6 +100,9 @@ jobs: - name: Install Stable Toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install protobuf-compiler + run: sudo apt-get install -y protobuf-compiler + - name: Run Cargo Test run: cargo llvm-cov --all-features --lcov --output-path lcov.info @@ -126,6 +132,9 @@ jobs: - name: Install Rust uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install protobuf-compiler + run: sudo apt-get install -y protobuf-compiler + - name: Build Project run: cargo build diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d739f3eb02..eebdc0312d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -33,6 +33,8 @@ jobs: run: npm install --global prettier - name: Install Stable Toolchain uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install protobuf-compiler + run: sudo apt-get install -y protobuf-compiler - name: Run Lint Script run: ./lint.sh --mode=$LINT_MODE - name: Commit and push if changed diff --git a/Cargo.lock b/Cargo.lock index fd4a2c18c3..09830b7fc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + [[package]] name = "ahash" version = "0.7.8" @@ -44,7 +50,7 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "once_cell", "version_check", "zerocopy", @@ -227,7 +233,7 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.2.0", "async-executor", - "async-io 2.3.1", + "async-io 2.3.2", "async-lock 3.3.0", "blocking", "futures-lite 2.2.0", @@ -245,7 +251,7 @@ dependencies = [ "async-stream", "async-trait", "base64", - "bytes", + "bytes 1.5.0", "chrono", "fast_chemail", "fnv", @@ -278,7 +284,7 @@ source = "git+https://github.com/tusharmath/async-graphql.git?branch=add-setter# dependencies = [ "Inflector", "async-graphql-parser", - "darling", + "darling 0.20.8", "proc-macro-crate", "proc-macro2", "quote", @@ -287,6 +293,35 @@ dependencies = [ "thiserror", ] +[[package]] +name = "async-graphql-extension-apollo-tracing" +version = "3.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d157f25cc225308d76fc39fc8b186f6319db56e1e4eff338b6fb8bad8bfbd43" +dependencies = [ + "anyhow", + "async-graphql", + "async-trait", + "cfg-if 1.0.0", + "chrono", + "derive_builder", + "futures 0.3.30", + "futures-locks", + "libflate", + "prost", + "prost-types", + "reqwest", + "serde", + "serde_json", + "sha2", + "tokio 1.36.0", + "tonic 0.10.2", + "tonic-build", + "tracing", + "tracing-futures", + "uuid", +] + [[package]] name = "async-graphql-parser" version = "7.0.2" @@ -303,7 +338,7 @@ name = "async-graphql-value" version = "7.0.2" source = "git+https://github.com/tusharmath/async-graphql.git?branch=add-setter#f72cf7da34341e7006667d2c59f2db5d67367ce2" dependencies = [ - "bytes", + "bytes 1.5.0", "indexmap 2.2.5", "serde", "serde_json", @@ -317,7 +352,7 @@ checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock 2.8.0", "autocfg", - "cfg-if", + "cfg-if 1.0.0", "concurrent-queue", "futures-lite 1.13.0", "log", @@ -331,12 +366,12 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" +checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" dependencies = [ "async-lock 3.3.0", - "cfg-if", + "cfg-if 1.0.0", "concurrent-queue", "futures-io", "futures-lite 2.2.0", @@ -387,7 +422,7 @@ dependencies = [ "async-lock 2.8.0", "async-signal", "blocking", - "cfg-if", + "cfg-if 1.0.0", "event-listener 3.1.0", "futures-lite 1.13.0", "rustix 0.38.31", @@ -411,10 +446,10 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.3.1", + "async-io 2.3.2", "async-lock 2.8.0", "atomic-waker", - "cfg-if", + "cfg-if 1.0.0", "futures-core", "futures-io", "rustix 0.38.31", @@ -435,7 +470,7 @@ dependencies = [ "async-io 1.13.0", "async-lock 2.8.0", "async-process", - "crossbeam-utils", + "crossbeam-utils 0.8.19", "futures-channel", "futures-core", "futures-io", @@ -512,7 +547,7 @@ dependencies = [ "serde", "serde_json", "tailcall", - "tokio", + "tokio 1.36.0", "tracing", ] @@ -528,7 +563,7 @@ dependencies = [ "lambda_runtime", "reqwest", "tailcall", - "tokio", + "tokio 1.36.0", "tracing", "tracing-subscriber", ] @@ -540,7 +575,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "598e2ade8447dce8d3a15b6159b73354db34257851344b232fb1920c272acc61" dependencies = [ "base64", - "bytes", + "bytes 1.5.0", "http 1.1.0", "http-body 1.0.0", "http-serde 2.0.0", @@ -558,7 +593,7 @@ dependencies = [ "async-trait", "axum-core", "bitflags 1.3.2", - "bytes", + "bytes 1.5.0", "futures-util", "http 0.2.12", "http-body 0.4.6", @@ -584,7 +619,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" dependencies = [ "async-trait", - "bytes", + "bytes 1.5.0", "futures-util", "http 0.2.12", "http-body 0.4.6", @@ -602,7 +637,7 @@ checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", - "cfg-if", + "cfg-if 1.0.0", "libc", "miniz_oxide", "object", @@ -711,6 +746,16 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "bytes" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +dependencies = [ + "byteorder", + "iovec", +] + [[package]] name = "bytes" version = "1.5.0" @@ -775,6 +820,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + [[package]] name = "cfg-if" version = "1.0.0" @@ -884,6 +935,15 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "cloudflare" version = "0.1.0" @@ -928,7 +988,7 @@ version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ - "bytes", + "bytes 1.5.0", "memchr", ] @@ -938,7 +998,7 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.8.19", ] [[package]] @@ -959,7 +1019,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "wasm-bindgen", ] @@ -991,6 +1051,15 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +[[package]] +name = "core2" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" +dependencies = [ + "memchr", +] + [[package]] name = "cpufeatures" version = "0.2.12" @@ -1000,6 +1069,15 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "criterion" version = "0.5.1" @@ -1042,7 +1120,18 @@ version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.8.19", +] + +[[package]] +name = "crossbeam-deque" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" +dependencies = [ + "crossbeam-epoch 0.8.2", + "crossbeam-utils 0.7.2", + "maybe-uninit", ] [[package]] @@ -1051,8 +1140,23 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", + "crossbeam-epoch 0.9.18", + "crossbeam-utils 0.8.19", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "lazy_static", + "maybe-uninit", + "memoffset 0.5.6", + "scopeguard", ] [[package]] @@ -1061,7 +1165,29 @@ version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.8.19", +] + +[[package]] +name = "crossbeam-queue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" +dependencies = [ + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if 0.1.10", + "lazy_static", ] [[package]] @@ -1079,11 +1205,11 @@ dependencies = [ "bitflags 1.3.2", "crossterm_winapi", "libc", - "mio", - "parking_lot", + "mio 0.8.11", + "parking_lot 0.12.1", "signal-hook", "signal-hook-mio", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1092,7 +1218,7 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1111,14 +1237,38 @@ dependencies = [ "typenum", ] +[[package]] +name = "darling" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" +dependencies = [ + "darling_core 0.14.4", + "darling_macro 0.14.4", +] + [[package]] name = "darling" version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.20.8", + "darling_macro 0.20.8", +] + +[[package]] +name = "darling_core" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn 1.0.109", ] [[package]] @@ -1135,17 +1285,34 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "darling_macro" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" +dependencies = [ + "darling_core 0.14.4", + "quote", + "syn 1.0.109", +] + [[package]] name = "darling_macro" version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ - "darling_core", + "darling_core 0.20.8", "quote", "syn 2.0.52", ] +[[package]] +name = "dary_heap" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7762d17f1241643615821a8455a0b2c3e803784b058693d990b11f2dce25a0ca" + [[package]] name = "data-encoding" version = "2.5.0" @@ -1172,23 +1339,23 @@ dependencies = [ "bincode", "bit-set", "bit-vec", - "bytes", + "bytes 1.5.0", "cooked-waker", "deno_ops", "deno_unsync", - "futures", + "futures 0.3.30", "libc", "log", - "memoffset", - "parking_lot", + "memoffset 0.9.0", + "parking_lot 0.12.1", "pin-project", "serde", "serde_json", "serde_v8", - "smallvec", + "smallvec 1.13.1", "sourcemap", "static_assertions", - "tokio", + "tokio 1.36.0", "url", "v8", ] @@ -1214,7 +1381,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30dff7e03584dbae188dae96a0f1876740054809b2ad0cf7c9fc5d361f20e739" dependencies = [ - "tokio", + "tokio 1.36.0", ] [[package]] @@ -1226,6 +1393,37 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derive_builder" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f59169f400d8087f238c5c0c7db6a28af18681717f3b623227d92f397e938c7" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4ec317cc3e7ef0928b0ca6e4a634a4d6c001672ae210438cf114a83e56b018d" +dependencies = [ + "darling 0.14.4", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_builder_macro" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "870368c3fb35b8031abb378861d4460f573b92238ec2152c927a21f77e3e0127" +dependencies = [ + "derive_builder_core", + "syn 1.0.109", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -1245,7 +1443,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e8ef033054e131169b8f0f9a7af8f5533a9436fadf3c500ed547f730f07090d" dependencies = [ - "darling", + "darling 0.20.8", "proc-macro2", "quote", "syn 2.0.52", @@ -1282,7 +1480,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "dirs-sys-next", ] @@ -1306,7 +1504,7 @@ checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", "redox_users", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1348,7 +1546,7 @@ version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -1503,9 +1701,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04412b8935272e3a9bae6f48c7bfff74c2911f60525404edfdd28e49884c3bfb" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags 1.3.2", + "fuchsia-zircon-sys", ] +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" + [[package]] name = "futures" version = "0.3.30" @@ -1582,6 +1802,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "futures-locks" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" +dependencies = [ + "futures-channel", + "futures-task", + "tokio 1.36.0", +] + [[package]] name = "futures-macro" version = "0.3.30" @@ -1667,7 +1898,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "js-sys", "libc", "wasi", @@ -1860,7 +2091,7 @@ version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ - "bytes", + "bytes 1.5.0", "fnv", "futures-core", "futures-sink", @@ -1868,7 +2099,7 @@ dependencies = [ "http 0.2.12", "indexmap 2.2.5", "slab", - "tokio", + "tokio 1.36.0", "tokio-util", "tracing", ] @@ -1879,7 +2110,7 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "crunchy", ] @@ -1906,6 +2137,15 @@ dependencies = [ "ahash 0.7.8", ] +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.11", +] + [[package]] name = "hashbrown" version = "0.14.3" @@ -1943,7 +2183,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ - "bytes", + "bytes 1.5.0", "fnv", "itoa", ] @@ -1954,7 +2194,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ - "bytes", + "bytes 1.5.0", "fnv", "itoa", ] @@ -1965,7 +2205,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes", + "bytes 1.5.0", "http 0.2.12", "pin-project-lite", ] @@ -1976,7 +2216,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ - "bytes", + "bytes 1.5.0", "http 1.1.0", ] @@ -1986,7 +2226,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-util", "http 1.1.0", "http-body 1.0.0", @@ -2083,7 +2323,7 @@ dependencies = [ "async-trait", "base64", "basic-cookies", - "crossbeam-utils", + "crossbeam-utils 0.8.19", "form_urlencoded", "futures-util", "hyper 0.14.28", @@ -2095,7 +2335,7 @@ dependencies = [ "serde_json", "serde_regex", "similar", - "tokio", + "tokio 1.36.0", "url", ] @@ -2105,7 +2345,7 @@ version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-channel", "futures-core", "futures-util", @@ -2117,7 +2357,7 @@ dependencies = [ "itoa", "pin-project-lite", "socket2 0.5.6", - "tokio", + "tokio 1.36.0", "tower-service", "tracing", "want", @@ -2129,7 +2369,7 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "186548d73ac615b32a73aafe38fb4f56c0d340e110e5a200bcadbaf2e199263a" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-channel", "futures-util", "http 1.1.0", @@ -2137,8 +2377,8 @@ dependencies = [ "httparse", "itoa", "pin-project-lite", - "smallvec", - "tokio", + "smallvec 1.13.1", + "tokio 1.36.0", "want", ] @@ -2152,7 +2392,7 @@ dependencies = [ "http 0.2.12", "hyper 0.14.28", "rustls 0.21.10", - "tokio", + "tokio 1.36.0", "tokio-rustls 0.24.1", ] @@ -2169,7 +2409,7 @@ dependencies = [ "rustls 0.22.2", "rustls-native-certs", "rustls-pki-types", - "tokio", + "tokio 1.36.0", "tokio-rustls 0.25.0", ] @@ -2181,7 +2421,7 @@ checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ "hyper 0.14.28", "pin-project-lite", - "tokio", + "tokio 1.36.0", "tokio-io-timeout", ] @@ -2191,7 +2431,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-channel", "futures-util", "http 1.1.0", @@ -2199,7 +2439,7 @@ dependencies = [ "hyper 1.2.0", "pin-project-lite", "socket2 0.5.6", - "tokio", + "tokio 1.36.0", "tower", "tower-service", "tracing", @@ -2314,7 +2554,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", ] [[package]] @@ -2328,6 +2568,15 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -2376,7 +2625,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" dependencies = [ "cesu8", - "cfg-if", + "cfg-if 1.0.0", "combine", "jni-sys", "log", @@ -2400,6 +2649,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "kv-log-macro" version = "1.0.7" @@ -2448,9 +2707,9 @@ checksum = "ef8fafd7a4ce0bc6093cf1bed3dcdfc1239c27df1e79e3f2154f4d3299d4f60e" dependencies = [ "aws_lambda_events", "base64", - "bytes", + "bytes 1.5.0", "encoding_rs", - "futures", + "futures 0.3.30", "futures-util", "http 1.1.0", "http-body 1.0.0", @@ -2475,8 +2734,8 @@ checksum = "cc2904c10fbeaf07aa317fc96a0e28e89c80ed12f7949ed06afd7869b21fef32" dependencies = [ "async-stream", "base64", - "bytes", - "futures", + "bytes 1.5.0", + "futures 0.3.30", "http 1.1.0", "http-body 1.0.0", "http-body-util", @@ -2487,7 +2746,7 @@ dependencies = [ "serde", "serde_json", "serde_path_to_error", - "tokio", + "tokio 1.36.0", "tokio-stream", "tower", "tracing", @@ -2499,7 +2758,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1364cd67281721d2a9a4444ba555cf4d74a195e647061fa4ccac46e6f5c3b0ae" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-channel", "futures-util", "http 1.1.0", @@ -2507,7 +2766,7 @@ dependencies = [ "http-body-util", "hyper 1.2.0", "hyper-util", - "tokio", + "tokio 1.36.0", "tower", "tower-service", "tracing", @@ -2532,14 +2791,38 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +[[package]] +name = "libflate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7d5654ae1795afc7ff76f4365c2c8791b0feb18e8996a96adad8ffd7c3b2bf" +dependencies = [ + "adler32", + "core2", + "crc32fast", + "dary_heap", + "libflate_lz77", +] + +[[package]] +name = "libflate_lz77" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be5f52fb8c451576ec6b79d3f4deb327398bc05bbdbd99021a6e77a4c855d524" +dependencies = [ + "core2", + "hashbrown 0.13.2", + "rle-decode-fast", +] + [[package]] name = "libloading" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" dependencies = [ - "cfg-if", - "winapi", + "cfg-if 1.0.0", + "winapi 0.3.9", ] [[package]] @@ -2560,7 +2843,7 @@ checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ "bitflags 2.4.2", "libc", - "redox_syscall", + "redox_syscall 0.4.1", ] [[package]] @@ -2581,6 +2864,15 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + [[package]] name = "lock_api" version = "0.4.11" @@ -2698,12 +2990,27 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + [[package]] name = "memchr" version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "memoffset" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.9.0" @@ -2719,7 +3026,7 @@ version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "miette-derive", "thiserror", "unicode-width", @@ -2776,6 +3083,25 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + [[package]] name = "mio" version = "0.8.11" @@ -2788,6 +3114,29 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio 0.6.23", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + [[package]] name = "moka" version = "0.12.5" @@ -2797,15 +3146,15 @@ dependencies = [ "async-lock 2.8.0", "async-trait", "crossbeam-channel", - "crossbeam-epoch", - "crossbeam-utils", + "crossbeam-epoch 0.9.18", + "crossbeam-utils 0.8.19", "futures-util", "once_cell", - "parking_lot", + "parking_lot 0.12.1", "quanta", "rustc_version 0.4.0", "skeptic", - "smallvec", + "smallvec 1.13.1", "tagptr", "thiserror", "triomphe", @@ -2818,7 +3167,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a15d522be0a9c3e46fd2632e272d178f56387bdb5c9fbb3a36c649062e9b5219" dependencies = [ - "bytes", + "bytes 1.5.0", "encoding_rs", "futures-util", "http 1.1.0", @@ -2830,12 +3179,29 @@ dependencies = [ "version_check", ] +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + [[package]] name = "ndk-context" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" +[[package]] +name = "net2" +version = "0.2.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + [[package]] name = "new_debug_unreachable" version = "1.0.4" @@ -2867,7 +3233,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2877,7 +3243,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ "overload", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3051,8 +3417,8 @@ dependencies = [ "opentelemetry_sdk", "prost", "thiserror", - "tokio", - "tonic", + "tokio 1.36.0", + "tonic 0.11.0", ] [[package]] @@ -3077,7 +3443,7 @@ dependencies = [ "opentelemetry 0.22.0", "opentelemetry_sdk", "prost", - "tonic", + "tonic 0.11.0", ] [[package]] @@ -3136,7 +3502,7 @@ dependencies = [ "rand", "serde_json", "thiserror", - "tokio", + "tokio 1.36.0", "tokio-stream", ] @@ -3176,14 +3542,40 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +dependencies = [ + "lock_api 0.3.4", + "parking_lot_core 0.6.3", + "rustc_version 0.2.3", +] + [[package]] name = "parking_lot" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ - "lock_api", - "parking_lot_core", + "lock_api 0.4.11", + "parking_lot_core 0.9.9", +] + +[[package]] +name = "parking_lot_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" +dependencies = [ + "cfg-if 0.1.10", + "cloudabi", + "libc", + "redox_syscall 0.1.57", + "rustc_version 0.2.3", + "smallvec 0.6.14", + "winapi 0.3.9", ] [[package]] @@ -3192,10 +3584,10 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", - "redox_syscall", - "smallvec", + "redox_syscall 0.4.1", + "smallvec 1.13.1", "windows-targets 0.48.5", ] @@ -3422,7 +3814,7 @@ checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", "bitflags 1.3.2", - "cfg-if", + "cfg-if 1.0.0", "concurrent-queue", "libc", "log", @@ -3436,7 +3828,7 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "concurrent-queue", "pin-project-lite", "rustix 0.38.31", @@ -3472,6 +3864,16 @@ dependencies = [ "yansi", ] +[[package]] +name = "prettyplease" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +dependencies = [ + "proc-macro2", + "syn 2.0.52", +] + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -3520,11 +3922,11 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "fnv", "lazy_static", "memchr", - "parking_lot", + "parking_lot 0.12.1", "protobuf", "thiserror", ] @@ -3535,10 +3937,32 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ - "bytes", + "bytes 1.5.0", "prost-derive", ] +[[package]] +name = "prost-build" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" +dependencies = [ + "bytes 1.5.0", + "heck", + "itertools 0.11.0", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn 2.0.52", + "tempfile", + "which 4.4.2", +] + [[package]] name = "prost-derive" version = "0.12.3" @@ -3589,7 +4013,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a29b3c5596eb23a849deba860b53ffd468199d9ad5fe4402a7d55379e16aa2d2" dependencies = [ - "bytes", + "bytes 1.5.0", "miette", "prost", "prost-reflect", @@ -3627,13 +4051,13 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ca0b7bac0b97248c40bb77288fc52029cf1459c0461ea1b05ee32ccf011de2c" dependencies = [ - "crossbeam-utils", + "crossbeam-utils 0.8.19", "libc", "once_cell", "raw-cpuid", "wasi", "web-sys", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -3726,10 +4150,16 @@ version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-deque", - "crossbeam-utils", + "crossbeam-deque 0.8.5", + "crossbeam-utils 0.8.19", ] +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + [[package]] name = "redox_syscall" version = "0.4.1" @@ -3813,7 +4243,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eea5a9eb898d3783f17c6407670e3592fd174cb81a10e51d4c37f49450b9946" dependencies = [ "base64", - "bytes", + "bytes 1.5.0", "encoding_rs", "futures-core", "futures-util", @@ -3837,7 +4267,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper", "system-configuration", - "tokio", + "tokio 1.36.0", "tokio-rustls 0.24.1", "tower-service", "url", @@ -3876,7 +4306,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", - "cfg-if", + "cfg-if 1.0.0", "getrandom", "libc", "spin", @@ -3884,6 +4314,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rle-decode-fast" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422" + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -4280,11 +4716,11 @@ version = "0.178.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2a1c7ecee7d18a29aa6a079cfd1202bdee92eff4b3c3ae6e7d1256b9d0ff8ce" dependencies = [ - "bytes", + "bytes 1.5.0", "derive_more", "num-bigint", "serde", - "smallvec", + "smallvec 1.13.1", "thiserror", "v8", ] @@ -4308,7 +4744,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "cpufeatures", "digest", ] @@ -4339,7 +4775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" dependencies = [ "libc", - "mio", + "mio 0.8.11", "signal-hook", ] @@ -4388,6 +4824,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +dependencies = [ + "maybe-uninit", +] + [[package]] name = "smallvec" version = "1.13.1" @@ -4401,7 +4846,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4456,7 +4901,7 @@ checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" dependencies = [ "new_debug_unreachable", "once_cell", - "parking_lot", + "parking_lot 0.12.1", "phf_shared 0.10.0", "precomputed-hash", ] @@ -4576,13 +5021,13 @@ version = "0.29.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "core-foundation-sys", "libc", "ntapi", "once_cell", "rayon", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4618,6 +5063,7 @@ version = "0.1.0" dependencies = [ "anyhow", "async-graphql", + "async-graphql-extension-apollo-tracing", "async-graphql-value", "async-recursion", "async-std", @@ -4685,8 +5131,8 @@ dependencies = [ "temp-env", "tempfile", "thiserror", - "tokio", - "tonic", + "tokio 1.36.0", + "tonic 0.11.0", "tracing", "tracing-opentelemetry", "tracing-subscriber", @@ -4712,7 +5158,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96374855068f47402c3121c6eed88d29cb1de8f3ab27090e273e420bdabcf050" dependencies = [ - "parking_lot", + "parking_lot 0.12.1", ] [[package]] @@ -4721,7 +5167,7 @@ version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "fastrand 2.0.1", "rustix 0.38.31", "windows-sys 0.52.0", @@ -4735,7 +5181,7 @@ checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" dependencies = [ "dirs-next", "rustversion", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -4764,7 +5210,7 @@ version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "once_cell", ] @@ -4833,6 +5279,30 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "mio 0.6.23", + "num_cpus", + "tokio-codec", + "tokio-current-thread", + "tokio-executor", + "tokio-fs", + "tokio-io", + "tokio-reactor", + "tokio-sync", + "tokio-tcp", + "tokio-threadpool", + "tokio-timer", + "tokio-udp", + "tokio-uds", +] + [[package]] name = "tokio" version = "1.36.0" @@ -4840,11 +5310,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", - "bytes", + "bytes 1.5.0", "libc", - "mio", + "mio 0.8.11", "num_cpus", - "parking_lot", + "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2 0.5.6", @@ -4852,6 +5322,59 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "tokio-codec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "tokio-io", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" +dependencies = [ + "futures 0.1.31", + "tokio-executor", +] + +[[package]] +name = "tokio-executor" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures 0.1.31", +] + +[[package]] +name = "tokio-fs" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" +dependencies = [ + "futures 0.1.31", + "tokio-io", + "tokio-threadpool", +] + +[[package]] +name = "tokio-io" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "log", +] + [[package]] name = "tokio-io-timeout" version = "1.2.0" @@ -4859,7 +5382,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" dependencies = [ "pin-project-lite", - "tokio", + "tokio 1.36.0", ] [[package]] @@ -4873,6 +5396,25 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "tokio-reactor" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures 0.1.31", + "lazy_static", + "log", + "mio 0.6.23", + "num_cpus", + "parking_lot 0.9.0", + "slab", + "tokio-executor", + "tokio-io", + "tokio-sync", +] + [[package]] name = "tokio-rustls" version = "0.24.1" @@ -4880,7 +5422,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls 0.21.10", - "tokio", + "tokio 1.36.0", ] [[package]] @@ -4891,7 +5433,7 @@ checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" dependencies = [ "rustls 0.22.2", "rustls-pki-types", - "tokio", + "tokio 1.36.0", ] [[package]] @@ -4902,7 +5444,93 @@ checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", "pin-project-lite", - "tokio", + "tokio 1.36.0", +] + +[[package]] +name = "tokio-sync" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" +dependencies = [ + "fnv", + "futures 0.1.31", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "mio 0.6.23", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" +dependencies = [ + "crossbeam-deque 0.7.4", + "crossbeam-queue", + "crossbeam-utils 0.7.2", + "futures 0.1.31", + "lazy_static", + "log", + "num_cpus", + "slab", + "tokio-executor", +] + +[[package]] +name = "tokio-timer" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" +dependencies = [ + "crossbeam-utils 0.7.2", + "futures 0.1.31", + "slab", + "tokio-executor", +] + +[[package]] +name = "tokio-udp" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "log", + "mio 0.6.23", + "tokio-codec", + "tokio-io", + "tokio-reactor", +] + +[[package]] +name = "tokio-uds" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab57a4ac4111c8c9dbcf70779f6fc8bc35ae4b2454809febac840ad19bd7e4e0" +dependencies = [ + "bytes 0.4.12", + "futures 0.1.31", + "iovec", + "libc", + "log", + "mio 0.6.23", + "mio-uds", + "tokio-codec", + "tokio-io", + "tokio-reactor", ] [[package]] @@ -4911,11 +5539,11 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "bytes", + "bytes 1.5.0", "futures-core", "futures-sink", "pin-project-lite", - "tokio", + "tokio 1.36.0", "tracing", ] @@ -4936,6 +5564,33 @@ dependencies = [ "winnow", ] +[[package]] +name = "tonic" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64", + "bytes 1.5.0", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "tokio 1.36.0", + "tokio-stream", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tonic" version = "0.11.0" @@ -4946,7 +5601,7 @@ dependencies = [ "async-trait", "axum", "base64", - "bytes", + "bytes 1.5.0", "h2", "http 0.2.12", "http-body 0.4.6", @@ -4958,7 +5613,7 @@ dependencies = [ "rustls-native-certs", "rustls-pemfile 2.1.1", "rustls-pki-types", - "tokio", + "tokio 1.36.0", "tokio-rustls 0.25.0", "tokio-stream", "tower", @@ -4967,6 +5622,19 @@ dependencies = [ "tracing", ] +[[package]] +name = "tonic-build" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" +dependencies = [ + "prettyplease", + "proc-macro2", + "prost-build", + "quote", + "syn 2.0.52", +] + [[package]] name = "tower" version = "0.4.13" @@ -4980,7 +5648,7 @@ dependencies = [ "pin-project-lite", "rand", "slab", - "tokio", + "tokio 1.36.0", "tokio-util", "tower-layer", "tower-service", @@ -5032,6 +5700,19 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "futures 0.3.30", + "futures-task", + "pin-project", + "tokio 0.1.22", + "tracing", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -5053,7 +5734,7 @@ dependencies = [ "once_cell", "opentelemetry 0.22.0", "opentelemetry_sdk", - "smallvec", + "smallvec 1.13.1", "tracing", "tracing-core", "tracing-log", @@ -5084,7 +5765,7 @@ dependencies = [ "serde", "serde_json", "sharded-slab", - "smallvec", + "smallvec 1.13.1", "thread_local", "tracing", "tracing-core", @@ -5315,7 +5996,7 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "wasm-bindgen-macro", ] @@ -5340,7 +6021,7 @@ version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -5431,6 +6112,18 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.31", +] + [[package]] name = "which" version = "5.0.0" @@ -5457,6 +6150,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -5467,6 +6166,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -5479,7 +6184,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -5710,7 +6415,7 @@ version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "windows-sys 0.48.0", ] @@ -5733,7 +6438,7 @@ dependencies = [ "serde-wasm-bindgen 0.6.5", "serde_json", "serde_urlencoded", - "tokio", + "tokio 1.36.0", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -5781,7 +6486,7 @@ version = "0.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fc23dd63b589e7f03fa686bfb3606e6ddd5e57a9020d8a1de39a31cddde7fb9" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -5793,12 +6498,22 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76ff259533532054cfbaefb115c613203c73707017459206380f03b3b3f266e" dependencies = [ - "darling", + "darling 0.20.8", "proc-macro2", "quote", "syn 2.0.52", ] +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/Cargo.toml b/Cargo.toml index 7f97d0a393..8b600a5638 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,6 +125,15 @@ opentelemetry-prometheus = "0.15.0" phonenumber = "0.3.3" chrono = "0.4.35" +# TODO: move this flag into `cli`, like other dependencies. +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +async-graphql-extension-apollo-tracing = { version = "3.2.14" } + +[patch.crates-io] +# TODO: update this once https://github.com/haixuanTao/opentelemetry-system-metrics/pull/2 gets merged +async-graphql-value = {git ="https://github.com/tusharmath/async-graphql.git", branch = "add-setter"} +async-graphql = {git ="https://github.com/tusharmath/async-graphql.git", branch = "add-setter"} + [dev-dependencies] criterion = "0.5.1" httpmock = "0.7.0" diff --git a/autogen/src/gen_gql_schema.rs b/autogen/src/gen_gql_schema.rs index 8ac75559a5..c624800406 100644 --- a/autogen/src/gen_gql_schema.rs +++ b/autogen/src/gen_gql_schema.rs @@ -64,6 +64,7 @@ static OBJECT_WHITELIST: &[&str] = &[ "OtlpExporter", "PrometheusFormat", "PrometheusExporter", + "Apollo", ]; #[derive(Clone, Copy)] diff --git a/aws-lambda/src/runtime.rs b/aws-lambda/src/runtime.rs index a7355033ab..8658a050f2 100644 --- a/aws-lambda/src/runtime.rs +++ b/aws-lambda/src/runtime.rs @@ -58,5 +58,6 @@ pub fn init_runtime() -> TargetRuntime { file: init_file(), env: init_env(), cache: init_cache(), + extensions: Arc::new(vec![]), } } diff --git a/benches/data_loader_bench.rs b/benches/data_loader_bench.rs index ad70119f07..2f14fe5ed5 100644 --- a/benches/data_loader_bench.rs +++ b/benches/data_loader_bench.rs @@ -79,6 +79,7 @@ fn benchmark_data_loader(c: &mut Criterion) { env: Arc::new(Env {}), file: Arc::new(File {}), cache: Arc::new(Cache {}), + extensions: Arc::new(vec![]), }; let loader = HttpDataLoader::new(rt, None, false); let loader = loader.to_data_loader(Batch::default().delay(1)); diff --git a/benches/impl_path_string_for_evaluation_context.rs b/benches/impl_path_string_for_evaluation_context.rs index c32fc4e8e9..24e4ea0e27 100644 --- a/benches/impl_path_string_for_evaluation_context.rs +++ b/benches/impl_path_string_for_evaluation_context.rs @@ -244,6 +244,7 @@ fn request_context() -> RequestContext { env: Arc::new(Env {}), file: Arc::new(File {}), cache: Arc::new(InMemoryCache::new()), + extensions: Arc::new(vec![]), }; RequestContext { req_headers: HeaderMap::new(), diff --git a/cloudflare/src/runtime.rs b/cloudflare/src/runtime.rs index 161ae4fbb9..fe6b7b202e 100644 --- a/cloudflare/src/runtime.rs +++ b/cloudflare/src/runtime.rs @@ -37,5 +37,6 @@ pub fn init(env: Rc) -> anyhow::Result { env: init_env(env.clone()), file: init_file(env.clone(), bucket_id)?, cache: init_cache(env), + extensions: Arc::new(vec![]), }) } diff --git a/examples/apollo-tracing.graphql b/examples/apollo-tracing.graphql new file mode 100644 index 0000000000..e07442164d --- /dev/null +++ b/examples/apollo-tracing.graphql @@ -0,0 +1,17 @@ +schema + @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @upstream(baseURL: "http://jsonplaceholder.typicode.com") + @telemetry(export: {apollo: {api_key: "{{env.APOLLO_API_KEY}}", graph_ref: "tailcall-demo-3@current"}}) { + query: Query +} + +type Query @cache(maxAge: 30000) { + posts: [Post] @http(path: "/posts") +} + +type Post { + id: Int! + userId: Int! + title: String! + body: String! +} diff --git a/generated/.tailcallrc.graphql b/generated/.tailcallrc.graphql index 69358b5bff..572d20b76f 100644 --- a/generated/.tailcallrc.graphql +++ b/generated/.tailcallrc.graphql @@ -415,6 +415,28 @@ directive @upstream( userAgent: String ) on SCHEMA +input Apollo { + """ + Setting `api_key` for Apollo. + """ + api_key: String! + """ + Setting `graph_ref` for Apollo in the format @. + """ + graph_ref: String! + """ + Setting `platform` for Apollo. + """ + platform: String! + """ + Setting `userVersion` for Apollo. + """ + user_version: String! + """ + Setting `version` for Apollo. + """ + version: String! +} input Batch { delay: Int! headers: [String!] @@ -713,6 +735,7 @@ input TelemetryExporter { stdout: StdoutExporter otlp: OtlpExporter prometheus: PrometheusExporter + apollo: Apollo } input Schema { Obj: JSON diff --git a/generated/.tailcallrc.schema.json b/generated/.tailcallrc.schema.json index 6a1171a099..8701703e0d 100644 --- a/generated/.tailcallrc.schema.json +++ b/generated/.tailcallrc.schema.json @@ -85,6 +85,38 @@ } } }, + "Apollo": { + "type": "object", + "required": [ + "api_key", + "graph_ref" + ], + "properties": { + "api_key": { + "description": "Setting `api_key` for Apollo.", + "type": "string" + }, + "graph_ref": { + "description": "Setting `graph_ref` for Apollo in the format @.", + "type": "string" + }, + "platform": { + "description": "Setting `platform` for Apollo.", + "default": "platform", + "type": "string" + }, + "user_version": { + "description": "Setting `userVersion` for Apollo.", + "default": "1.0", + "type": "string" + }, + "version": { + "description": "Setting `version` for Apollo.", + "default": "1.0", + "type": "string" + } + } + }, "Arg": { "type": "object", "required": [ @@ -1688,6 +1720,18 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "apollo" + ], + "properties": { + "apollo": { + "$ref": "#/definitions/Apollo" + } + }, + "additionalProperties": false } ] }, diff --git a/src/app_context.rs b/src/app_context.rs index f98e99b40c..d42cb29191 100644 --- a/src/app_context.rs +++ b/src/app_context.rs @@ -4,7 +4,7 @@ use async_graphql::dynamic::{self, DynamicRequest}; use async_graphql::Response; use crate::blueprint::Type::ListType; -use crate::blueprint::{Blueprint, Definition}; +use crate::blueprint::{Blueprint, Definition, SchemaModifiers}; use crate::data_loader::DataLoader; use crate::graphql::GraphqlDataLoader; use crate::grpc; @@ -104,7 +104,8 @@ impl AppContext { } } - let schema = blueprint.to_schema(); + let schema = blueprint + .to_schema_with(SchemaModifiers::default().extensions(runtime.extensions.clone())); AppContext { schema, diff --git a/src/blueprint/blueprint.rs b/src/blueprint/blueprint.rs index 8b9c5e3078..6bc5ccd4d7 100644 --- a/src/blueprint/blueprint.rs +++ b/src/blueprint/blueprint.rs @@ -1,4 +1,5 @@ use std::collections::{BTreeSet, HashMap}; +use std::sync::Arc; use async_graphql::dynamic::{Schema, SchemaBuilder}; use async_graphql::extensions::ApolloTracing; @@ -11,6 +12,7 @@ use super::telemetry::Telemetry; use super::GlobalTimeout; use crate::blueprint::{Server, Upstream}; use crate::lambda::Expression; +use crate::schema_extension::SchemaExtension; /// Blueprint is an intermediary representation that allows us to generate /// graphQL APIs. It can only be generated from a valid Config. @@ -172,15 +174,18 @@ pub struct UnionTypeDefinition { /// /// Controls the kind of blueprint that is generated. -#[derive(Copy, Clone, Debug, Default)] +#[derive(Clone, Default, Setters)] pub struct SchemaModifiers { /// If true, the generated schema will not have any resolvers. pub no_resolver: bool, + /// List of extensions to add to the schema. + pub extensions: Arc>, } impl SchemaModifiers { - pub fn no_resolver() -> Self { - Self { no_resolver: true } + pub fn with_no_resolver(mut self) -> Self { + self.no_resolver = true; + self } } @@ -244,6 +249,10 @@ impl Blueprint { schema = schema.disable_introspection(); } + for extension in schema_modifiers.extensions.iter().cloned() { + schema = schema.extension(extension); + } + // We should safely assume the blueprint is correct and, // generation of schema cannot fail. schema.finish().unwrap() diff --git a/src/blueprint/operation.rs b/src/blueprint/operation.rs index d6ad61dc78..803b832fe9 100644 --- a/src/blueprint/operation.rs +++ b/src/blueprint/operation.rs @@ -48,7 +48,7 @@ pub async fn validate_operations( blueprint: &Blueprint, operations: Vec, ) -> Valid<(), String> { - let schema = blueprint.to_schema_with(SchemaModifiers::no_resolver()); + let schema = blueprint.to_schema_with(SchemaModifiers::default().with_no_resolver()); Valid::from_iter( futures_util::future::join_all(operations.iter().map(|op| op.validate(&schema))) .await diff --git a/src/blueprint/telemetry.rs b/src/blueprint/telemetry.rs index b6408eb020..5201a4d6b0 100644 --- a/src/blueprint/telemetry.rs +++ b/src/blueprint/telemetry.rs @@ -5,7 +5,7 @@ use hyper::HeaderMap; use url::Url; use super::TryFoldConfig; -use crate::config::{self, ConfigModule, KeyValues, PrometheusExporter, StdoutExporter}; +use crate::config::{self, Apollo, ConfigModule, KeyValues, PrometheusExporter, StdoutExporter}; use crate::directive::DirectiveCodec; use crate::try_fold::TryFold; use crate::valid::{Valid, ValidationError, Validator}; @@ -21,6 +21,7 @@ pub enum TelemetryExporter { Stdout(StdoutExporter), Otlp(OtlpExporter), Prometheus(PrometheusExporter), + Apollo(Apollo), } #[derive(Debug, Default, Clone)] @@ -57,6 +58,8 @@ pub fn to_opentelemetry<'a>() -> TryFold<'a, ConfigModule, Telemetry, String> { config::TelemetryExporter::Prometheus(config) => { Valid::succeed(TelemetryExporter::Prometheus(config.clone())) } + config::TelemetryExporter::Apollo(apollo) => validate_apollo(apollo.clone()) + .and_then(|apollo| Valid::succeed(TelemetryExporter::Apollo(apollo))), }; export @@ -67,3 +70,49 @@ pub fn to_opentelemetry<'a>() -> TryFold<'a, ConfigModule, Telemetry, String> { } }) } + +fn validate_apollo(apollo: Apollo) -> Valid { + validate_graph_ref(&apollo.graph_ref) + .map(|_| apollo) + .trace("apollo.graph_ref") +} + +fn validate_graph_ref(graph_ref: &str) -> Valid<(), String> { + let is_valid = regex::Regex::new(r"^[A-Za-z0-9-_]+@[A-Za-z0-9-_]+$") + .unwrap() + .is_match(graph_ref); + if is_valid { + Valid::succeed(()) + } else { + Valid::fail(format!("`graph_ref` should be in the format @ where `graph_id` and `variant` can only contain letters, numbers, '-' and '_'. Found {graph_ref}").to_string()) + } +} + +#[cfg(test)] +mod tests { + use super::validate_graph_ref; + use crate::valid::Valid; + + #[test] + fn test_validate_graph_ref() { + let success = || Valid::succeed(()); + let failure = |graph_ref| { + Valid::fail(format!("`graph_ref` should be in the format @ where `graph_id` and `variant` can only contain letters, numbers, '-' and '_'. Found {graph_ref}").to_string()) + }; + + assert_eq!(validate_graph_ref("graph_id@variant"), success()); + assert_eq!( + validate_graph_ref("gr@ph_id@variant"), + failure("gr@ph_id@variant") + ); + assert_eq!(validate_graph_ref("graph-Id@variant"), success()); + assert_eq!( + validate_graph_ref("graph$id@variant1"), + failure("graph$id@variant1") + ); + assert_eq!( + validate_graph_ref("gr@ph_id@variant"), + failure("gr@ph_id@variant") + ); + } +} diff --git a/src/cli/runtime/mod.rs b/src/cli/runtime/mod.rs index beae3e4ba1..a0e484d61d 100644 --- a/src/cli/runtime/mod.rs +++ b/src/cli/runtime/mod.rs @@ -56,5 +56,6 @@ pub fn init(upstream: &Upstream, script: Option) -> TargetRun env: init_env(), file: init_file(), cache: Arc::new(init_in_memory_cache()), + extensions: Arc::new(vec![]), } } diff --git a/src/cli/server/server_config.rs b/src/cli/server/server_config.rs index 832b04fdb0..06163f86fc 100644 --- a/src/cli/server/server_config.rs +++ b/src/cli/server/server_config.rs @@ -1,10 +1,14 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::Arc; +use async_graphql_extension_apollo_tracing::ApolloTracing; + +use crate::blueprint::telemetry::TelemetryExporter; use crate::blueprint::{Blueprint, Http}; use crate::cli::runtime::init; use crate::http::AppContext; use crate::rest::EndpointSet; +use crate::schema_extension::SchemaExtension; pub struct ServerConfig { pub blueprint: Blueprint, @@ -13,11 +17,23 @@ pub struct ServerConfig { impl ServerConfig { pub fn new(blueprint: Blueprint, endpoints: EndpointSet) -> Self { - let server_context = Arc::new(AppContext::new( - blueprint.clone(), - init(&blueprint.upstream, blueprint.server.script.clone()), - endpoints, - )); + let mut rt = init(&blueprint.upstream, blueprint.server.script.clone()); + + let mut extensions = vec![]; + + if let Some(TelemetryExporter::Apollo(apollo)) = blueprint.opentelemetry.export.as_ref() { + let (graph_id, variant) = apollo.graph_ref.split_once('@').unwrap(); + extensions.push(SchemaExtension::new(ApolloTracing::new( + apollo.api_key.clone(), + apollo.platform.clone(), + graph_id.to_string(), + variant.to_string(), + apollo.version.clone(), + ))); + } + rt.add_extensions(extensions); + + let server_context = Arc::new(AppContext::new(blueprint.clone(), rt, endpoints)); Self { app_ctx: server_context, blueprint } } diff --git a/src/cli/telemetry.rs b/src/cli/telemetry.rs index ffbcd9d9c3..8dfd88562c 100644 --- a/src/cli/telemetry.rs +++ b/src/cli/telemetry.rs @@ -89,6 +89,7 @@ fn set_trace_provider( ))?, // Prometheus works only with metrics TelemetryExporter::Prometheus(_) => return Ok(None), + TelemetryExporter::Apollo(_) => return Ok(None), }; let tracer = provider.tracer("tracing"); let telemetry = tracing_opentelemetry::layer().with_tracer(tracer); @@ -128,6 +129,7 @@ fn set_logger_provider( , // Prometheus works only with metrics TelemetryExporter::Prometheus(_) => return Ok(None), + TelemetryExporter::Apollo(_) => return Ok(None), }; let otel_tracing_appender = OpenTelemetryTracingBridge::new(&provider); @@ -171,6 +173,7 @@ fn set_meter_provider(exporter: &TelemetryExporter) -> MetricsResult<()> { .with_reader(exporter) .build() } + _ => return Ok(()), }; global::set_meter_provider(provider); diff --git a/src/config/apollo.rs b/src/config/apollo.rs new file mode 100644 index 0000000000..04a5792fff --- /dev/null +++ b/src/config/apollo.rs @@ -0,0 +1,61 @@ +use serde::{Deserialize, Serialize}; + +use crate::config::ConfigReaderContext; +use crate::mustache::Mustache; + +#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, schemars::JsonSchema)] +pub struct Apollo { + /// + /// Setting `api_key` for Apollo. + pub api_key: String, + /// + /// Setting `graph_ref` for Apollo in the format @. + pub graph_ref: String, + /// + /// Setting `userVersion` for Apollo. + #[serde(default = "default_user_version")] + pub user_version: String, + /// + /// Setting `platform` for Apollo. + #[serde(default = "default_platform")] + pub platform: String, + /// + /// Setting `version` for Apollo. + #[serde(default = "default_version")] + pub version: String, +} + +fn default_user_version() -> String { + "1.0".to_string() +} + +fn default_platform() -> String { + "platform".to_string() +} + +fn default_version() -> String { + "1.0".to_string() +} + +impl Apollo { + pub fn render_mustache(&mut self, reader_ctx: &ConfigReaderContext) -> anyhow::Result<()> { + let Apollo { api_key, graph_ref, user_version, platform, version } = self; + + let api_key_tmpl = Mustache::parse(api_key)?; + *api_key = api_key_tmpl.render(reader_ctx); + + let graph_ref_tmpl = Mustache::parse(graph_ref)?; + *graph_ref = graph_ref_tmpl.render(reader_ctx); + + let user_version_tmpl = Mustache::parse(user_version)?; + *user_version = user_version_tmpl.render(reader_ctx); + + let platform_tmpl = Mustache::parse(platform)?; + *platform = platform_tmpl.render(reader_ctx); + + let version_tmpl = Mustache::parse(version)?; + *version = version_tmpl.render(reader_ctx); + + Ok(()) + } +} diff --git a/src/config/mod.rs b/src/config/mod.rs index 59eb2b6586..20b0191e2c 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1,3 +1,4 @@ +pub use apollo::*; pub use config::*; pub use config_module::*; pub use expr::*; @@ -8,6 +9,7 @@ pub use server::*; pub use source::*; pub use telemetry::*; pub use upstream::*; +mod apollo; mod config; mod config_module; mod expr; diff --git a/src/config/telemetry.rs b/src/config/telemetry.rs index 055e242f78..85c0d25982 100644 --- a/src/config/telemetry.rs +++ b/src/config/telemetry.rs @@ -2,7 +2,7 @@ use anyhow::Result; use serde::{Deserialize, Serialize}; use super::KeyValues; -use crate::config::ConfigReaderContext; +use crate::config::{Apollo, ConfigReaderContext}; use crate::helpers::headers::to_mustache_headers; use crate::is_default; use crate::mustache::Mustache; @@ -83,6 +83,7 @@ pub enum TelemetryExporter { Stdout(StdoutExporter), Otlp(OtlpExporter), Prometheus(PrometheusExporter), + Apollo(Apollo), } impl TelemetryExporter { @@ -125,15 +126,19 @@ impl Telemetry { } pub fn render_mustache(&mut self, reader_ctx: &ConfigReaderContext) -> Result<()> { - if let Some(TelemetryExporter::Otlp(otlp)) = &mut self.export { - let url_tmpl = Mustache::parse(&otlp.url)?; - otlp.url = url_tmpl.render(reader_ctx); - - let headers = to_mustache_headers(&otlp.headers).to_result()?; - otlp.headers = headers - .into_iter() - .map(|(key, tmpl)| (key.as_str().to_owned(), tmpl.render(reader_ctx))) - .collect(); + match &mut self.export { + Some(TelemetryExporter::Otlp(otlp)) => { + let url_tmpl = Mustache::parse(&otlp.url)?; + otlp.url = url_tmpl.render(reader_ctx); + + let headers = to_mustache_headers(&otlp.headers).to_result()?; + otlp.headers = headers + .into_iter() + .map(|(key, tmpl)| (key.as_str().to_owned(), tmpl.render(reader_ctx))) + .collect(); + } + Some(TelemetryExporter::Apollo(apollo)) => apollo.render_mustache(reader_ctx)?, + _ => {} } Ok(()) diff --git a/src/lib.rs b/src/lib.rs index 5091cfb163..bd8e858b66 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,7 @@ pub mod print_schema; mod rest; pub mod runtime; pub mod scalar; +mod schema_extension; mod serde_value_ext; pub mod tracing; pub mod try_fold; diff --git a/src/runtime.rs b/src/runtime.rs index 5d39ae15c2..45b5ee0f73 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -2,6 +2,7 @@ use std::sync::Arc; use async_graphql_value::ConstValue; +use crate::schema_extension::SchemaExtension; use crate::{Cache, EnvIO, FileIO, HttpIO}; /// The TargetRuntime struct unifies the available runtime-specific @@ -9,11 +10,28 @@ use crate::{Cache, EnvIO, FileIO, HttpIO}; /// over the codebase. #[derive(Clone)] pub struct TargetRuntime { + /// HTTP client for making standard HTTP requests. pub http: Arc, + /// HTTP client optimized for HTTP/2 requests. pub http2_only: Arc, + /// Interface for accessing environment variables specific to the target + /// environment. pub env: Arc, + /// Interface for file operations, tailored to the target environment's + /// capabilities. pub file: Arc, + /// Cache for storing and retrieving entity data, improving performance and + /// reducing external calls. pub cache: Arc>, + /// A list of extensions that can be used to extend the runtime's + /// functionality or integrate additional features. + pub extensions: Arc>, +} + +impl TargetRuntime { + pub fn add_extensions(&mut self, extensions: Vec) { + self.extensions = Arc::new(extensions); + } } #[cfg(test)] @@ -165,6 +183,7 @@ pub mod test { env: Arc::new(env), file: Arc::new(file), cache: Arc::new(InMemoryCache::new()), + extensions: Arc::new(vec![]), } } } diff --git a/src/schema_extension.rs b/src/schema_extension.rs new file mode 100644 index 0000000000..0dadb6beb0 --- /dev/null +++ b/src/schema_extension.rs @@ -0,0 +1,18 @@ +use std::sync::Arc; + +use async_graphql::extensions::{Extension, ExtensionFactory}; + +#[derive(Clone)] +pub struct SchemaExtension(Arc); + +impl SchemaExtension { + pub fn new(extension_factory: impl ExtensionFactory) -> Self { + Self(Arc::new(extension_factory)) + } +} + +impl ExtensionFactory for SchemaExtension { + fn create(&self) -> Arc { + self.0.create() + } +} diff --git a/tests/execution/apollo-tracing.md b/tests/execution/apollo-tracing.md new file mode 100644 index 0000000000..f76ae13cb0 --- /dev/null +++ b/tests/execution/apollo-tracing.md @@ -0,0 +1,36 @@ +# Apollo Tracing + +#### server: + +```graphql +schema + @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @telemetry(export: {apollo: {api_key: "", graph_ref: "tailcall-demo-3@current"}}) { + query: Query +} + +type Query { + hello: String! @http(path: "/", baseURL: "http://api.com") +} +``` + +#### mock: + +```yml +- request: + method: GET + url: http://api.com + body: null + response: + status: 200 + body: hello +``` + +#### assert: + +```yml +- method: POST + url: http://localhost:8000/graphql + body: + query: query { hello } +``` diff --git a/tests/execution_spec.rs b/tests/execution_spec.rs index 4294b167d6..9c102809ba 100644 --- a/tests/execution_spec.rs +++ b/tests/execution_spec.rs @@ -184,6 +184,7 @@ pub mod test { env: Arc::new(env), file: Arc::new(file), cache: Arc::new(InMemoryCache::new()), + extensions: Arc::new(vec![]), } } } @@ -618,6 +619,7 @@ impl ExecutionSpec { file: Arc::new(MockFileSystem::new(self.clone())), env: Arc::new(Env::init(env)), cache: Arc::new(InMemoryCache::new()), + extensions: Arc::new(vec![]), }; // TODO: move inside tailcall core if possible diff --git a/tests/server_spec.rs b/tests/server_spec.rs index 2fccfd6cfd..931bb14654 100644 --- a/tests/server_spec.rs +++ b/tests/server_spec.rs @@ -149,6 +149,7 @@ pub mod test { env: Arc::new(env), file: Arc::new(file), cache: Arc::new(InMemoryCache::new()), + extensions: Arc::new(vec![]), } } } @@ -177,6 +178,7 @@ mod server_spec { // required since our cert is self signed let client = Client::builder() + .use_rustls_tls() .danger_accept_invalid_certs(true) .build() .unwrap(); diff --git a/tests/snapshots/execution_spec__apollo-tracing.md_assert_0.snap b/tests/snapshots/execution_spec__apollo-tracing.md_assert_0.snap new file mode 100644 index 0000000000..d79142407b --- /dev/null +++ b/tests/snapshots/execution_spec__apollo-tracing.md_assert_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/execution_spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "hello": "hello" + } + } +} diff --git a/tests/snapshots/execution_spec__apollo-tracing.md_client.snap b/tests/snapshots/execution_spec__apollo-tracing.md_client.snap new file mode 100644 index 0000000000..41980329df --- /dev/null +++ b/tests/snapshots/execution_spec__apollo-tracing.md_client.snap @@ -0,0 +1,11 @@ +--- +source: tests/execution_spec.rs +expression: client +--- +type Query { + hello: String! +} + +schema { + query: Query +} diff --git a/tests/snapshots/execution_spec__apollo-tracing.md_merged.snap b/tests/snapshots/execution_spec__apollo-tracing.md_merged.snap new file mode 100644 index 0000000000..b21a8ec737 --- /dev/null +++ b/tests/snapshots/execution_spec__apollo-tracing.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/execution_spec.rs +expression: merged +--- +schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream { + query: Query +} + +type Query { + hello: String! @http(baseURL: "http://api.com", path: "/") +}