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

feat: configurable caching for postgres with support for tracing #5082

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3e55df0
feat: configurable caching with support for tracing
jacek-prisma Dec 10, 2024
64e8809
fix: correct TypedQuery creation
jacek-prisma Dec 10, 2024
8ac2709
fix: store columns in TypedQuery
jacek-prisma Dec 10, 2024
853e957
fix: store column names as well
jacek-prisma Dec 10, 2024
01f7b20
fix: define aliases and fix some references to PostgreSql
jacek-prisma Dec 11, 2024
e530872
chore: doc comments and cleanup
jacek-prisma Dec 11, 2024
d40b7ed
chore: doc comment adjustments and renames
jacek-prisma Dec 11, 2024
3e64697
test: cover the queries and caches
jacek-prisma Dec 11, 2024
f46a0cb
fix: actually pass tracing flag
jacek-prisma Dec 11, 2024
153c109
refactor: merge the two prepared query caches
jacek-prisma Dec 11, 2024
17c1994
fix: make sure to return the caller-provided sql with TypedQuery
jacek-prisma Dec 11, 2024
dd5f258
chore: get rid of some unneeded accessors
jacek-prisma Dec 11, 2024
2d29f08
chore: update assertion text
jacek-prisma Dec 11, 2024
496f527
doc: clarify comment
jacek-prisma Dec 11, 2024
c6bac2d
chore: use rsplit because we expect traceparent at the end
jacek-prisma Dec 11, 2024
bb7f292
doc: correct comment
jacek-prisma Dec 12, 2024
4495934
test: cover higher capacity in the tests
jacek-prisma Dec 12, 2024
160f02e
Merge remote-tracking branch 'upstream/main' into feat/caching-for-tr…
jacek-prisma Dec 13, 2024
76d35cb
[integration]
jacek-prisma Dec 13, 2024
52e1920
chore: correct typo
jacek-prisma Dec 13, 2024
5c333e4
fix: remove unneeded outlives trick
jacek-prisma Dec 13, 2024
a5078e1
chore: less annoying trace message
jacek-prisma Dec 13, 2024
2a336b3
chore: switch over to tokio mutex
jacek-prisma Dec 13, 2024
52c5e61
refactor: use a NoOp hasher
jacek-prisma Dec 13, 2024
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
29 changes: 14 additions & 15 deletions quaint/src/connector/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,19 @@ struct QueryForTracing<'a>(&'a str);

impl fmt::Display for QueryForTracing<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let query = self
.0
.split_once("/* traceparent=")
.map_or(self.0, |(str, remainder)| {
if remainder
.split_once("*/")
.is_some_and(|(_, suffix)| suffix.trim_end().is_empty())
{
str
} else {
self.0
}
})
.trim();
write!(f, "{query}")
write!(f, "{}", strip_query_traceparent(self.0))
}
}

pub(super) fn strip_query_traceparent(query: &str) -> &str {
query.rsplit_once("/* traceparent=").map_or(query, |(str, remainder)| {
aqrln marked this conversation as resolved.
Show resolved Hide resolved
if remainder
.split_once("*/")
.is_some_and(|(_, suffix)| suffix.trim_end().is_empty())
{
str.trim_end()
} else {
query
}
})
}
Loading
Loading