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

adding time based filter for aggregation views #181

Merged
merged 7 commits into from
Mar 14, 2023
Merged

Conversation

kotharironak
Copy link
Contributor

@kotharironak kotharironak commented Mar 12, 2023

Description

As part of Postgres implementation, it adds the support of choosing a request handler based on query request time range.
In Postgres, there was a requirement to have multiple levels of aggregations for time series metrics data - 30 secs, 5 mins, and so on. This requires different table selections based on the query request time range. So, as part of Postgres implementation, it adds the support of choosing a request handler based on the query request time range.

Testing

Added the required unit tests

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@kotharironak kotharironak marked this pull request as ready for review March 13, 2023 08:32
@kotharironak kotharironak requested review from a team and saxenakshitiz March 13, 2023 08:32
@codecov
Copy link

codecov bot commented Mar 13, 2023

Codecov Report

Merging #181 (72c9fcb) into main (952ea88) will increase coverage by 0.16%.
The diff coverage is 94.44%.

@@             Coverage Diff              @@
##               main     #181      +/-   ##
============================================
+ Coverage     78.51%   78.68%   +0.16%     
+ Complexity      856       10     -846     
============================================
  Files            80       80              
  Lines          3608     3626      +18     
  Branches        407      413       +6     
============================================
+ Hits           2833     2853      +20     
+ Misses          599      598       -1     
+ Partials        176      175       -1     
Flag Coverage Δ
integration 78.68% <94.44%> (+0.16%) ⬆️
unit 73.47% <94.44%> (+1.86%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../service/postgres/PostgresBasedRequestHandler.java 45.90% <94.44%> (+3.70%) ⬆️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

long requestEndTime = getRequestEndTime(request.getFilter());
Duration requestDuration = Duration.ofMillis(requestEndTime - requestStartTime);

if (minRequestDuration != Duration.ZERO
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to check for Duration Zero explicitly. Single compare check as below should be good enough. We will anyways have order defined in query service config, and handler will higher minDuration will be defined first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can do that. I was keeping the default handler first in the list.

With this, we have to keep the handler order from highest to lowest minRequestDuration. Logically, this is easy to maintain, addressing the comments.

e.g if there are three handlers as described in test cases, we will have to list them in the following order.

  • backend-traces-from-bare-span-event-view-5min-aggr-handler
    • minRequestDuration : 12 hrs
  • backend-traces-from-bare-span-event-view-30secs-aggr-handler
    • minRequestDuration : 3 hrs
  • backend-traces-from-bare-span-event-view-aggr-handler
    • minRequestDuration : 0 hrs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Duration requestDuration = Duration.ofMillis(requestEndTime - requestStartTime);

// check: requestDuration < minRequestDuration
if (!(requestDuration.compareTo(minRequestDuration) < 0)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!(requestDuration.compareTo(minRequestDuration) < 0)) {
if (requestDuration.compareTo(minRequestDuration) >= 0) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we are selecting a handler based on minimum cost, here, would like to reduce the cost of the hander that can server has met.

In this requestDuration.compareTo(minRequestDuration) >= 0, I don't want to change anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh! okey. I will change the boolean condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, misunderstood with the ordering of handler.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Contributor

@surajpuvvada surajpuvvada left a comment

Choose a reason for hiding this comment

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

kshitiz has already reviewed

@kotharironak kotharironak merged commit 9ef0294 into main Mar 14, 2023
@kotharironak kotharironak deleted the time-based-handler branch March 14, 2023 07:55
@github-actions
Copy link

Unit Test Results

  39 files  +1    39 suites  +1   8s ⏱️ -5s
260 tests +3  260 ✔️ +3  0 💤 ±0  0 ❌ ±0 

Results for commit 9ef0294. ± Comparison against base commit 952ea88.

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.

4 participants