From 03154f4acb14b398f2819c00ead72185e88f5ba5 Mon Sep 17 00:00:00 2001 From: Fletcher Nichol Date: Wed, 10 Jan 2024 15:45:22 -0700 Subject: [PATCH] feat(sdf,telemetry): add INFO level tracing span for every request This change introduces a new crate `telemetry-http` that implements a `tower-http` trait (`MakeSpan`) which is used by SDF's axum every time it begins to process an inbound HTTP request. Signed-off-by: Fletcher Nichol --- Cargo.lock | 142 +++-------- Cargo.toml | 1 + lib/sdf-server/BUCK | 1 + lib/sdf-server/Cargo.toml | 1 + lib/sdf-server/src/server/server.rs | 64 +++-- lib/telemetry-http-rs/BUCK | 12 + lib/telemetry-http-rs/Cargo.toml | 12 + lib/telemetry-http-rs/src/lib.rs | 357 ++++++++++++++++++++++++++++ lib/telemetry-rs/src/lib.rs | 49 +++- third-party/rust/BUCK | 263 +++++--------------- third-party/rust/Cargo.lock | 131 +++------- 11 files changed, 588 insertions(+), 445 deletions(-) create mode 100644 lib/telemetry-http-rs/BUCK create mode 100644 lib/telemetry-http-rs/Cargo.toml create mode 100644 lib/telemetry-http-rs/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index b361a0e578..a42a9a86a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,7 +23,7 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "version_check", ] @@ -35,7 +35,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "version_check", "zerocopy", @@ -573,9 +573,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" dependencies = [ "borsh-derive", "cfg_aliases", @@ -583,9 +583,9 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" +checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" dependencies = [ "once_cell", "proc-macro-crate", @@ -903,15 +903,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.45.0", + "windows-sys 0.52.0", ] [[package]] @@ -935,7 +935,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "tiny-keccak", ] @@ -1762,7 +1762,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a667e6426df16c2ac478efa4a439d0e674cba769c5556e8cf221739251640c8c" dependencies = [ "ct-codecs", - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -2145,9 +2145,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "js-sys", @@ -2194,9 +2194,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" dependencies = [ "bytes 1.5.0", "fnv", @@ -3028,7 +3028,7 @@ dependencies = [ "data-encoding", "ed25519 2.2.3", "ed25519-dalek", - "getrandom 0.2.11", + "getrandom 0.2.12", "log", "rand 0.8.5", "signatory", @@ -3044,7 +3044,7 @@ dependencies = [ "data-encoding", "ed25519 2.2.3", "ed25519-dalek", - "getrandom 0.2.11", + "getrandom 0.2.12", "log", "rand 0.8.5", "signatory", @@ -3748,11 +3748,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" dependencies = [ - "toml_edit 0.20.7", + "toml_edit 0.21.0", ] [[package]] @@ -3928,7 +3928,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -3955,7 +3955,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "libredox", "thiserror", ] @@ -4127,7 +4127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", - "getrandom 0.2.11", + "getrandom 0.2.12", "libc", "spin 0.9.8", "untrusted", @@ -4430,6 +4430,7 @@ dependencies = [ "sodiumoxide", "strum", "telemetry", + "telemetry-http", "thiserror", "tokio", "tokio-tungstenite", @@ -5432,7 +5433,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbde97f499e51ef384f585dc8f8fb6a9c3a71b274b8d12469b516758e6540607" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "hmac-sha256", "hmac-sha512", "rand 0.8.5", @@ -5554,6 +5555,16 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "telemetry-http" +version = "0.1.0" +dependencies = [ + "hyper", + "remain", + "telemetry", + "tower-http", +] + [[package]] name = "tempfile" version = "3.9.0" @@ -5914,17 +5925,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.21.0" @@ -6259,7 +6259,7 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "serde", ] @@ -6543,15 +6543,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -6570,21 +6561,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-targets" version = "0.48.5" @@ -6615,12 +6591,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.0", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -6633,12 +6603,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -6651,12 +6615,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -6669,12 +6627,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -6687,12 +6639,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -6705,12 +6651,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -6723,12 +6663,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -6743,9 +6677,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.33" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 2790e8aba5..62a26a21e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,6 +38,7 @@ members = [ "lib/si-test-macros", "lib/si-posthog-rs", "lib/telemetry-application-rs", + "lib/telemetry-http-rs", "lib/telemetry-rs", "lib/veritech-client", "lib/veritech-core", diff --git a/lib/sdf-server/BUCK b/lib/sdf-server/BUCK index dd83bce885..efc51e055a 100644 --- a/lib/sdf-server/BUCK +++ b/lib/sdf-server/BUCK @@ -13,6 +13,7 @@ rust_library( "//lib/si-posthog-rs:si-posthog", "//lib/si-settings:si-settings", "//lib/si-std:si-std", + "//lib/telemetry-http-rs:telemetry-http", "//lib/telemetry-rs:telemetry", "//lib/veritech-client:veritech-client", "//third-party/rust:async-recursion", diff --git a/lib/sdf-server/Cargo.toml b/lib/sdf-server/Cargo.toml index b840bfaaf6..05f2ab7c10 100644 --- a/lib/sdf-server/Cargo.toml +++ b/lib/sdf-server/Cargo.toml @@ -39,6 +39,7 @@ si-std = { path = "../../lib/si-std" } sodiumoxide = { workspace = true } strum = { workspace = true } telemetry = { path = "../../lib/telemetry-rs" } +telemetry-http = { path = "../../lib/telemetry-http-rs" } thiserror = { workspace = true } tokio = { workspace = true } tokio-tungstenite = { workspace = true } diff --git a/lib/sdf-server/src/server/server.rs b/lib/sdf-server/src/server/server.rs index a73ca739c9..95b9459596 100644 --- a/lib/sdf-server/src/server/server.rs +++ b/lib/sdf-server/src/server/server.rs @@ -1,34 +1,25 @@ -use dal::jwt_key::JwtConfig; -use si_crypto::CryptoConfig; -use std::time::Duration; -use std::{io, net::SocketAddr, path::Path, path::PathBuf, sync::Arc}; - -use axum::routing::IntoMakeService; -use axum::Router; -use hyper::server::{accept::Accept, conn::AddrIncoming}; -use thiserror::Error; -use tokio::time::Instant; -use tokio::{ - io::{AsyncRead, AsyncWrite}, - signal, - sync::{broadcast, mpsc, oneshot}, - task::{JoinError, JoinSet}, - time, +use std::{ + io, + net::SocketAddr, + path::{Path, PathBuf}, + sync::Arc, + time::Duration, }; -use tower_http::trace::{DefaultMakeSpan, TraceLayer}; -use ulid::Ulid; -use dal::pkg::{import_pkg_from_pkg, ImportOptions, PkgError}; -use dal::tasks::{StatusReceiver, StatusReceiverError}; +use axum::{routing::IntoMakeService, Router}; use dal::{ - builtins, BuiltinsError, DalContext, JwtPublicSigningKey, Tenancy, TransactionsError, + builtins, + jwt_key::JwtConfig, + pkg::{import_pkg_from_pkg, ImportOptions, PkgError}, + tasks::{ResourceScheduler, StatusReceiver, StatusReceiverError}, + BuiltinsError, DalContext, JwtPublicSigningKey, ServicesContext, Tenancy, TransactionsError, Workspace, WorkspaceError, }; -use dal::{tasks::ResourceScheduler, ServicesContext}; -use module_index_client::types::BuiltinsDetailsResponse; -use module_index_client::{IndexClient, ModuleDetailsResponse}; +use hyper::server::{accept::Accept, conn::AddrIncoming}; +use module_index_client::{types::BuiltinsDetailsResponse, IndexClient, ModuleDetailsResponse}; use si_crypto::{ - CycloneKeyPairError, SymmetricCryptoError, SymmetricCryptoService, SymmetricCryptoServiceConfig, + CryptoConfig, CycloneKeyPairError, SymmetricCryptoError, SymmetricCryptoService, + SymmetricCryptoServiceConfig, }; use si_data_nats::{NatsClient, NatsConfig, NatsError}; use si_data_pg::{PgError, PgPool, PgPoolConfig, PgPoolError}; @@ -36,12 +27,24 @@ use si_pkg::{SiPkg, SiPkgError}; use si_posthog::{PosthogClient, PosthogConfig}; use si_std::SensitiveString; use telemetry::prelude::*; +use telemetry_http::HttpMakeSpan; +use thiserror::Error; +use tokio::{ + io::{AsyncRead, AsyncWrite}, + signal, + sync::{broadcast, mpsc, oneshot}, + task::{JoinError, JoinSet}, + time::{self, Instant}, +}; +use tower_http::trace::TraceLayer; +use ulid::Ulid; use veritech_client::{Client as VeritechClient, CycloneEncryptionKey, CycloneEncryptionKeyError}; use crate::server::config::CycloneKeyPair; -use super::state::AppState; -use super::{routes, Config, IncomingStream, UdsIncomingStream, UdsIncomingStreamError}; +use super::{ + routes, state::AppState, Config, IncomingStream, UdsIncomingStream, UdsIncomingStreamError, +}; #[remain::sorted] #[derive(Debug, Error)] @@ -480,12 +483,7 @@ fn build_service_inner( ); let routes = routes(state) - // TODO(fnichol): customize http tracing further, using: - // https://docs.rs/tower-http/0.1.1/tower_http/trace/index.html - .layer( - TraceLayer::new_for_http() - .make_span_with(DefaultMakeSpan::default().include_headers(true)), - ); + .layer(TraceLayer::new_for_http().make_span_with(HttpMakeSpan::new().level(Level::INFO))); let graceful_shutdown_rx = prepare_graceful_shutdown(shutdown_rx, shutdown_broadcast_tx)?; diff --git a/lib/telemetry-http-rs/BUCK b/lib/telemetry-http-rs/BUCK new file mode 100644 index 0000000000..3b53833b3e --- /dev/null +++ b/lib/telemetry-http-rs/BUCK @@ -0,0 +1,12 @@ +load("@prelude-si//:macros.bzl", "rust_library") + +rust_library( + name = "telemetry-http", + deps = [ + "//lib/telemetry-rs:telemetry", + "//third-party/rust:hyper", + "//third-party/rust:remain", + "//third-party/rust:tower-http", + ], + srcs = glob(["src/**/*.rs"]), +) diff --git a/lib/telemetry-http-rs/Cargo.toml b/lib/telemetry-http-rs/Cargo.toml new file mode 100644 index 0000000000..bb7babaf57 --- /dev/null +++ b/lib/telemetry-http-rs/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "telemetry-http" +version = "0.1.0" +edition = "2021" +rust-version = "1.64" +publish = false + +[dependencies] +hyper = { workspace = true } +remain = { workspace = true } +telemetry = { path = "../../lib/telemetry-rs" } +tower-http = { workspace = true } diff --git a/lib/telemetry-http-rs/src/lib.rs b/lib/telemetry-http-rs/src/lib.rs new file mode 100644 index 0000000000..ded514f963 --- /dev/null +++ b/lib/telemetry-http-rs/src/lib.rs @@ -0,0 +1,357 @@ +//! Telemetry support for running HTTP-related services. + +#![warn( + clippy::unwrap_in_result, + clippy::indexing_slicing, + clippy::arithmetic_side_effects, + clippy::unwrap_used, + clippy::panic, + clippy::missing_panics_doc, + clippy::panic_in_result_fn, + missing_docs +)] + +use hyper::header::USER_AGENT; +use telemetry::prelude::*; +use tower_http::trace::MakeSpan; + +/// An implementation of [`MakeSpan`] to generate [`Span`]s from incoming HTTP requests. +#[derive(Clone, Debug)] +pub struct HttpMakeSpan { + level: Level, + + // See: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#common-attributes + network_protocol_name: &'static str, + network_transport: NetworkTransport, +} + +impl HttpMakeSpan { + /// Creates a new `HttpMakeSpan`. + pub fn new() -> Self { + Self::default() + } + + /// Sets the [`Level`] used for the tracing [`Span`]. + pub fn level(mut self, level: Level) -> Self { + self.level = level; + self + } + + /// Sets the network [protocol name] to be used in span metadata. + /// + /// Defaults to `"http"`. + /// + /// [protocol name]: https://opentelemetry.io/docs/specs/semconv/attributes-registry/network/ + pub fn network_protocol_name(mut self, s: &'static str) -> Self { + self.network_protocol_name = s; + self + } + + /// Sets the network [protocol version] to be used in span metadata. + /// + /// Defaults to `tcp`. + /// + /// [protocol version]: https://opentelemetry.io/docs/specs/semconv/attributes-registry/network/ + pub fn network_transport(mut self, nt: NetworkTransport) -> Self { + self.network_transport = nt; + self + } + + fn span_from_request(&mut self, request: &hyper::Request) -> Span { + #[derive(Clone, Copy, Debug)] + enum InnerMethod { + Options, + Get, + Post, + Put, + Delete, + Head, + Trace, + Connect, + Patch, + Other, + } + impl From<&str> for InnerMethod { + fn from(value: &str) -> Self { + match value { + "OPTIONS" => Self::Options, + "GET" => Self::Get, + "POST" => Self::Post, + "PUT" => Self::Put, + "DELETE" => Self::Delete, + "HEAD" => Self::Head, + "TRACE" => Self::Trace, + "CONNECT" => Self::Connect, + "PATCH" => Self::Patch, + _ => Self::Other, + } + } + } + impl InnerMethod { + fn as_str(&self) -> &'static str { + match self { + Self::Options => "OPTIONS", + Self::Get => "GET", + Self::Post => "POST", + Self::Put => "PUT", + Self::Delete => "DELETE", + Self::Head => "HEAD", + Self::Trace => "TRACE", + Self::Connect => "CONNECT", + Self::Patch => "PATCH", + // > If the HTTP request method is not known to instrumentation, it MUST set + // > the http.request.method attribute to _OTHER. + // + // See: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#common-attributes + Self::Other => "_OTHER", + } + } + } + + enum InnerLevel { + Error, + Warn, + Info, + Debug, + Trace, + } + impl From for InnerLevel { + fn from(value: Level) -> Self { + match value { + Level::ERROR => InnerLevel::Error, + Level::WARN => InnerLevel::Warn, + Level::INFO => InnerLevel::Info, + Level::DEBUG => InnerLevel::Debug, + _ => InnerLevel::Trace, + } + } + } + + let uri = request.uri(); + + let http_request_method = InnerMethod::from(request.method().as_str()); + let network_protocol_version = HttpVersion::from(request.version()); + + // This ugly macro is needed, unfortunately, because `tracing::span!` required the level + // argument to be static. Meaning we can't just pass `self.level` and a dynamic name. + macro_rules! inner { + ($level:expr, $name:expr) => { + ::telemetry::tracing::span!( + $level, + $name, + + // Common HTTP attributes + // + // See: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#common-attributes + + http.request.method = http_request_method.as_str(), + // http.response.header. + http.response.status_code = Empty, + // network.peer.address = Empty, + // network.peer.port = Empty, + network.protocol.name = self.network_protocol_name, + network.protocol.version = network_protocol_version.as_str(), + network.transport = self.network_transport.as_str(), + + // HTTP Server semantic conventions + // + // See: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#http-server + + // client.address = Empty, + // client.port = Empty, + // http.request.header. + // network.local.address = Empty, + // network.local.port = Empty, + // server.address = Empty, + // server.port = Empty, + url.path = uri.path(), + url.query = uri.query(), + url.scheme = Empty, + user_agent.original = Empty, + + // Set special `otel.*` fields which tracing-opentelemetry will use when + // transmitting traces via OpenTelemetry protocol + // + // See: + // https://docs.rs/tracing-opentelemetry/0.22.0/tracing_opentelemetry/#special-fields + // + + otel.kind = SpanKind::Server.as_str(), + // TODO(fnichol): would love this to be "{method} {route}" but should limit + // detail in route to preserve low cardinality. + // + // See: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#method-placeholder + // See: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#name + otel.name = $name, + // Default for OpenTelemetry status is `Unset` which should map to an empty/unset + // tracing value. + // + // See: https://docs.rs/opentelemetry/0.21.0/opentelemetry/trace/enum.Status.html + otel.status_code = Empty, + // Only set if status_code == Error + otel.status_message = Empty, + ) + }; + } + + let span = match (InnerLevel::from(self.level), http_request_method) { + (InnerLevel::Error, InnerMethod::Options) => inner!(Level::ERROR, "OPTIONS"), + (InnerLevel::Error, InnerMethod::Get) => inner!(Level::ERROR, "GET"), + (InnerLevel::Error, InnerMethod::Post) => inner!(Level::ERROR, "POST"), + (InnerLevel::Error, InnerMethod::Put) => inner!(Level::ERROR, "PUT"), + (InnerLevel::Error, InnerMethod::Delete) => inner!(Level::ERROR, "DELETE"), + (InnerLevel::Error, InnerMethod::Head) => inner!(Level::ERROR, "HEAD"), + (InnerLevel::Error, InnerMethod::Trace) => inner!(Level::ERROR, "TRACE"), + (InnerLevel::Error, InnerMethod::Connect) => inner!(Level::ERROR, "CONNECT"), + (InnerLevel::Error, InnerMethod::Patch) => inner!(Level::ERROR, "PATCH"), + (InnerLevel::Error, InnerMethod::Other) => inner!(Level::ERROR, "HTTP"), + (InnerLevel::Warn, InnerMethod::Options) => inner!(Level::WARN, "OPTIONS"), + (InnerLevel::Warn, InnerMethod::Get) => inner!(Level::WARN, "GET"), + (InnerLevel::Warn, InnerMethod::Post) => inner!(Level::WARN, "POST"), + (InnerLevel::Warn, InnerMethod::Put) => inner!(Level::WARN, "PUT"), + (InnerLevel::Warn, InnerMethod::Delete) => inner!(Level::WARN, "DELETE"), + (InnerLevel::Warn, InnerMethod::Head) => inner!(Level::WARN, "HEAD"), + (InnerLevel::Warn, InnerMethod::Trace) => inner!(Level::WARN, "TRACE"), + (InnerLevel::Warn, InnerMethod::Connect) => inner!(Level::WARN, "CONNECT"), + (InnerLevel::Warn, InnerMethod::Patch) => inner!(Level::WARN, "PATCH"), + (InnerLevel::Warn, InnerMethod::Other) => inner!(Level::WARN, "HTTP"), + (InnerLevel::Info, InnerMethod::Options) => inner!(Level::INFO, "OPTIONS"), + (InnerLevel::Info, InnerMethod::Get) => inner!(Level::INFO, "GET"), + (InnerLevel::Info, InnerMethod::Post) => inner!(Level::INFO, "POST"), + (InnerLevel::Info, InnerMethod::Put) => inner!(Level::INFO, "PUT"), + (InnerLevel::Info, InnerMethod::Delete) => inner!(Level::INFO, "DELETE"), + (InnerLevel::Info, InnerMethod::Head) => inner!(Level::INFO, "HEAD"), + (InnerLevel::Info, InnerMethod::Trace) => inner!(Level::INFO, "TRACE"), + (InnerLevel::Info, InnerMethod::Connect) => inner!(Level::INFO, "CONNECT"), + (InnerLevel::Info, InnerMethod::Patch) => inner!(Level::INFO, "PATCH"), + (InnerLevel::Info, InnerMethod::Other) => inner!(Level::INFO, "HTTP"), + (InnerLevel::Debug, InnerMethod::Options) => inner!(Level::DEBUG, "OPTIONS"), + (InnerLevel::Debug, InnerMethod::Get) => inner!(Level::DEBUG, "GET"), + (InnerLevel::Debug, InnerMethod::Post) => inner!(Level::DEBUG, "POST"), + (InnerLevel::Debug, InnerMethod::Put) => inner!(Level::DEBUG, "PUT"), + (InnerLevel::Debug, InnerMethod::Delete) => inner!(Level::DEBUG, "DELETE"), + (InnerLevel::Debug, InnerMethod::Head) => inner!(Level::DEBUG, "HEAD"), + (InnerLevel::Debug, InnerMethod::Trace) => inner!(Level::DEBUG, "TRACE"), + (InnerLevel::Debug, InnerMethod::Connect) => inner!(Level::DEBUG, "CONNECT"), + (InnerLevel::Debug, InnerMethod::Patch) => inner!(Level::DEBUG, "PATCH"), + (InnerLevel::Debug, InnerMethod::Other) => inner!(Level::DEBUG, "HTTP"), + (InnerLevel::Trace, InnerMethod::Options) => inner!(Level::TRACE, "OPTIONS"), + (InnerLevel::Trace, InnerMethod::Get) => inner!(Level::TRACE, "GET"), + (InnerLevel::Trace, InnerMethod::Post) => inner!(Level::TRACE, "POST"), + (InnerLevel::Trace, InnerMethod::Put) => inner!(Level::TRACE, "PUT"), + (InnerLevel::Trace, InnerMethod::Delete) => inner!(Level::TRACE, "DELETE"), + (InnerLevel::Trace, InnerMethod::Head) => inner!(Level::TRACE, "HEAD"), + (InnerLevel::Trace, InnerMethod::Trace) => inner!(Level::TRACE, "TRACE"), + (InnerLevel::Trace, InnerMethod::Connect) => inner!(Level::TRACE, "CONNECT"), + (InnerLevel::Trace, InnerMethod::Patch) => inner!(Level::TRACE, "PATCH"), + (InnerLevel::Trace, InnerMethod::Other) => inner!(Level::TRACE, "HTTP"), + }; + + if let Some(url_scheme) = uri.scheme() { + span.record("url.scheme", url_scheme.as_str()); + } + if let Some(user_agent_original) = request.headers().get(USER_AGENT) { + span.record( + "user_agent.original", + user_agent_original.to_str().unwrap_or("invalid-ascii"), + ); + } + + span + } +} + +impl Default for HttpMakeSpan { + #[inline] + fn default() -> Self { + Self { + level: Level::INFO, + network_protocol_name: "http", + network_transport: NetworkTransport::default(), + } + } +} + +impl MakeSpan for HttpMakeSpan { + fn make_span(&mut self, request: &hyper::Request) -> Span { + self.span_from_request(request) + } +} + +/// Represents the [OSI transport layer] as described in the OpenTelemetry [network] specification. +/// +/// [network]: https://opentelemetry.io/docs/specs/semconv/attributes-registry/network/ +/// [OSI transport layer]: https://osi-model.com/transport-layer/ +#[remain::sorted] +#[derive(Clone, Copy, Debug)] +pub enum NetworkTransport { + /// Named or anonymous pipe + Pipe, + /// TCP + Tcp, + /// UDP + Udp, + /// Unix domain socket + Unix, +} + +impl NetworkTransport { + fn as_str(&self) -> &'static str { + match self { + Self::Pipe => "pipe", + Self::Tcp => "tcp", + Self::Udp => "udp", + Self::Unix => "unix", + } + } +} + +impl Default for NetworkTransport { + #[inline] + fn default() -> Self { + Self::Tcp + } +} + +#[derive(Clone, Copy, Debug)] +enum HttpVersion { + Http09, + Http10, + Http11, + Http2, + Http3, + Unknown, +} + +impl Default for HttpVersion { + #[inline] + fn default() -> Self { + Self::Http11 + } +} + +impl From for HttpVersion { + fn from(value: hyper::Version) -> Self { + match value { + hyper::Version::HTTP_09 => Self::Http09, + hyper::Version::HTTP_10 => Self::Http10, + hyper::Version::HTTP_11 => Self::Http11, + hyper::Version::HTTP_2 => Self::Http2, + hyper::Version::HTTP_3 => Self::Http3, + _ => Self::Unknown, + } + } +} + +impl HttpVersion { + fn as_str(&self) -> &'static str { + match self { + Self::Http09 => "0.9", + Self::Http10 => "1.0", + Self::Http11 => "1.1", + Self::Http2 => "2", + Self::Http3 => "3", + Self::Unknown => "_UNKNOWN", + } + } +} diff --git a/lib/telemetry-rs/src/lib.rs b/lib/telemetry-rs/src/lib.rs index fc4a6c1054..5ed69b804e 100644 --- a/lib/telemetry-rs/src/lib.rs +++ b/lib/telemetry-rs/src/lib.rs @@ -8,7 +8,12 @@ // TODO(fnichol): document all, then drop `missing_errors_doc` #![allow(clippy::missing_errors_doc)] -use std::{borrow::Cow, env, result::Result}; +use std::{ + borrow::Cow, + env, + fmt::{Debug, Display}, + result::Result, +}; use async_trait::async_trait; use thiserror::Error; @@ -26,6 +31,26 @@ pub mod prelude { }; } +#[remain::sorted] +#[derive(Clone, Copy, Debug)] +enum StatusCode { + Error, + Ok, + // Unset is not currently used, although represents a valid state. + #[allow(dead_code)] + Unset, +} + +impl StatusCode { + fn as_str(&self) -> &'static str { + match self { + Self::Error => "ERROR", + Self::Ok => "OK", + Self::Unset => "", + } + } +} + /// An extention trait for [`SpanKind`] providing string representations. pub trait SpanKindExt { /// Returns a static str representation. @@ -53,19 +78,33 @@ pub trait SpanExt { fn record_ok(&self); fn record_err(&self, err: E) -> E where - E: std::error::Error; + E: Debug + Display; + + // fn record_status(&self, f: F) -> std::result::Result + // where + // F: Fn() -> std::result::Result, + // E: Debug + Display, + // { + // match f() { + // Ok(ok) => { + // self.record_ok(); + // Ok(ok) + // } + // Err(err) => Err(self.record_err(err)), + // } + // } } impl SpanExt for tracing::Span { fn record_ok(&self) { - self.record("otel.status_code", "OK"); + self.record("otel.status_code", StatusCode::Ok.as_str()); } fn record_err(&self, err: E) -> E where - E: std::error::Error, + E: Debug + Display, { - self.record("otel.status_code", "ERROR"); + self.record("otel.status_code", StatusCode::Error.as_str()); self.record("otel.status_message", err.to_string().as_str()); err } diff --git a/third-party/rust/BUCK b/third-party/rust/BUCK index d9d19d738e..3b6e7404a2 100644 --- a/third-party/rust/BUCK +++ b/third-party/rust/BUCK @@ -90,37 +90,37 @@ cargo.rust_library( platform = { "linux-arm64": dict( deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":once_cell-1.19.0", ], ), "linux-x86_64": dict( deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":once_cell-1.19.0", ], ), "macos-arm64": dict( deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":once_cell-1.19.0", ], ), "macos-x86_64": dict( deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":once_cell-1.19.0", ], ), "windows-gnu": dict( deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":once_cell-1.19.0", ], ), "windows-msvc": dict( deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":once_cell-1.19.0", ], ), @@ -172,7 +172,7 @@ cargo.rust_library( visibility = [], deps = [ ":cfg-if-1.0.0", - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":version_check-0.9.4", ":zerocopy-0.7.32", ], @@ -2151,7 +2151,7 @@ cargo.rust_library( }, visibility = [], deps = [ - ":console-0.15.7", + ":console-0.15.8", ":strum-0.25.0", ":strum_macros-0.25.3", ":unicode-width-0.1.11", @@ -2192,23 +2192,23 @@ cargo.rust_library( alias( name = "console", - actual = ":console-0.15.7", + actual = ":console-0.15.8", visibility = ["PUBLIC"], ) http_archive( - name = "console-0.15.7.crate", - sha256 = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8", - strip_prefix = "console-0.15.7", - urls = ["https://crates.io/api/v1/crates/console/0.15.7/download"], + name = "console-0.15.8.crate", + sha256 = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb", + strip_prefix = "console-0.15.8", + urls = ["https://crates.io/api/v1/crates/console/0.15.8/download"], visibility = [], ) cargo.rust_library( - name = "console-0.15.7", - srcs = [":console-0.15.7.crate"], + name = "console-0.15.8", + srcs = [":console-0.15.8.crate"], crate = "console", - crate_root = "console-0.15.7.crate/src/lib.rs", + crate_root = "console-0.15.8.crate/src/lib.rs", edition = "2018", features = [ "ansi-parsing", @@ -2219,13 +2219,13 @@ cargo.rust_library( "windows-gnu": dict( deps = [ ":encode_unicode-0.3.6", - ":windows-sys-0.45.0", + ":windows-sys-0.52.0", ], ), "windows-msvc": dict( deps = [ ":encode_unicode-0.3.6", - ":windows-sys-0.45.0", + ":windows-sys-0.52.0", ], ), }, @@ -2289,7 +2289,7 @@ cargo.rust_library( proc_macro = True, visibility = [], deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":once_cell-1.19.0", ":tiny-keccak-2.0.2", ], @@ -3900,22 +3900,22 @@ cargo.rust_library( ], platform = { "linux-arm64": dict( - deps = [":getrandom-0.2.11"], + deps = [":getrandom-0.2.12"], ), "linux-x86_64": dict( - deps = [":getrandom-0.2.11"], + deps = [":getrandom-0.2.12"], ), "macos-arm64": dict( - deps = [":getrandom-0.2.11"], + deps = [":getrandom-0.2.12"], ), "macos-x86_64": dict( - deps = [":getrandom-0.2.11"], + deps = [":getrandom-0.2.12"], ), "windows-gnu": dict( - deps = [":getrandom-0.2.11"], + deps = [":getrandom-0.2.12"], ), "windows-msvc": dict( - deps = [":getrandom-0.2.11"], + deps = [":getrandom-0.2.12"], ), }, visibility = [], @@ -4924,18 +4924,18 @@ cargo.rust_library( ) http_archive( - name = "getrandom-0.2.11.crate", - sha256 = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f", - strip_prefix = "getrandom-0.2.11", - urls = ["https://crates.io/api/v1/crates/getrandom/0.2.11/download"], + name = "getrandom-0.2.12.crate", + sha256 = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5", + strip_prefix = "getrandom-0.2.12", + urls = ["https://crates.io/api/v1/crates/getrandom/0.2.12/download"], visibility = [], ) cargo.rust_library( - name = "getrandom-0.2.11", - srcs = [":getrandom-0.2.11.crate"], + name = "getrandom-0.2.12", + srcs = [":getrandom-0.2.12.crate"], crate = "getrandom", - crate_root = "getrandom-0.2.11.crate/src/lib.rs", + crate_root = "getrandom-0.2.12.crate/src/lib.rs", edition = "2018", features = [ "custom", @@ -5052,18 +5052,18 @@ cargo.rust_library( ) http_archive( - name = "h2-0.3.22.crate", - sha256 = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178", - strip_prefix = "h2-0.3.22", - urls = ["https://crates.io/api/v1/crates/h2/0.3.22/download"], + name = "h2-0.3.23.crate", + sha256 = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7", + strip_prefix = "h2-0.3.23", + urls = ["https://crates.io/api/v1/crates/h2/0.3.23/download"], visibility = [], ) cargo.rust_library( - name = "h2-0.3.22", - srcs = [":h2-0.3.22.crate"], + name = "h2-0.3.23", + srcs = [":h2-0.3.23.crate"], crate = "h2", - crate_root = "h2-0.3.22.crate/src/lib.rs", + crate_root = "h2-0.3.23.crate/src/lib.rs", edition = "2018", visibility = [], deps = [ @@ -5533,7 +5533,7 @@ cargo.rust_library( ":futures-channel-0.3.30", ":futures-core-0.3.30", ":futures-util-0.3.30", - ":h2-0.3.22", + ":h2-0.3.23", ":http-0.2.11", ":http-body-0.4.6", ":httparse-1.8.0", @@ -5864,7 +5864,7 @@ cargo.rust_library( ], visibility = [], deps = [ - ":console-0.15.7", + ":console-0.15.8", ":number_prefix-0.4.0", ":portable-atomic-1.6.0", ":unicode-width-0.1.11", @@ -9777,7 +9777,7 @@ cargo.rust_library( "std", ], visibility = [], - deps = [":getrandom-0.2.11"], + deps = [":getrandom-0.2.12"], ) alias( @@ -10118,7 +10118,7 @@ cargo.rust_library( "linux-arm64": dict( deps = [ ":encoding_rs-0.8.33", - ":h2-0.3.22", + ":h2-0.3.23", ":http-body-0.4.6", ":hyper-0.14.28", ":hyper-rustls-0.24.2", @@ -10138,7 +10138,7 @@ cargo.rust_library( "linux-x86_64": dict( deps = [ ":encoding_rs-0.8.33", - ":h2-0.3.22", + ":h2-0.3.23", ":http-body-0.4.6", ":hyper-0.14.28", ":hyper-rustls-0.24.2", @@ -10158,7 +10158,7 @@ cargo.rust_library( "macos-arm64": dict( deps = [ ":encoding_rs-0.8.33", - ":h2-0.3.22", + ":h2-0.3.23", ":http-body-0.4.6", ":hyper-0.14.28", ":hyper-rustls-0.24.2", @@ -10179,7 +10179,7 @@ cargo.rust_library( "macos-x86_64": dict( deps = [ ":encoding_rs-0.8.33", - ":h2-0.3.22", + ":h2-0.3.23", ":http-body-0.4.6", ":hyper-0.14.28", ":hyper-rustls-0.24.2", @@ -10200,7 +10200,7 @@ cargo.rust_library( "windows-gnu": dict( deps = [ ":encoding_rs-0.8.33", - ":h2-0.3.22", + ":h2-0.3.23", ":http-body-0.4.6", ":hyper-0.14.28", ":hyper-rustls-0.24.2", @@ -10221,7 +10221,7 @@ cargo.rust_library( "windows-msvc": dict( deps = [ ":encoding_rs-0.8.33", - ":h2-0.3.22", + ":h2-0.3.23", ":http-body-0.4.6", ":hyper-0.14.28", ":hyper-rustls-0.24.2", @@ -10495,7 +10495,7 @@ cargo.rust_library( }, visibility = [], deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":untrusted-0.9.0", ], ) @@ -13696,7 +13696,7 @@ cargo.rust_binary( ":colored-2.1.0", ":comfy-table-7.1.0", ":config-0.13.4", - ":console-0.15.7", + ":console-0.15.8", ":convert_case-0.6.0", ":crossbeam-channel-0.5.11", ":deadpool-0.10.0", @@ -14612,7 +14612,7 @@ cargo.rust_library( ":serde-1.0.195", ":serde_spanned-0.6.5", ":toml_datetime-0.6.5", - ":winnow-0.5.33", + ":winnow-0.5.34", ], ) @@ -14631,6 +14631,7 @@ cargo.rust_library( crate_root = "toml_edit-0.21.0.crate/src/lib.rs", edition = "2021", features = [ + "default", "display", "parse", "serde", @@ -14641,7 +14642,7 @@ cargo.rust_library( ":serde-1.0.195", ":serde_spanned-0.6.5", ":toml_datetime-0.6.5", - ":winnow-0.5.33", + ":winnow-0.5.34", ], ) @@ -14685,7 +14686,7 @@ cargo.rust_library( ":bytes-1.5.0", ":futures-core-0.3.30", ":futures-util-0.3.30", - ":h2-0.3.22", + ":h2-0.3.23", ":http-0.2.11", ":http-body-0.4.6", ":hyper-0.14.28", @@ -15545,7 +15546,7 @@ cargo.rust_library( ], visibility = [], deps = [ - ":getrandom-0.2.11", + ":getrandom-0.2.12", ":serde-1.0.195", ], ) @@ -15918,55 +15919,6 @@ cargo.rust_library( deps = [":windows-targets-0.52.0"], ) -http_archive( - name = "windows-sys-0.45.0.crate", - sha256 = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0", - strip_prefix = "windows-sys-0.45.0", - urls = ["https://crates.io/api/v1/crates/windows-sys/0.45.0/download"], - visibility = [], -) - -cargo.rust_library( - name = "windows-sys-0.45.0", - srcs = [":windows-sys-0.45.0.crate"], - crate = "windows_sys", - crate_root = "windows-sys-0.45.0.crate/src/lib.rs", - edition = "2018", - features = [ - "Win32", - "Win32_Foundation", - "Win32_Storage", - "Win32_Storage_FileSystem", - "Win32_System", - "Win32_System_Console", - "Win32_UI", - "Win32_UI_Input", - "Win32_UI_Input_KeyboardAndMouse", - "default", - ], - platform = { - "linux-arm64": dict( - deps = [":windows-targets-0.42.2"], - ), - "linux-x86_64": dict( - deps = [":windows-targets-0.42.2"], - ), - "macos-arm64": dict( - deps = [":windows-targets-0.42.2"], - ), - "macos-x86_64": dict( - deps = [":windows-targets-0.42.2"], - ), - "windows-gnu": dict( - deps = [":windows-targets-0.42.2"], - ), - "windows-msvc": dict( - deps = [":windows-targets-0.42.2"], - ), - }, - visibility = [], -) - http_archive( name = "windows-sys-0.48.0.crate", sha256 = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9", @@ -16049,6 +16001,8 @@ cargo.rust_library( "Win32_System_Memory", "Win32_System_Threading", "Win32_UI", + "Win32_UI_Input", + "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "default", ], @@ -16056,31 +16010,6 @@ cargo.rust_library( deps = [":windows-targets-0.52.0"], ) -http_archive( - name = "windows-targets-0.42.2.crate", - sha256 = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071", - strip_prefix = "windows-targets-0.42.2", - urls = ["https://crates.io/api/v1/crates/windows-targets/0.42.2/download"], - visibility = [], -) - -cargo.rust_library( - name = "windows-targets-0.42.2", - srcs = [":windows-targets-0.42.2.crate"], - crate = "windows_targets", - crate_root = "windows-targets-0.42.2.crate/src/lib.rs", - edition = "2018", - platform = { - "windows-gnu": dict( - deps = [":windows_x86_64_gnu-0.42.2"], - ), - "windows-msvc": dict( - deps = [":windows_x86_64_msvc-0.42.2"], - ), - }, - visibility = [], -) - http_archive( name = "windows-targets-0.48.5.crate", sha256 = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c", @@ -16137,38 +16066,6 @@ cargo.rust_library( visibility = [], ) -http_archive( - name = "windows_x86_64_gnu-0.42.2.crate", - sha256 = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36", - strip_prefix = "windows_x86_64_gnu-0.42.2", - sub_targets = ["lib/libwindows.a"], - urls = ["https://crates.io/api/v1/crates/windows_x86_64_gnu/0.42.2/download"], - visibility = [], -) - -cargo.rust_library( - name = "windows_x86_64_gnu-0.42.2", - srcs = [":windows_x86_64_gnu-0.42.2.crate"], - crate = "windows_x86_64_gnu", - crate_root = "windows_x86_64_gnu-0.42.2.crate/src/lib.rs", - edition = "2018", - platform = { - "windows-gnu": dict( - deps = [":windows_x86_64_gnu-0.42.2-libwindows.a-libwindows.a"], - ), - "windows-msvc": dict( - deps = [":windows_x86_64_gnu-0.42.2-libwindows.a-libwindows.a"], - ), - }, - visibility = [], -) - -third_party_rust_prebuilt_cxx_library( - name = "windows_x86_64_gnu-0.42.2-libwindows.a-libwindows.a", - static_lib = ":windows_x86_64_gnu-0.42.2.crate[lib/libwindows.a]", - visibility = [], -) - http_archive( name = "windows_x86_64_gnu-0.48.5.crate", sha256 = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e", @@ -16203,38 +16100,6 @@ cargo.rust_library( visibility = [], ) -http_archive( - name = "windows_x86_64_msvc-0.42.2.crate", - sha256 = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0", - strip_prefix = "windows_x86_64_msvc-0.42.2", - sub_targets = ["lib/windows.lib"], - urls = ["https://crates.io/api/v1/crates/windows_x86_64_msvc/0.42.2/download"], - visibility = [], -) - -cargo.rust_library( - name = "windows_x86_64_msvc-0.42.2", - srcs = [":windows_x86_64_msvc-0.42.2.crate"], - crate = "windows_x86_64_msvc", - crate_root = "windows_x86_64_msvc-0.42.2.crate/src/lib.rs", - edition = "2018", - platform = { - "windows-gnu": dict( - deps = [":windows_x86_64_msvc-0.42.2-windows.lib-windows.lib"], - ), - "windows-msvc": dict( - deps = [":windows_x86_64_msvc-0.42.2-windows.lib-windows.lib"], - ), - }, - visibility = [], -) - -third_party_rust_prebuilt_cxx_library( - name = "windows_x86_64_msvc-0.42.2-windows.lib-windows.lib", - static_lib = ":windows_x86_64_msvc-0.42.2.crate[lib/windows.lib]", - visibility = [], -) - http_archive( name = "windows_x86_64_msvc-0.48.5.crate", sha256 = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538", @@ -16270,18 +16135,18 @@ cargo.rust_library( ) http_archive( - name = "winnow-0.5.33.crate", - sha256 = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa", - strip_prefix = "winnow-0.5.33", - urls = ["https://crates.io/api/v1/crates/winnow/0.5.33/download"], + name = "winnow-0.5.34.crate", + sha256 = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16", + strip_prefix = "winnow-0.5.34", + urls = ["https://crates.io/api/v1/crates/winnow/0.5.34/download"], visibility = [], ) cargo.rust_library( - name = "winnow-0.5.33", - srcs = [":winnow-0.5.33.crate"], + name = "winnow-0.5.34", + srcs = [":winnow-0.5.34.crate"], crate = "winnow", - crate_root = "winnow-0.5.33.crate/src/lib.rs", + crate_root = "winnow-0.5.34.crate/src/lib.rs", edition = "2021", features = [ "alloc", diff --git a/third-party/rust/Cargo.lock b/third-party/rust/Cargo.lock index 70f37e370b..610c865734 100644 --- a/third-party/rust/Cargo.lock +++ b/third-party/rust/Cargo.lock @@ -23,7 +23,7 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "version_check", ] @@ -35,7 +35,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "version_check", "zerocopy", @@ -557,9 +557,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d4d6dafc1a3bb54687538972158f07b2c948bc57d5890df22c0739098b3028" +checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" dependencies = [ "borsh-derive", "cfg_aliases", @@ -567,9 +567,9 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4918709cc4dd777ad2b6303ed03cb37f3ca0ccede8c1b0d28ac6db8f4710e0" +checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" dependencies = [ "once_cell", "proc-macro-crate", @@ -847,15 +847,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.7" +version = "0.15.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" +checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.45.0", + "windows-sys 0.52.0", ] [[package]] @@ -879,7 +879,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "once_cell", "tiny-keccak", ] @@ -1475,7 +1475,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a667e6426df16c2ac478efa4a439d0e674cba769c5556e8cf221739251640c8c" dependencies = [ "ct-codecs", - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -1858,9 +1858,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "js-sys", @@ -1907,9 +1907,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" dependencies = [ "bytes 1.5.0", "fnv", @@ -2654,7 +2654,7 @@ dependencies = [ "data-encoding", "ed25519 2.2.3", "ed25519-dalek", - "getrandom 0.2.11", + "getrandom 0.2.12", "log", "rand 0.8.5", "signatory", @@ -2670,7 +2670,7 @@ dependencies = [ "data-encoding", "ed25519 2.2.3", "ed25519-dalek", - "getrandom 0.2.11", + "getrandom 0.2.12", "log", "rand 0.8.5", "signatory", @@ -3319,11 +3319,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.0" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +checksum = "6b2685dd208a3771337d8d386a89840f0f43cd68be8dae90a5f8c2384effc9cd" dependencies = [ - "toml_edit 0.20.7", + "toml_edit 0.21.0", ] [[package]] @@ -3499,7 +3499,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", ] [[package]] @@ -3526,7 +3526,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "libredox", "thiserror", ] @@ -3698,7 +3698,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", - "getrandom 0.2.11", + "getrandom 0.2.12", "libc", "spin 0.9.8", "untrusted", @@ -4754,7 +4754,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbde97f499e51ef384f585dc8f8fb6a9c3a71b274b8d12469b516758e6540607" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "hmac-sha256", "hmac-sha512", "rand 0.8.5", @@ -5322,17 +5322,6 @@ dependencies = [ "winnow", ] -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.21.0" @@ -5667,7 +5656,7 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ - "getrandom 0.2.11", + "getrandom 0.2.12", "serde", ] @@ -5890,15 +5879,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -5917,21 +5897,6 @@ dependencies = [ "windows-targets 0.52.0", ] -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-targets" version = "0.48.5" @@ -5962,12 +5927,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.0", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -5980,12 +5939,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -5998,12 +5951,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -6016,12 +5963,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -6034,12 +5975,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -6052,12 +5987,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -6070,12 +5999,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -6090,9 +6013,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.33" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ]