Skip to content

refactor: add query_profile and query_details persistent log tables #17702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/common/tracing/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl GlobalLogger {
}

// Get the operator for remote log when it is ready.
pub(crate) async fn get_operator(&self) -> Option<Operator> {
pub async fn get_operator(&self) -> Option<Operator> {
let operator = self.remote_log_operator.read().await;
if let Some(operator) = operator.as_ref() {
return Some(operator.clone());
Expand Down Expand Up @@ -383,14 +383,14 @@ pub fn init_logging(
let mut filter_builder =
EnvFilterBuilder::new().filter(Some("databend::log::structlog"), LevelFilter::Off);

if cfg.profile.on && !cfg.profile.dir.is_empty() {
if cfg.profile.on {
filter_builder =
filter_builder.filter(Some("databend::log::profile"), LevelFilter::Trace);
} else {
filter_builder =
filter_builder.filter(Some("databend::log::profile"), LevelFilter::Off);
}
if cfg.query.on && !cfg.query.dir.is_empty() {
if cfg.query.on {
filter_builder =
filter_builder.filter(Some("databend::log::query"), LevelFilter::Trace);
} else {
Expand Down
1 change: 1 addition & 0 deletions src/common/tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ pub use crate::remote_log::LogMessage;
pub use crate::remote_log::RemoteLog;
pub use crate::remote_log::RemoteLogElement;
pub use crate::remote_log::RemoteLogGuard;
pub use crate::remote_log::PERSISTENT_LOG_SCHEMA_VERSION;
pub use crate::structlog::DummyReporter;
pub use crate::structlog::StructLogReporter;

Expand Down
5 changes: 4 additions & 1 deletion src/common/tracing/src/remote_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ use serde_json::Map;
use crate::Config;
use crate::GlobalLogger;

pub const PERSISTENT_LOG_SCHEMA_VERSION: usize = 1;

/// An appender that sends log records to persistent storage
#[derive(Debug)]
pub struct RemoteLog {
Expand Down Expand Up @@ -178,8 +180,9 @@ impl RemoteLog {
op.as_ref()?;

let path = format!(
"stage/internal/{}/{}.parquet",
"stage/internal/{}_v{}/{}.parquet",
stage_name,
PERSISTENT_LOG_SCHEMA_VERSION,
uuid::Uuid::new_v4()
);

Expand Down
2 changes: 2 additions & 0 deletions src/query/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ databend-common-management = { workspace = true }
databend-common-meta-api = { workspace = true }
databend-common-meta-app = { workspace = true }
databend-common-meta-app-types = { workspace = true }
databend-common-meta-client = { workspace = true }
databend-common-meta-kvapi = { workspace = true }
databend-common-meta-semaphore = { workspace = true }
databend-common-meta-store = { workspace = true }
databend-common-meta-types = { workspace = true }
databend-common-metrics = { workspace = true }
Expand Down
Loading