Skip to content

Commit

Permalink
Revert "feat: show thread name in logs for playground and standalone (#…
Browse files Browse the repository at this point in the history
…14114)"

This reverts commit d25c5da.
  • Loading branch information
StrikeW committed Dec 28, 2023
1 parent 8b0e3d4 commit f14aec7
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public class TracingSlf4jImpl {
public static final int TRACE = 4;

public static void event(String name, int level, String message) {
Binding.tracingSlf4jEvent(Thread.currentThread().getName(), name, level, message);
Binding.tracingSlf4jEvent(name, level, message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public class Binding {
}
}

public static native void tracingSlf4jEvent(
String threadName, String name, int level, String message);
public static native void tracingSlf4jEvent(String name, int level, String message);

public static native int vnodeCount();

Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/task/task_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl BatchManager {
builder.worker_threads(worker_threads_num);
}
builder
.thread_name("rw-batch")
.thread_name("risingwave-batch-tasks")
.enable_all()
.build()
.unwrap()
Expand Down
6 changes: 2 additions & 4 deletions src/cmd_all/src/bin/risingwave.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,14 @@ fn main() -> Result<()> {

fn playground(opts: PlaygroundOpts) {
let settings = risingwave_rt::LoggerSettings::new("playground")
.with_target("risingwave_storage", Level::WARN)
.with_thread_name(true);
.with_target("risingwave_storage", Level::WARN);
risingwave_rt::init_risingwave_logger(settings);
risingwave_rt::main_okk(risingwave_cmd_all::playground(opts)).unwrap();
}

fn standalone(opts: StandaloneOpts) {
let settings = risingwave_rt::LoggerSettings::new("standalone")
.with_target("risingwave_storage", Level::WARN)
.with_thread_name(true);
.with_target("risingwave_storage", Level::WARN);
risingwave_rt::init_risingwave_logger(settings);
risingwave_rt::main_okk(risingwave_cmd_all::standalone(opts)).unwrap();
}
2 changes: 1 addition & 1 deletion src/connector/src/source/data_gen_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn spawn_data_generation_stream<T: Send + 'static>(
) -> impl Stream<Item = T> + Send + 'static {
static RUNTIME: LazyLock<Runtime> = LazyLock::new(|| {
tokio::runtime::Builder::new_multi_thread()
.thread_name("rw-datagen")
.thread_name("risingwave-data-generation")
.enable_all()
.build()
.expect("failed to build data-generation runtime")
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ impl FrontendEnv {
Arc::new(BackgroundShutdownRuntime::from(
Builder::new_multi_thread()
.worker_threads(4)
.thread_name("rw-batch-local")
.thread_name("frontend-compute-threads")
.enable_all()
.build()
.unwrap(),
Expand Down
4 changes: 2 additions & 2 deletions src/jni_core/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ macro_rules! for_all_plain_native_methods {
($macro:path $(,$args:tt)*) => {
$macro! {
{
public static native void tracingSlf4jEvent(String threadName, String name, int level, String string);
public static native void tracingSlf4jEvent(String name, int level, String string);

public static native int vnodeCount();

Expand Down Expand Up @@ -882,7 +882,7 @@ mod tests {
// This test shows the signature of all native methods
let expected = expect_test::expect![[r#"
[
tracingSlf4jEvent (Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;)V,
tracingSlf4jEvent (Ljava/lang/String;ILjava/lang/String;)V,
vnodeCount ()I,
iteratorNewHummock ([B)J,
iteratorNewStreamChunk (J)J,
Expand Down
7 changes: 1 addition & 6 deletions src/jni_core/src/tracing_slf4j.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,11 @@ use crate::{execute_and_catch, EnvParam};
#[no_mangle]
pub(crate) extern "system" fn Java_com_risingwave_java_binding_Binding_tracingSlf4jEvent(
env: EnvParam<'_>,
thread_name: JString<'_>,
class_name: JString<'_>,
level: jint,
message: JString<'_>,
) {
execute_and_catch(env, move |env| {
let thread_name = env.get_string(&thread_name)?;
let thread_name: Cow<'_, str> = (&thread_name).into();

let class_name = env.get_string(&class_name)?;
let class_name: Cow<'_, str> = (&class_name).into();

Expand All @@ -43,8 +39,7 @@ pub(crate) extern "system" fn Java_com_risingwave_java_binding_Binding_tracingSl
tracing::event!(
target: "risingwave_connector_node",
$lvl,
thread = &*thread_name,
class = &*class_name,
class = class_name.as_ref(),
"{message}",
)
};
Expand Down
2 changes: 1 addition & 1 deletion src/storage/src/hummock/compactor/compaction_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl CompactionExecutor {
let mut worker_num = resource_util::cpu::total_cpu_available() as usize;
let runtime = {
let mut builder = tokio::runtime::Builder::new_multi_thread();
builder.thread_name("rw-compaction");
builder.thread_name("risingwave-compaction");
if let Some(worker_threads_num) = worker_threads_num {
builder.worker_threads(worker_threads_num);
worker_num = worker_threads_num;
Expand Down
2 changes: 1 addition & 1 deletion src/stream/src/task/stream_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ impl LocalStreamManagerCore {
builder.worker_threads(worker_threads_num);
}
builder
.thread_name("rw-streaming")
.thread_name("risingwave-streaming-actor")
.enable_all()
.build()
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion src/utils/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where
}

tokio::runtime::Builder::new_multi_thread()
.thread_name("rw-main")
.thread_name("risingwave-main")
.enable_all()
.build()
.unwrap()
Expand Down
12 changes: 1 addition & 11 deletions src/utils/runtime/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ pub struct LoggerSettings {
colorful: bool,
/// Output to `stderr` instead of `stdout`.
stderr: bool,
/// Whether to include thread name in the log.
with_thread_name: bool,
/// Override target settings.
targets: Vec<(String, tracing::metadata::LevelFilter)>,
/// Override the default level.
Expand All @@ -59,7 +57,6 @@ impl LoggerSettings {
enable_tokio_console: false,
colorful: console::colors_enabled_stderr() && console::colors_enabled(),
stderr: false,
with_thread_name: false,
targets: vec![],
default_level: None,
}
Expand All @@ -77,12 +74,6 @@ impl LoggerSettings {
self
}

/// Whether to include thread name in the log.
pub fn with_thread_name(mut self, enabled: bool) -> Self {
self.with_thread_name = enabled;
self
}

/// Overrides the default target settings.
pub fn with_target(
mut self,
Expand Down Expand Up @@ -221,7 +212,6 @@ pub fn init_risingwave_logger(settings: LoggerSettings) {
// fmt layer (formatting and logging to `stdout` or `stderr`)
{
let fmt_layer = tracing_subscriber::fmt::layer()
.with_thread_names(settings.with_thread_name)
.with_timer(default_timer.clone())
.with_ansi(settings.colorful)
.with_writer(move || {
Expand Down Expand Up @@ -371,7 +361,7 @@ pub fn init_risingwave_logger(settings: LoggerSettings) {
let otel_tracer = {
let runtime = tokio::runtime::Builder::new_multi_thread()
.enable_all()
.thread_name("rw-otel")
.thread_name("risingwave-otel")
.worker_threads(2)
.build()
.unwrap();
Expand Down

0 comments on commit f14aec7

Please sign in to comment.