Skip to content
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

feat(vlog): Report observability config, flush, and shutdown #2622

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion core/lib/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ zksync_crypto_primitives.workspace = true
zksync_consensus_utils.workspace = true
zksync_concurrency.workspace = true
zksync_vlog = { workspace = true, optional = true }
tracing = { workspace = true, optional = true }

url.workspace = true
anyhow.workspace = true
Expand All @@ -25,4 +26,4 @@ serde = { workspace = true, features = ["derive"] }

[features]
default = []
observability_ext = ["zksync_vlog"]
observability_ext = ["zksync_vlog", "tracing"]
3 changes: 3 additions & 0 deletions core/lib/config/src/observability_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ impl ObservabilityConfig {
.with_sentry(sentry)
.with_opentelemetry(opentelemetry)
.build();

tracing::info!("Installed observability stack with the following configuration: {self:?}");

Ok(guard)
}
}
Expand Down
8 changes: 8 additions & 0 deletions core/lib/vlog/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl ObservabilityGuard {

if let Some(sentry_guard) = &self.sentry_guard {
sentry_guard.flush(Some(FLUSH_TIMEOUT));
tracing::info!("Sentry events are flushed");
}

if let Some(provider) = &self.otlp_tracing_provider {
Expand All @@ -50,6 +51,7 @@ impl ObservabilityGuard {
tracing::warn!("Flushing the spans failed: {err:?}");
}
}
tracing::info!("Spans are flushed");
}

if let Some(provider) = &self.otlp_logging_provider {
Expand All @@ -58,6 +60,7 @@ impl ObservabilityGuard {
tracing::warn!("Flushing the logs failed: {err:?}");
}
}
tracing::info!("Logs are flushed");
}
}

Expand All @@ -70,15 +73,20 @@ impl ObservabilityGuard {
// `take` here and below ensures that we don't have any access to the deinitialized resources.
if let Some(sentry_guard) = self.sentry_guard.take() {
sentry_guard.close(Some(SHUTDOWN_TIMEOUT));
tracing::info!("Sentry client is shut down");
}
if let Some(provider) = self.otlp_tracing_provider.take() {
if let Err(err) = provider.shutdown() {
tracing::warn!("Shutting down the OTLP tracing provider failed: {err:?}");
} else {
tracing::info!("OTLP tracing provider is shut down");
}
}
if let Some(provider) = self.otlp_logging_provider.take() {
if let Err(err) = provider.shutdown() {
tracing::warn!("Shutting down the OTLP logs provider failed: {err:?}");
} else {
tracing::info!("OTLP logs provider is shut down");
}
}
}
Expand Down
Loading