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

Fix the printing of ascii codes on tracy and improve some tracing #341

Merged
merged 2 commits into from
Sep 30, 2023

Conversation

mamcx
Copy link
Contributor

@mamcx mamcx commented Sep 29, 2023

Description of Changes

This helps to visualize tracy events better.

API and ABI

  • This is a breaking change to the module ABI
  • This is a breaking change to the module API
  • This is a breaking change to the ClientAPI
  • This is a breaking change to the SDK API

If the API is breaking, please state below what will break

crates/core/src/db/relational_db.rs Show resolved Hide resolved
@@ -466,7 +466,7 @@ impl RelationalDB {
/// where the column data identified by `cols` matches `value`.
///
/// Matching is defined by `Ord for AlgebraicValue`.
#[tracing::instrument(skip(self, tx))]
#[tracing::instrument(skip(self, tx, value))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual table and column names would be useful to capture here, but because we only have the IDs, it's probably ok to just skip_all.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the table id might be useful tbh

@@ -494,7 +494,7 @@ impl RelationalDB {
.iter_by_col_range_mut_tx(tx, TableId(table_id), ColId(col_id), range)
}

#[tracing::instrument(skip(self, tx))]
#[tracing::instrument(skip(self, tx, row))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here.

@@ -43,7 +43,7 @@ impl InstanceEnv {
}
}

#[tracing::instrument(skip_all)]
#[tracing::instrument(skip_all, fields(reducer=reducer))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@@ -339,7 +339,7 @@ impl<T: WasmInstance> ModuleInstance for WasmModuleInstance<T> {
self.trapped
}

#[tracing::instrument(skip(args))]
#[tracing::instrument(skip(self, args), fields(db_id=self.instance.instance_env().dbic.database_id))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By calling self.instance.instance_env().dbic.database_id won't this add overhead to the init_database call that won't be reflective of its true characteristics?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually instance_env() shouldn't add any meaningful overhead, but we probably want to avoid calling arbitrary methods as part of trace logging since in general we don't know exactly how much overhead that will add to the span.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks minimal:

    fn instance_env(&self) -> &InstanceEnv {
        &self.env.as_ref(&self.store).instance_env
    }

Also this is only in the init of the db. The rest of the calls should take more time...

@@ -52,7 +52,7 @@ fn collect_result(result: &mut Vec<MemTable>, r: CodeResult) -> Result<(), DBErr
Ok(())
}

#[tracing::instrument(skip(db, tx, auth))]
#[tracing::instrument(skip_all)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should create a ticket to capture the actual sql string here that we compiled earlier.

Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
@cloutiertyler cloutiertyler enabled auto-merge (squash) September 30, 2023 06:07
@cloutiertyler cloutiertyler merged commit 3d1d98c into master Sep 30, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants