Skip to content

Commit

Permalink
Merge pull request #4611 from systeminit/brit/add-instrumentation
Browse files Browse the repository at this point in the history
add instrumentation
  • Loading branch information
britmyerss authored Sep 17, 2024
2 parents ae22720 + c0d0443 commit 522193d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
17 changes: 17 additions & 0 deletions lib/dal/src/attribute/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,13 @@ impl AttributeValue {
Ok(av)
}

#[instrument(
name = "attribute_value.update",
level = "info",
skip_all,
fields(
attribute_value.id = ?attribute_value_id
))]
pub async fn update(
ctx: &DalContext,
attribute_value_id: AttributeValueId,
Expand Down Expand Up @@ -1885,6 +1892,13 @@ impl AttributeValue {
Ok(())
}

#[instrument(
name = "attribute_value.set_value",
level = "info",
skip_all,
fields(
attribute_value.id = ?attribute_value_id
))]
pub async fn set_value(
ctx: &DalContext,
attribute_value_id: AttributeValueId,
Expand Down Expand Up @@ -1960,15 +1974,18 @@ impl AttributeValue {
}
None => serde_json::Value::Null,
};
let total_start = std::time::Instant::now();

let result_channel =
FuncRunner::run_attribute_value(ctx, attribute_value_id, func_id, func_args)
.await
.map_err(Box::new)?;
info!("Getting channel took: {:?}", total_start.elapsed());
let func_values = result_channel
.await
.map_err(|_| AttributeValueError::FuncRunnerSend)?
.map_err(Box::new)?;
info!("Waiting for values took: {:?}", total_start.elapsed());

Self::set_real_values(ctx, attribute_value_id, func_values).await?;
Ok(())
Expand Down
7 changes: 7 additions & 0 deletions lib/dal/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,13 @@ impl Component {
result: ComponentResult,
);

#[instrument(
name = "component.new",
level = "info",
skip_all,
fields(
schema_variant.id = ?schema_variant_id
))]
pub async fn new(
ctx: &DalContext,
name: impl Into<String>,
Expand Down
4 changes: 2 additions & 2 deletions lib/dal/src/func/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ impl FuncRunner {

#[instrument(
name = "func_runner.run_attribute_value",
level = "debug",
level = "info",
skip_all,
fields(
job.id = Empty,
Expand Down Expand Up @@ -672,7 +672,7 @@ impl FuncRunner {
// and in order to time the function's preparation vs. execution timings.
#[instrument(
name = "func_runner.run_attribute_value.prepare",
level = "debug",
level = "info",
skip_all,
fields()
)]
Expand Down

0 comments on commit 522193d

Please sign in to comment.