-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[State Sync] Add initial logging support to the Data Streaming Service.
- Loading branch information
1 parent
ddc74bf
commit 324407b
Showing
12 changed files
with
242 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
50 changes: 50 additions & 0 deletions
50
state-sync/state-sync-v2/data-streaming-service/src/logging.rs
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,50 @@ | ||
// Copyright (c) The Diem Core Contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::error::Error; | ||
use diem_logger::Schema; | ||
use serde::Serialize; | ||
|
||
#[derive(Schema)] | ||
pub struct LogSchema<'a> { | ||
name: LogEntry, | ||
error: Option<&'a Error>, | ||
event: Option<LogEvent>, | ||
message: Option<&'a str>, | ||
stream_id: Option<u64>, | ||
} | ||
|
||
impl<'a> LogSchema<'a> { | ||
pub fn new(name: LogEntry) -> Self { | ||
Self { | ||
name, | ||
error: None, | ||
event: None, | ||
message: None, | ||
stream_id: None, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, Copy, Serialize)] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum LogEntry { | ||
CheckStreamProgress, | ||
DiemDataClient, | ||
EndOfStreamNotification, | ||
HandleStreamRequest, | ||
InitializeStream, | ||
ReceivedDataResponse, | ||
RefreshGlobalData, | ||
RespondToStreamRequest, | ||
SendDataRequests, | ||
StreamNotification, | ||
} | ||
|
||
#[derive(Clone, Copy, Serialize)] | ||
#[serde(rename_all = "snake_case")] | ||
pub enum LogEvent { | ||
Error, | ||
Pending, | ||
Success, | ||
} |
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
Oops, something went wrong.