Skip to content

Commit

Permalink
Support ObservabilityConfig in protobuf_config
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Feb 20, 2024
1 parent 2682d46 commit afddc96
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/lib/protobuf_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mod fri_witness_generator;
mod fri_witness_vector_generator;
mod house_keeper;
mod object_store;
mod observability;
mod proof_data_handler;
mod snapshots_creator;
mod witness_generator;
Expand Down
24 changes: 24 additions & 0 deletions core/lib/protobuf_config/src/observability.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use anyhow::Context as _;
use zksync_config::configs;
use zksync_protobuf::required;

use crate::{proto, repr::ProtoRepr};

impl ProtoRepr for proto::Observability {
type Type = configs::ObservabilityConfig;
fn read(&self) -> anyhow::Result<Self::Type> {
Ok(Self::Type {
sentry_url: self.sentry_url.clone(),
sentry_environment: self.sentry_environment.clone(),
log_format: required(&self.log_format).context("log_format")?.clone(),
})
}

fn build(this: &Self::Type) -> Self {
Self {
sentry_url: this.sentry_url.clone(),
sentry_environment: this.sentry_environment.clone(),
log_format: Some(this.log_format.clone()),
}
}
}
9 changes: 9 additions & 0 deletions core/lib/protobuf_config/src/proto/observability.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

package zksync.config;

message Observability {
optional string sentry_url = 1; // optional
optional string sentry_environment = 2; // optional
optional string log_format = 3; // required
}

0 comments on commit afddc96

Please sign in to comment.