mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-28 21:32:39 +00:00
Remove opentelemetry tracing subscriber
We'll see if this stops the server from leaking memory. We still have spans in our logs. Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
733cf4c271
commit
365cda0fab
3 changed files with 4 additions and 165 deletions
135
Cargo.lock
generated
135
Cargo.lock
generated
|
@ -878,8 +878,6 @@ dependencies = [
|
||||||
"log",
|
"log",
|
||||||
"lsp",
|
"lsp",
|
||||||
"nanoid",
|
"nanoid",
|
||||||
"opentelemetry",
|
|
||||||
"opentelemetry-otlp",
|
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"project",
|
"project",
|
||||||
"rand 0.8.3",
|
"rand 0.8.3",
|
||||||
|
@ -900,7 +898,6 @@ dependencies = [
|
||||||
"tower",
|
"tower",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-log",
|
"tracing-log",
|
||||||
"tracing-opentelemetry",
|
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"util",
|
"util",
|
||||||
"workspace",
|
"workspace",
|
||||||
|
@ -1532,12 +1529,6 @@ version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fixedbitset"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.0.20"
|
version = "1.0.20"
|
||||||
|
@ -3041,45 +3032,6 @@ dependencies = [
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "opentelemetry"
|
|
||||||
version = "0.17.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"crossbeam-channel 0.5.0",
|
|
||||||
"futures-channel",
|
|
||||||
"futures-executor",
|
|
||||||
"futures-util",
|
|
||||||
"js-sys",
|
|
||||||
"lazy_static",
|
|
||||||
"percent-encoding",
|
|
||||||
"pin-project",
|
|
||||||
"rand 0.8.3",
|
|
||||||
"thiserror",
|
|
||||||
"tokio",
|
|
||||||
"tokio-stream",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "opentelemetry-otlp"
|
|
||||||
version = "0.10.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9d1a6ca9de4c8b00aa7f1a153bd76cb263287155cec642680d79d98706f3d28a"
|
|
||||||
dependencies = [
|
|
||||||
"async-trait",
|
|
||||||
"futures",
|
|
||||||
"futures-util",
|
|
||||||
"http",
|
|
||||||
"opentelemetry",
|
|
||||||
"prost 0.9.0",
|
|
||||||
"thiserror",
|
|
||||||
"tokio",
|
|
||||||
"tonic",
|
|
||||||
"tonic-build",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ordered-float"
|
name = "ordered-float"
|
||||||
version = "2.1.1"
|
version = "2.1.1"
|
||||||
|
@ -3220,17 +3172,7 @@ version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
|
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fixedbitset 0.2.0",
|
"fixedbitset",
|
||||||
"indexmap",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "petgraph"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
|
|
||||||
dependencies = [
|
|
||||||
"fixedbitset 0.4.1",
|
|
||||||
"indexmap",
|
"indexmap",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3515,29 +3457,9 @@ dependencies = [
|
||||||
"itertools",
|
"itertools",
|
||||||
"log",
|
"log",
|
||||||
"multimap",
|
"multimap",
|
||||||
"petgraph 0.5.1",
|
"petgraph",
|
||||||
"prost 0.8.0",
|
"prost 0.8.0",
|
||||||
"prost-types 0.8.0",
|
"prost-types",
|
||||||
"tempfile",
|
|
||||||
"which 4.1.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "prost-build"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"heck 0.3.3",
|
|
||||||
"itertools",
|
|
||||||
"lazy_static",
|
|
||||||
"log",
|
|
||||||
"multimap",
|
|
||||||
"petgraph 0.6.0",
|
|
||||||
"prost 0.9.0",
|
|
||||||
"prost-types 0.9.0",
|
|
||||||
"regex",
|
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"which 4.1.0",
|
"which 4.1.0",
|
||||||
]
|
]
|
||||||
|
@ -3578,16 +3500,6 @@ dependencies = [
|
||||||
"prost 0.8.0",
|
"prost 0.8.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "prost-types"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a"
|
|
||||||
dependencies = [
|
|
||||||
"bytes",
|
|
||||||
"prost 0.9.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.9"
|
version = "1.0.9"
|
||||||
|
@ -3905,7 +3817,7 @@ dependencies = [
|
||||||
"gpui",
|
"gpui",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"prost 0.8.0",
|
"prost 0.8.0",
|
||||||
"prost-build 0.8.0",
|
"prost-build",
|
||||||
"rand 0.8.3",
|
"rand 0.8.3",
|
||||||
"rsa",
|
"rsa",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -4006,18 +3918,6 @@ dependencies = [
|
||||||
"webpki",
|
"webpki",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustls-native-certs"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092"
|
|
||||||
dependencies = [
|
|
||||||
"openssl-probe",
|
|
||||||
"rustls",
|
|
||||||
"schannel",
|
|
||||||
"security-framework",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustybuzz"
|
name = "rustybuzz"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
|
@ -5225,9 +5125,7 @@ dependencies = [
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"prost 0.9.0",
|
"prost 0.9.0",
|
||||||
"prost-derive 0.9.0",
|
"prost-derive 0.9.0",
|
||||||
"rustls-native-certs",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-rustls",
|
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-util 0.6.9",
|
"tokio-util 0.6.9",
|
||||||
"tower",
|
"tower",
|
||||||
|
@ -5237,18 +5135,6 @@ dependencies = [
|
||||||
"tracing-futures",
|
"tracing-futures",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tonic-build"
|
|
||||||
version = "0.6.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"prost-build 0.9.0",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower"
|
name = "tower"
|
||||||
version = "0.4.12"
|
version = "0.4.12"
|
||||||
|
@ -5355,19 +5241,6 @@ dependencies = [
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tracing-opentelemetry"
|
|
||||||
version = "0.17.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1f9378e96a9361190ae297e7f3a8ff644aacd2897f244b1ff81f381669196fa6"
|
|
||||||
dependencies = [
|
|
||||||
"opentelemetry",
|
|
||||||
"tracing",
|
|
||||||
"tracing-core",
|
|
||||||
"tracing-log",
|
|
||||||
"tracing-subscriber",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-serde"
|
name = "tracing-serde"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
|
|
@ -30,8 +30,6 @@ hyper = "0.14"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
lipsum = { version = "0.8", optional = true }
|
lipsum = { version = "0.8", optional = true }
|
||||||
nanoid = "0.4"
|
nanoid = "0.4"
|
||||||
opentelemetry = { version = "0.17", features = ["rt-tokio"] }
|
|
||||||
opentelemetry-otlp = { version = "0.10", features = ["tls-roots"] }
|
|
||||||
parking_lot = "0.11.1"
|
parking_lot = "0.11.1"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
reqwest = { version = "0.11", features = ["json"], optional = true }
|
reqwest = { version = "0.11", features = ["json"], optional = true }
|
||||||
|
@ -47,7 +45,6 @@ tower = "0.4"
|
||||||
toml = "0.5.8"
|
toml = "0.5.8"
|
||||||
tracing = "0.1.34"
|
tracing = "0.1.34"
|
||||||
tracing-log = "0.1.3"
|
tracing-log = "0.1.3"
|
||||||
tracing-opentelemetry = "0.17"
|
|
||||||
tracing-subscriber = { version = "0.3.11", features = ["env-filter", "json"] }
|
tracing-subscriber = { version = "0.3.11", features = ["env-filter", "json"] }
|
||||||
|
|
||||||
[dependencies.sqlx]
|
[dependencies.sqlx]
|
||||||
|
|
|
@ -78,44 +78,13 @@ async fn main() -> Result<()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init_tracing(config: &Config) -> Option<()> {
|
pub fn init_tracing(config: &Config) -> Option<()> {
|
||||||
use opentelemetry::KeyValue;
|
|
||||||
use opentelemetry_otlp::WithExportConfig;
|
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use tracing_opentelemetry::OpenTelemetryLayer;
|
|
||||||
use tracing_subscriber::layer::SubscriberExt;
|
use tracing_subscriber::layer::SubscriberExt;
|
||||||
let rust_log = config.rust_log.clone()?;
|
let rust_log = config.rust_log.clone()?;
|
||||||
|
|
||||||
LogTracer::init().log_err()?;
|
LogTracer::init().log_err()?;
|
||||||
|
|
||||||
let open_telemetry_layer = config
|
|
||||||
.honeycomb_api_key
|
|
||||||
.clone()
|
|
||||||
.zip(config.honeycomb_dataset.clone())
|
|
||||||
.map(|(honeycomb_api_key, honeycomb_dataset)| {
|
|
||||||
let mut metadata = tonic::metadata::MetadataMap::new();
|
|
||||||
metadata.insert("x-honeycomb-team", honeycomb_api_key.parse().unwrap());
|
|
||||||
let tracer = opentelemetry_otlp::new_pipeline()
|
|
||||||
.tracing()
|
|
||||||
.with_exporter(
|
|
||||||
opentelemetry_otlp::new_exporter()
|
|
||||||
.tonic()
|
|
||||||
.with_endpoint("https://api.honeycomb.io")
|
|
||||||
.with_metadata(metadata),
|
|
||||||
)
|
|
||||||
.with_trace_config(opentelemetry::sdk::trace::config().with_resource(
|
|
||||||
opentelemetry::sdk::Resource::new(vec![KeyValue::new(
|
|
||||||
"service.name",
|
|
||||||
honeycomb_dataset,
|
|
||||||
)]),
|
|
||||||
))
|
|
||||||
.install_batch(opentelemetry::runtime::Tokio)
|
|
||||||
.expect("failed to initialize tracing");
|
|
||||||
|
|
||||||
OpenTelemetryLayer::new(tracer)
|
|
||||||
});
|
|
||||||
|
|
||||||
let subscriber = tracing_subscriber::Registry::default()
|
let subscriber = tracing_subscriber::Registry::default()
|
||||||
.with(open_telemetry_layer)
|
|
||||||
.with(if config.log_json.unwrap_or(false) {
|
.with(if config.log_json.unwrap_or(false) {
|
||||||
Box::new(
|
Box::new(
|
||||||
tracing_subscriber::fmt::layer()
|
tracing_subscriber::fmt::layer()
|
||||||
|
|
Loading…
Reference in a new issue