mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-08-06 12:39:51 +00:00
feat(core): add gated LTTng tracing
This commit is contained in:
Generated
+63
-6
@@ -772,6 +772,29 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.65.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"log",
|
||||
"peeking_take_while",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash 1.1.0",
|
||||
"shlex",
|
||||
"syn 2.0.117",
|
||||
"which 4.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.72.1"
|
||||
@@ -785,7 +808,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash",
|
||||
"rustc-hash 2.1.0",
|
||||
"shlex",
|
||||
"syn 2.0.117",
|
||||
]
|
||||
@@ -2298,6 +2321,8 @@ dependencies = [
|
||||
"indoc",
|
||||
"itertools 0.14.0",
|
||||
"kcp-sys",
|
||||
"lttng-ust",
|
||||
"lttng-ust-generate",
|
||||
"machine-uid",
|
||||
"maplit",
|
||||
"mimalloc",
|
||||
@@ -4664,7 +4689,7 @@ source = "git+https://github.com/EasyTier/kcp-sys?rev=d7427c22d764deb1860a7d37ac
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"auto_impl",
|
||||
"bindgen",
|
||||
"bindgen 0.72.1",
|
||||
"bitflags 2.8.0",
|
||||
"bytes",
|
||||
"cc",
|
||||
@@ -4711,6 +4736,12 @@ dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "leb128fmt"
|
||||
version = "0.1.0"
|
||||
@@ -4774,7 +4805,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-targets 0.52.6",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4904,6 +4935,20 @@ version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
|
||||
|
||||
[[package]]
|
||||
name = "lttng-ust"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/EasyTier/lttng-ust-rs.git#fb3a7a86e9c3d8edad34cc70fd48f908b745f8d9"
|
||||
|
||||
[[package]]
|
||||
name = "lttng-ust-generate"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/EasyTier/lttng-ust-rs.git#fb3a7a86e9c3d8edad34cc70fd48f908b745f8d9"
|
||||
dependencies = [
|
||||
"bindgen 0.65.1",
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mac"
|
||||
version = "0.1.1"
|
||||
@@ -6223,6 +6268,12 @@ dependencies = [
|
||||
"hmac",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
|
||||
[[package]]
|
||||
name = "pem"
|
||||
version = "3.0.4"
|
||||
@@ -7067,7 +7118,7 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
"quinn-proto",
|
||||
"quinn-udp",
|
||||
"rustc-hash",
|
||||
"rustc-hash 2.1.0",
|
||||
"rustls",
|
||||
"socket2 0.5.10",
|
||||
"thiserror 2.0.11",
|
||||
@@ -7088,7 +7139,7 @@ dependencies = [
|
||||
"lru-slab",
|
||||
"rand 0.9.1",
|
||||
"ring",
|
||||
"rustc-hash",
|
||||
"rustc-hash 2.1.0",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"rustls-platform-verifier",
|
||||
@@ -7775,6 +7826,12 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.0"
|
||||
@@ -11268,7 +11325,7 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -37,6 +37,7 @@ tracing-subscriber = { version = "0.3", features = [
|
||||
"local-time",
|
||||
"time",
|
||||
] }
|
||||
lttng-ust = { git = "https://github.com/EasyTier/lttng-ust-rs.git", optional = true }
|
||||
derivative = "2.2.0"
|
||||
derive_more = { version = "2.1.1", features = ["full"] }
|
||||
console-subscriber = { version = "0.4.1", optional = true }
|
||||
@@ -329,6 +330,7 @@ quote = "1"
|
||||
thunk-rs = { git = "https://github.com/easytier/thunk.git", default-features = false, features = [
|
||||
"win7",
|
||||
] }
|
||||
lttng-ust-generate = { git = "https://github.com/EasyTier/lttng-ust-rs.git", optional = true }
|
||||
|
||||
[target.'cfg(windows)'.build-dependencies]
|
||||
reqwest = { version = "0.12.12", features = ["blocking"] }
|
||||
@@ -402,6 +404,7 @@ jemalloc-prof = [
|
||||
"jemalloc-sys/stats",
|
||||
]
|
||||
tracing = ["tokio/tracing", "dep:console-subscriber"]
|
||||
lttng = ["dep:lttng-ust", "dep:lttng-ust-generate"]
|
||||
magic-dns = ["dep:hickory-client", "dep:hickory-server"]
|
||||
faketcp = ["dep:flume"]
|
||||
zstd = ["dep:zstd"]
|
||||
|
||||
@@ -133,6 +133,33 @@ fn check_locale() {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "lttng")]
|
||||
fn generate_lttng_tracepoints(out: &PathBuf) -> Result<(), Box<dyn std::error::Error>> {
|
||||
use lttng_ust_generate::{CIntegerType, CTFType, Generator, LogLevel, Provider};
|
||||
|
||||
let mut provider = Provider::new("easytier");
|
||||
provider
|
||||
.create_class("marker")
|
||||
.add_field("name", CTFType::SequenceText)
|
||||
.add_field("value", CTFType::Integer(CIntegerType::U64))
|
||||
.instantiate_with_level("mark", LogLevel::Info);
|
||||
|
||||
provider
|
||||
.create_class("duration")
|
||||
.add_field("name", CTFType::SequenceText)
|
||||
.add_field("duration_micros", CTFType::Integer(CIntegerType::U64))
|
||||
.instantiate_with_level("duration_micros", LogLevel::Info);
|
||||
|
||||
Generator::default()
|
||||
.generated_lib_name("easytier_lttng_tracepoints")
|
||||
.register_provider(provider)
|
||||
.output_file_name(out.join("lttng_tracepoints.rs"))
|
||||
.generate()
|
||||
.map_err(|_| std::io::Error::other("failed to generate LTTng tracepoints"))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
cfg_aliases! {
|
||||
mobile: {
|
||||
@@ -174,6 +201,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
let out = PathBuf::from(env::var("OUT_DIR")?);
|
||||
#[cfg(feature = "lttng")]
|
||||
generate_lttng_tracepoints(&out)?;
|
||||
|
||||
let descriptor = out.join("descriptors.bin");
|
||||
|
||||
let mut config = prost_build::Config::new();
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#[cfg(feature = "lttng")]
|
||||
lttng_ust::import_tracepoints!(
|
||||
concat!(env!("OUT_DIR"), "/lttng_tracepoints.rs"),
|
||||
tracepoints
|
||||
);
|
||||
|
||||
#[cfg(feature = "lttng")]
|
||||
pub fn mark(name: &str, value: u64) {
|
||||
tracepoints::easytier::mark(name, value);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "lttng"))]
|
||||
#[inline(always)]
|
||||
pub fn mark(_name: &str, _value: u64) {}
|
||||
|
||||
#[cfg(feature = "lttng")]
|
||||
pub fn duration_micros(name: &str, duration_micros: u64) {
|
||||
tracepoints::easytier::duration_micros(name, duration_micros);
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "lttng"))]
|
||||
#[inline(always)]
|
||||
pub fn duration_micros(_name: &str, _duration_micros: u64) {}
|
||||
@@ -18,6 +18,7 @@ pub mod global_ctx;
|
||||
pub mod idn;
|
||||
pub mod ifcfg;
|
||||
pub mod log;
|
||||
pub mod lttng;
|
||||
pub mod machine_id;
|
||||
pub mod netns;
|
||||
pub mod network;
|
||||
|
||||
Reference in New Issue
Block a user