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: removed caching for all other panel type for expression apart fr… #6720

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

aniketio-ctrl
Copy link

@aniketio-ctrl aniketio-ctrl commented Dec 26, 2024

…om graph in v3 | 6484

Summary

Issue: Wrong caching for metric expressions apart from panel type graph in v3
According to current implementation , we are not caching queries, we are only caching expressions, we are caching if the panel type is graph, so if we are not caching single value panel type queries, we should not also be caching the result of the expression.

for eg-
If the expression is 'A+B', caching key would be '+' that dosen't consider the fact that wether A or B were same or not.

So while creating caching keys for expression , added a check if the version is not v4 then don't proceed unless its panelType: Graph

Related Issues / PR's

#6484

Screenshots

We are getting cached result with actual result which are vague

Screenshot 2024-12-26 at 1 10 25 PM

Affected Areas and Manually Tested Areas

Manually tested Aread ->
1.) Api -> /api/v3/query_range, tested with different panel type and checking wether we were getting correct result or not


Important

Fix caching behavior in GenerateKeys of query_builder.go to skip non-graph panel types in non-v4 versions.

  • Behavior:
    • In GenerateKeys of query_builder.go, skip caching for expressions if version is not v4 and panel type is not Graph.
  • Caching:
    • Ensures caching only for Graph panel type in non-v4 versions to prevent incorrect cache results for other panel types.

This description was created by Ellipsis for 9fb7160. It will automatically update as commits are pushed.

Copy link

welcome bot commented Dec 26, 2024

Welcome to the SigNoz community! Thank you for your first pull request and making this project better. 🤗

@CLAassistant
Copy link

CLAassistant commented Dec 26, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ srikanthccv
❌ Aniket


Aniket seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added the bug Something isn't working label Dec 26, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 9fb7160 in 24 seconds

More details
  • Looked at 14 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. pkg/query-service/app/queryBuilder/query_builder.go:444
  • Draft comment:
    The condition if params.Version != "v4" && params.CompositeQuery.PanelType != v3.PanelTypeGraph is used to prevent caching for non-graph panel types in v3. Ensure this logic is consistently applied across all relevant sections of the codebase where caching decisions are made.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. pkg/query-service/app/queryBuilder/query_builder.go:441
  • Draft comment:
    Avoid using the component/index.tsx file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_kcYtJwZHBSWRlKEG


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@srikanthccv
Copy link
Member

srikanthccv commented Dec 27, 2024

@aniketio-ctrl, please add test and sign cla

func TestGenerateCacheKeysMetricsBuilder(t *testing.T) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants