-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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: support cache in logs #4516
Conversation
WalkthroughThe recent updates introduce caching support for log queries in the query service, optimizing performance by reducing redundant data fetching. A new function, Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 3
Configuration used: CodeRabbit UI
Files selected for processing (4)
- pkg/query-service/app/querier/helper.go (4 hunks)
- pkg/query-service/app/querier/querier.go (2 hunks)
- pkg/query-service/app/queryBuilder/query_builder.go (2 hunks)
- pkg/query-service/model/v3/v3.go (1 hunks)
Additional comments: 5
pkg/query-service/app/queryBuilder/query_builder.go (2)
- 298-298: The check in
isMetricExpression
now includesv3.DataSourceLogs
. Ensure that this change aligns with the intended logic for identifying metric expressions, as it now treats log data sources similarly to metric data sources.- 323-362: In
GenerateKeys
, when generating cache keys forv3.DataSourceLogs
, ensure that all relevant query attributes are included to guarantee the uniqueness of cache keys. Also, validate the logic for assembling parts into the final cache key string for correctness and efficiency.pkg/query-service/app/querier/querier.go (2)
- 163-164: The comment explaining the use of
time.Now
for considering data ingestion delays is clear. However, ensure that relying ontime.Now
does not introduce any issues with time synchronization or testing.- 246-257: The implementation of
filterCachedPoints
correctly filters points based on the timestamp. Ensure that this function is called in the appropriate context to apply the filtering to cached series data effectively.pkg/query-service/model/v3/v3.go (1)
- 820-822: The implementation of the
CacheKey
method in theOrderBy
struct is correct and aligns with the caching strategy. It generates cache keys based onColumnName
andOrder
, which is suitable for caching purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- pkg/query-service/app/querier/helper.go (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- pkg/query-service/app/querier/helper.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- pkg/query-service/app/querier/helper.go (4 hunks)
- pkg/query-service/app/queryBuilder/query_builder.go (3 hunks)
Files skipped from review as they are similar to previous changes (2)
- pkg/query-service/app/querier/helper.go
- pkg/query-service/app/queryBuilder/query_builder.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please test various queries once. Are regular full text search also cached or only aggregation queries. I think it should only include aggregation queries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- pkg/query-service/app/querier/helper.go (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- pkg/query-service/app/querier/helper.go
Yes it's only for aggreagte queries. |
Fixes #4513
Summary by CodeRabbit