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

Improve logging for indexer models and processors #505

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use aptos_protos::transaction::v1::{
};
use field_count::FieldCount;
use serde::{Deserialize, Serialize};
use tracing::log::error;
dermanyang marked this conversation as resolved.
Show resolved Hide resolved

#[derive(
Associations, Clone, Debug, Deserialize, FieldCount, Identifiable, Insertable, Serialize,
Expand All @@ -42,7 +43,7 @@ impl WriteSetChange {
transaction_version: i64,
transaction_block_height: i64,
) -> (Self, WriteSetChangeDetail) {
let type_ = Self::get_write_set_change_type(write_set_change);
let type_ = Self::get_write_set_change_type(write_set_change, transaction_version);
let change = write_set_change
.change
.as_ref()
Expand Down Expand Up @@ -179,7 +180,7 @@ impl WriteSetChange {
.unzip()
}

fn get_write_set_change_type(t: &WriteSetChangePB) -> String {
fn get_write_set_change_type(t: &WriteSetChangePB, txn_version: i64) -> String {
match WriteSetChangeTypeEnum::try_from(t.r#type)
.expect("WriteSetChange must have a valid type.")
{
Expand All @@ -190,6 +191,10 @@ impl WriteSetChange {
WriteSetChangeTypeEnum::WriteResource => "write_resource".to_string(),
WriteSetChangeTypeEnum::WriteTableItem => "write_table_item".to_string(),
WriteSetChangeTypeEnum::Unspecified => {
error!(
"Encountered Unspecified WriteSetChange type. Transaction Version: {}",
dermanyang marked this conversation as resolved.
Show resolved Hide resolved
txn_version
);
panic!("WriteSetChange type must be specified.")
},
}
Expand Down
2 changes: 2 additions & 0 deletions rust/processor/src/processors/ans_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ fn parse_ans(
.unwrap_or_else(|e| {
error!(
error = ?e,
write_set_change_index = wsc_index,
dermanyang marked this conversation as resolved.
Show resolved Hide resolved
"Error parsing ANS v1 name record from write table item"
);
panic!();
Expand All @@ -608,6 +609,7 @@ fn parse_ans(
.unwrap_or_else(|e| {
error!(
error = ?e,
write_set_change_index = wsc_index,
"Error parsing ANS v1 primary name from write table item"
);
panic!();
Expand Down
Loading