This commit is contained in:
Nadja Reitzenstein 2023-06-01 23:18:40 +02:00
parent 839a57b6d6
commit 1767e4fc93
5 changed files with 194 additions and 11 deletions

189
Cargo.lock generated
View File

@ -120,8 +120,8 @@ checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
name = "api" name = "api"
version = "0.3.2" version = "0.3.2"
dependencies = [ dependencies = [
"capnp", "capnp 0.14.11",
"capnpc", "capnpc 0.14.9",
"walkdir", "walkdir",
] ]
@ -561,13 +561,19 @@ version = "0.14.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dca085c2c7d9d65ad749d450b19b551efaa8e3476a439bdca07aca8533097f3" checksum = "2dca085c2c7d9d65ad749d450b19b551efaa8e3476a439bdca07aca8533097f3"
[[package]]
name = "capnp"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18eca1b9aca7e3623dda158213b1b79c1e5c4293fbbf0ead6b9ed28a1763bbff"
[[package]] [[package]]
name = "capnp-futures" name = "capnp-futures"
version = "0.14.2" version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9821801cc6f199a9d9c3c793504e800c797b536d2befddaffb15144e40a6e63a" checksum = "9821801cc6f199a9d9c3c793504e800c797b536d2befddaffb15144e40a6e63a"
dependencies = [ dependencies = [
"capnp", "capnp 0.14.11",
"futures", "futures",
] ]
@ -577,7 +583,7 @@ version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4f17f96f68f2c1168ed7105d9e5cb4a095a5bef3578aee0f9c0644b85ca95e" checksum = "4c4f17f96f68f2c1168ed7105d9e5cb4a095a5bef3578aee0f9c0644b85ca95e"
dependencies = [ dependencies = [
"capnp", "capnp 0.14.11",
"capnp-futures", "capnp-futures",
"futures", "futures",
] ]
@ -588,7 +594,16 @@ version = "0.14.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdc9f1dc84666d4ff007b1a16c8f97db80764a624625979be05d869bcff43aaa" checksum = "bdc9f1dc84666d4ff007b1a16c8f97db80764a624625979be05d869bcff43aaa"
dependencies = [ dependencies = [
"capnp", "capnp 0.14.11",
]
[[package]]
name = "capnpc"
version = "0.16.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55b72fc31ab0a8fd0420a799737d15e0a5297d695ba6c8b7b578d8cc0ba8360c"
dependencies = [
"capnp 0.16.1",
] ]
[[package]] [[package]]
@ -701,7 +716,7 @@ dependencies = [
"async-io", "async-io",
"async-net", "async-net",
"async-oneshot", "async-oneshot",
"console-api", "console-api 0.3.0",
"crossbeam-channel", "crossbeam-channel",
"crossbeam-utils", "crossbeam-utils",
"futures-util", "futures-util",
@ -717,6 +732,14 @@ dependencies = [
"tracing-subscriber", "tracing-subscriber",
] ]
[[package]]
name = "console-api"
version = "0.1.0"
dependencies = [
"capnp 0.16.1",
"capnpc 0.16.5",
]
[[package]] [[package]]
name = "console-api" name = "console-api"
version = "0.3.0" version = "0.3.0"
@ -978,6 +1001,19 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "dashmap"
version = "5.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc"
dependencies = [
"cfg-if",
"hashbrown",
"lock_api",
"once_cell",
"parking_lot_core",
]
[[package]] [[package]]
name = "des" name = "des"
version = "0.7.0" version = "0.7.0"
@ -1087,7 +1123,7 @@ dependencies = [
"async-process", "async-process",
"async-trait", "async-trait",
"backtrace", "backtrace",
"capnp", "capnp 0.14.11",
"capnp-rpc", "capnp-rpc",
"chrono", "chrono",
"clap 3.2.23", "clap 3.2.23",
@ -1113,6 +1149,8 @@ dependencies = [
"miette", "miette",
"nix", "nix",
"once_cell", "once_cell",
"opentelemetry",
"opentelemetry-jaeger",
"pin-utils", "pin-utils",
"ptr_meta", "ptr_meta",
"rand", "rand",
@ -1136,6 +1174,7 @@ dependencies = [
"toml", "toml",
"tracing", "tracing",
"tracing-futures", "tracing-futures",
"tracing-opentelemetry",
"tracing-subscriber", "tracing-subscriber",
"url", "url",
"uuid", "uuid",
@ -1720,6 +1759,12 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "integer-encoding"
version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02"
[[package]] [[package]]
name = "inventory" name = "inventory"
version = "0.1.11" version = "0.1.11"
@ -2174,6 +2219,86 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "opentelemetry"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f4b8347cc26099d3aeee044065ecc3ae11469796b4d65d065a23a584ed92a6f"
dependencies = [
"opentelemetry_api",
"opentelemetry_sdk",
]
[[package]]
name = "opentelemetry-jaeger"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08e028dc9f4f304e9320ce38c80e7cf74067415b1ad5a8750a38bae54a4d450d"
dependencies = [
"async-trait",
"futures",
"futures-executor",
"once_cell",
"opentelemetry",
"opentelemetry-semantic-conventions",
"thiserror",
"thrift",
]
[[package]]
name = "opentelemetry-semantic-conventions"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24e33428e6bf08c6f7fcea4ddb8e358fab0fe48ab877a87c70c6ebe20f673ce5"
dependencies = [
"opentelemetry",
]
[[package]]
name = "opentelemetry_api"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed41783a5bf567688eb38372f2b7a8530f5a607a4b49d38dd7573236c23ca7e2"
dependencies = [
"fnv",
"futures-channel",
"futures-util",
"indexmap",
"once_cell",
"pin-project-lite",
"thiserror",
"urlencoding",
]
[[package]]
name = "opentelemetry_sdk"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b3a2a91fdbfdd4d212c0dcc2ab540de2c2bcbbd90be17de7a7daf8822d010c1"
dependencies = [
"async-trait",
"crossbeam-channel",
"dashmap",
"fnv",
"futures-channel",
"futures-executor",
"futures-util",
"once_cell",
"opentelemetry_api",
"percent-encoding",
"rand",
"thiserror",
]
[[package]]
name = "ordered-float"
version = "2.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.4.1" version = "6.4.1"
@ -2423,9 +2548,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.51" version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" checksum = "fa1fb82fc0c281dd9671101b66b771ebbe1eaf967b96ac8740dcba4b70005ca8"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@ -2485,9 +2610,9 @@ dependencies = [
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.23" version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
] ]
@ -3226,6 +3351,28 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "threadpool"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa"
dependencies = [
"num_cpus",
]
[[package]]
name = "thrift"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e54bc85fc7faa8bc175c4bab5b92ba8d9a3ce893d0e9f42cc455c8ab16a9e09"
dependencies = [
"byteorder",
"integer-encoding",
"log",
"ordered-float",
"threadpool",
]
[[package]] [[package]]
name = "time" name = "time"
version = "0.1.45" version = "0.1.45"
@ -3485,6 +3632,20 @@ dependencies = [
"tracing-core", "tracing-core",
] ]
[[package]]
name = "tracing-opentelemetry"
version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00a39dcf9bfc1742fa4d6215253b33a6e474be78275884c216fc2a06267b3600"
dependencies = [
"once_cell",
"opentelemetry",
"tracing",
"tracing-core",
"tracing-log",
"tracing-subscriber",
]
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.3.16" version = "0.3.16"
@ -3608,6 +3769,12 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "urlencoding"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "0.8.2" version = "0.8.2"

View File

@ -79,6 +79,9 @@ rand = "0.8.4"
tracing = "0.1" tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "registry", "std"] } tracing-subscriber = { version = "0.3", features = ["env-filter", "registry", "std"] }
tracing-futures = { version = "0.2", features = ["futures-03"] } tracing-futures = { version = "0.2", features = ["futures-03"] }
tracing-opentelemetry = "0.19.0"
opentelemetry = "0.19.0"
opentelemetry-jaeger = "0.18.0"
# API # API
api = { path = "api" } api = { path = "api" }

View File

@ -37,6 +37,8 @@ pub mod capnp;
pub mod utils; pub mod utils;
mod metrics;
// Store build information in the `env` module. // Store build information in the `env` module.
shadow_rs::shadow!(env); shadow_rs::shadow!(env);

View File

@ -44,6 +44,13 @@ pub fn init(config: &LogConfig) -> console::Server {
let (console_layer, server) = console::ConsoleLayer::new(); let (console_layer, server) = console::ConsoleLayer::new();
let subscriber = subscriber.with(console_layer); let subscriber = subscriber.with(console_layer);
let tracer = opentelemetry_jaeger::new_agent_pipeline()
.with_service_name("bffhd")
.install_simple()
.expect("failed to setup jaeger tracer");
let opentelemetry = tracing_opentelemetry::layer().with_tracer(tracer);
let subscriber = subscriber.with(opentelemetry);
let filter = if let Some(ref filter) = config.filter { let filter = if let Some(ref filter) = config.filter {
EnvFilter::new(filter.as_str()) EnvFilter::new(filter.as_str())
} else { } else {

4
bffhd/metrics/mod.rs Normal file
View File

@ -0,0 +1,4 @@
pub fn init_metrics_collector() {
}