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

Log detailed elasticsearch params #139

Merged
merged 6 commits into from
Nov 15, 2023
Merged

Conversation

ashultz0
Copy link
Contributor

@ashultz0 ashultz0 commented Nov 15, 2023

We need to know exactly what we are asking elasticsearch sometimes to debug problems. But we would prefer not to log it for all uses or force logging on openedx in general.

After a bunch of cleanup to make working in here a little easier and a new make target for local installation, I added a new log parameter to the general search arg and activates it for elasticsearch. Then I added a setting to turn this flag on for courseware search which is the place we currently need it, other settings can come later if desired.

After this is ready I'll add a default setting of False in platform lms and a devstack setting of True, and then some settings for edX proper in the internal settings repo to turn it on.

Sample local log

2023-11-15 21:24:56,566 INFO 107 [search.elastic] [user None] [ip 172.19.0.1] elastic.py:658 - full elastic search body {'query': {'bool': {'must': {'bool': {'must': [{'query_string': {'fields': ['content.*'], 'query': 'problem'}}, {'term': {'course': 'course-v1:edX+DemoX+Demo_Course'}}]}}, 'filter': {'bool': {'should': [{'range': {'start_date': {'lte': '2023-11-15T21:24:56.516152'}}}, {'bool': {'must_not': {'exists': {'field': 'start_date'}}}}]}}}}}

@ashultz0 ashultz0 marked this pull request as draft November 15, 2023 20:54
@ashultz0 ashultz0 force-pushed the ashultz0/detailed-elastic-params branch from 6ddc767 to c4d4c6e Compare November 15, 2023 20:56
@ashultz0 ashultz0 marked this pull request as ready for review November 15, 2023 21:32
@ashultz0
Copy link
Contributor Author

codecov is complaining because of one line not covered (the actual log), doesn't seem worth a whole test case.

Copy link

@schenedx schenedx left a comment

Choose a reason for hiding this comment

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

👍 I like how logging is now controlled by settings.

We don't want to trigger logging on every single ES search
or force logging into other courseware search uses, so
arg + setting just for courseware search.

Fairly awkward test brought to you via the repository's 100%
coverage policy, but it does ensure the log line is reached
and does not error.
@ashultz0 ashultz0 force-pushed the ashultz0/detailed-elastic-params branch from c4d4c6e to 7b4df58 Compare November 15, 2023 21:50
@ashultz0 ashultz0 merged commit 93939ba into master Nov 15, 2023
7 checks passed
@ashultz0 ashultz0 deleted the ashultz0/detailed-elastic-params branch November 15, 2023 21:55
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.

2 participants