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(qe): filter-in debug traces for mongo db queries regardless of global logger level #3310

Merged
merged 1 commit into from Oct 28, 2022

Conversation

miguelff
Copy link
Collaborator

Fixes prisma/prisma#15084

#2752 added mongo logging, and as part of that it changed the logging configuration for the node API to ensure that regardless of their level, mongo queries were always logged:

let is_mongo_query = filter_fn(|meta| meta.target() == "mongodb_query_connector::query");
// We need to filter the messages to send to our callback logging mechanism
let filters = if log_queries {
// Filter trace query events (for query log) or based in the defined log level
is_sql_query.or(is_mongo_query).or(log_level).boxed()
} else {
// Filter based in the defined log level
FilterExt::boxed(log_level)
};

However, the same change wasn't added to the query-engine server logging configuration. And because mongo logs queries using the tracing's debug macro. Those traces weren't emitted to standard output, and eventually processed by the Prisma client.

This patch fixes the situation by configuring the logger for the query-engine server to select queries logged in debug mode.

@CLAassistant
Copy link

CLAassistant commented Oct 20, 2022

CLA assistant check
All committers have signed the CLA.

@miguelff miguelff added this to the 4.6.0 milestone Oct 20, 2022
@miguelff miguelff force-pushed the query-engine/mongo-logging-fix branch from 05e77fc to 7c3c15e Compare October 20, 2022 16:00
Copy link
Contributor

@garrensmith garrensmith left a comment

Choose a reason for hiding this comment

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

Great investigation and fix.

@miguelff miguelff force-pushed the query-engine/mongo-logging-fix branch 2 times, most recently from 48260c1 to 54d2df8 Compare October 21, 2022 08:01
Fixes prisma/prisma#15084

The logging logic should be consolidated and abstracted away
Copy link
Contributor

@danstarns danstarns left a comment

Choose a reason for hiding this comment

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

Client test suite here: prisma/prisma#15957

@miguelff miguelff merged commit ddd31e0 into main Oct 28, 2022
@miguelff miguelff deleted the query-engine/mongo-logging-fix branch October 28, 2022 07:48
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.

MongoDB does not log queries with binary Engine
4 participants