-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support ObservabilityConfig in protobuf_config
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |