Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Emit query log in quaint:query span, rather than in its parent #431

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Changes from all 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
10 changes: 9 additions & 1 deletion src/connector/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ where
U: Future<Output = crate::Result<T>>,
{
let span = info_span!("quaint:query", "db.statement" = %query);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the query engine binary and node API, This span is filtered-in by target , because it is user facing but doesn't have a user_facing attribute. Should we add the attribute to prevent this additional filtering based on the target?

I know, it's coupling quiant to engine needs. But isn't that already based on all the tracing features added to it?

do_query(tag, query, params, f).instrument(span).await
}

async fn do_query<'a, F, T, U>(tag: &'static str, query: &'a str, params: &'a [Value<'_>], f: F) -> crate::Result<T>
where
F: FnOnce() -> U + 'a,
U: Future<Output = crate::Result<T>>,
{
let start = Instant::now();
let res = f().instrument(span).await;
let res = f().await;

let result = match res {
Ok(_) => "success",
Expand Down