mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
Setup tracing and document tracing usage (#12730)
This commit is contained in:
parent
5107a50ae7
commit
dc6aafecc2
21 changed files with 513 additions and 160 deletions
|
@ -34,7 +34,7 @@ type SymbolMap = hashbrown::HashMap<ScopedSymbolId, (), ()>;
|
|||
/// Prefer using [`symbol_table`] when working with symbols from a single scope.
|
||||
#[salsa::tracked(return_ref, no_eq)]
|
||||
pub(crate) fn semantic_index(db: &dyn Db, file: File) -> SemanticIndex<'_> {
|
||||
let _span = tracing::trace_span!("semantic_index", file=?file.path(db)).entered();
|
||||
let _span = tracing::trace_span!("semantic_index", file = %file.path(db)).entered();
|
||||
|
||||
let parsed = parsed_module(db.upcast(), file);
|
||||
|
||||
|
@ -50,7 +50,7 @@ pub(crate) fn semantic_index(db: &dyn Db, file: File) -> SemanticIndex<'_> {
|
|||
pub(crate) fn symbol_table<'db>(db: &'db dyn Db, scope: ScopeId<'db>) -> Arc<SymbolTable> {
|
||||
let file = scope.file(db);
|
||||
let _span =
|
||||
tracing::trace_span!("symbol_table", scope=?scope.as_id(), file=?file.path(db)).entered();
|
||||
tracing::trace_span!("symbol_table", scope=?scope.as_id(), file=%file.path(db)).entered();
|
||||
let index = semantic_index(db, file);
|
||||
|
||||
index.symbol_table(scope.file_scope_id(db))
|
||||
|
@ -65,7 +65,7 @@ pub(crate) fn symbol_table<'db>(db: &'db dyn Db, scope: ScopeId<'db>) -> Arc<Sym
|
|||
pub(crate) fn use_def_map<'db>(db: &'db dyn Db, scope: ScopeId<'db>) -> Arc<UseDefMap<'db>> {
|
||||
let file = scope.file(db);
|
||||
let _span =
|
||||
tracing::trace_span!("use_def_map", scope=?scope.as_id(), file=?file.path(db)).entered();
|
||||
tracing::trace_span!("use_def_map", scope=?scope.as_id(), file=%file.path(db)).entered();
|
||||
let index = semantic_index(db, file);
|
||||
|
||||
index.use_def_map(scope.file_scope_id(db))
|
||||
|
@ -74,7 +74,7 @@ pub(crate) fn use_def_map<'db>(db: &'db dyn Db, scope: ScopeId<'db>) -> Arc<UseD
|
|||
/// Returns the module global scope of `file`.
|
||||
#[salsa::tracked]
|
||||
pub(crate) fn global_scope(db: &dyn Db, file: File) -> ScopeId<'_> {
|
||||
let _span = tracing::trace_span!("global_scope", file=?file.path(db)).entered();
|
||||
let _span = tracing::trace_span!("global_scope", file = %file.path(db)).entered();
|
||||
|
||||
FileScopeId::global().to_scope_id(db, file)
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ use crate::Db;
|
|||
pub(crate) fn infer_scope_types<'db>(db: &'db dyn Db, scope: ScopeId<'db>) -> TypeInference<'db> {
|
||||
let file = scope.file(db);
|
||||
let _span =
|
||||
tracing::trace_span!("infer_scope_types", scope=?scope.as_id(), file=?file.path(db))
|
||||
tracing::trace_span!("infer_scope_types", scope=?scope.as_id(), file=%file.path(db))
|
||||
.entered();
|
||||
|
||||
// Using the index here is fine because the code below depends on the AST anyway.
|
||||
|
@ -83,7 +83,7 @@ pub(crate) fn infer_definition_types<'db>(
|
|||
let _span = tracing::trace_span!(
|
||||
"infer_definition_types",
|
||||
definition = ?definition.as_id(),
|
||||
file = ?file.path(db)
|
||||
file = %file.path(db)
|
||||
)
|
||||
.entered();
|
||||
|
||||
|
@ -104,7 +104,7 @@ pub(crate) fn infer_expression_types<'db>(
|
|||
) -> TypeInference<'db> {
|
||||
let file = expression.file(db);
|
||||
let _span =
|
||||
tracing::trace_span!("infer_expression_types", expression=?expression.as_id(), file=?file.path(db))
|
||||
tracing::trace_span!("infer_expression_types", expression=?expression.as_id(), file=%file.path(db))
|
||||
.entered();
|
||||
|
||||
let index = semantic_index(db, file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue