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

Improve Query Log suggestions #2001

Draft
wants to merge 4 commits into
base: development-v6
Choose a base branch
from
Draft

Conversation

DL6ER
Copy link
Member

@DL6ER DL6ER commented Jun 25, 2024

What does this implement/fix?

Implement actual TOP suggestions for the Query Log by ensuring the most relevant domains and clients are returned (sorted by the most active being at the top) by the API /api/queries/suggestions endpoint. The result of this is used in the dropdown menus on the Query Log Advanced Filtering box:

image


Related issue or feature (if applicable): Discourse

Pull request in docs with documentation (if applicable): N/A


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)

Checklist:

  • The code change is tested and works locally.
  • I based my code and PRs against the repositories developmental branch.
  • I signed off all commits. Pi-hole enforces the DCO for all contributions
  • I signed all my commits. Pi-hole requires signatures to verify authorship
  • I have read the above and my PR is ready for review.

Comment on lines -8 to +14
ENV CI_ARCH ${CI_ARCH}
ENV CI_ARCH=${CI_ARCH}
ARG GIT_BRANCH="test"
ENV GIT_BRANCH ${GIT_BRANCH}
ENV GIT_BRANCH=${GIT_BRANCH}
ARG GIT_TAG="test"
ENV GIT_TAG ${GIT_TAG}
ENV GIT_TAG=${GIT_TAG}
ARG BUILD_OPTS=""
ENV BUILD_OPTS ${BUILD_OPTS}
ENV BUILD_OPTS=${BUILD_OPTS}
Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing CI warnings

 4 warnings found (use --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 8)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 10)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 12)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 14)

@pralor-bot
Copy link

This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/unable-to-select-correct-client-by-name-in-advanced-filter/70863/20

@DL6ER DL6ER marked this pull request as ready for review June 27, 2024 07:59
@DL6ER DL6ER requested a review from a team June 27, 2024 08:00
@DL6ER
Copy link
Member Author

DL6ER commented Jun 27, 2024

Confirmed working by OP on Discourse

Copy link
Member

@yubiuser yubiuser left a comment

Choose a reason for hiding this comment

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

First, this PR is a great enhancement for the suggested domains/clients.

But I would like to suggest to return other data than it is returning right now: Currently, it returns the max_count items from the resp. SQL queries. Esp. for domains this might be undesired. If I have a lot of high count permitted domains, but only a low count number of blocked domains, it will return only permitted domains as suggestions. But I think it should return both top allowed and top blocked domains. So maybe we could instead re-use the data we have for the top domains already (/stats/top_domain) and use those as suggestions instead?
For dis

@DL6ER
Copy link
Member Author

DL6ER commented Jun 29, 2024

But I think it should return both top allowed and top blocked domains.

Yes, we can make this return, e.g. 30 top permitted and 30 top blocked domains just to populate the dropdown.

maybe we could instead re-use the data we have for the top domains already (/stats/top_domain) and use those as suggestions instead?

This endpoint still uses the internal data structure and does not use the database. On the one hand, this data is already pre-processed and accessing it is fast, on the other hand, accessing this data blocks DNS resolution during the time it is accessed and is not very flexible. I will think about this, maybe we just don't need any flexibility here.

@DL6ER DL6ER marked this pull request as draft June 29, 2024 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants