mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 12:21:18 +00:00
Add console feature flag, not default
The most recent tracing-core changed the number of variants on metadata::Kind, which broke console-api 0.1.1, and no fix has been applied yet. To avoid build failures, disable console-subscriber for now
This commit is contained in:
parent
6b1894faf0
commit
2e5746b74f
2 changed files with 11 additions and 3 deletions
|
@ -13,6 +13,10 @@ doctest = false
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
debug = 0
|
debug = 0
|
||||||
|
|
||||||
|
[features]
|
||||||
|
console = ["console-subscriber"]
|
||||||
|
default = []
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"crates/api",
|
"crates/api",
|
||||||
|
@ -54,7 +58,7 @@ tracing-actix-web = { version = "0.5.0-beta.8", default-features = false }
|
||||||
tracing-error = "0.2.0"
|
tracing-error = "0.2.0"
|
||||||
tracing-log = "0.1.2"
|
tracing-log = "0.1.2"
|
||||||
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
|
||||||
console-subscriber = "0.1.0"
|
console-subscriber = { version = "0.1.0", optional = true }
|
||||||
strum = "0.23.0"
|
strum = "0.23.0"
|
||||||
url = { version = "2.2.2", features = ["serde"] }
|
url = { version = "2.2.2", features = ["serde"] }
|
||||||
openssl = "0.10.38"
|
openssl = "0.10.38"
|
||||||
|
|
|
@ -4,6 +4,7 @@ pub mod code_migrations;
|
||||||
pub mod root_span_builder;
|
pub mod root_span_builder;
|
||||||
pub mod scheduled_tasks;
|
pub mod scheduled_tasks;
|
||||||
|
|
||||||
|
#[cfg(feature = "console")]
|
||||||
use console_subscriber::ConsoleLayer;
|
use console_subscriber::ConsoleLayer;
|
||||||
use lemmy_utils::LemmyError;
|
use lemmy_utils::LemmyError;
|
||||||
use opentelemetry::{
|
use opentelemetry::{
|
||||||
|
@ -30,6 +31,7 @@ pub fn init_tracing(opentelemetry_url: Option<&str>) -> Result<(), LemmyError> {
|
||||||
|
|
||||||
let format_layer = tracing_subscriber::fmt::layer().with_filter(targets.clone());
|
let format_layer = tracing_subscriber::fmt::layer().with_filter(targets.clone());
|
||||||
|
|
||||||
|
#[cfg(feature = "console")]
|
||||||
let console_layer = ConsoleLayer::builder()
|
let console_layer = ConsoleLayer::builder()
|
||||||
.with_default_env()
|
.with_default_env()
|
||||||
.server_addr(([0, 0, 0, 0], 6669))
|
.server_addr(([0, 0, 0, 0], 6669))
|
||||||
|
@ -38,8 +40,10 @@ pub fn init_tracing(opentelemetry_url: Option<&str>) -> Result<(), LemmyError> {
|
||||||
|
|
||||||
let subscriber = Registry::default()
|
let subscriber = Registry::default()
|
||||||
.with(format_layer)
|
.with(format_layer)
|
||||||
.with(ErrorLayer::default())
|
.with(ErrorLayer::default());
|
||||||
.with(console_layer);
|
|
||||||
|
#[cfg(feature = "console")]
|
||||||
|
let subscriber = subscriber.with(console_layer);
|
||||||
|
|
||||||
if let Some(url) = opentelemetry_url {
|
if let Some(url) = opentelemetry_url {
|
||||||
let tracer = opentelemetry_otlp::new_pipeline()
|
let tracer = opentelemetry_otlp::new_pipeline()
|
||||||
|
|
Loading…
Reference in a new issue