Skip to content

Metrics combination API supports abandoning results#6318

Merged
kezhenxu94 merged 2 commits intomasterfrom
enhance/metrics-combination
Feb 4, 2021
Merged

Metrics combination API supports abandoning results#6318
kezhenxu94 merged 2 commits intomasterfrom
enhance/metrics-combination

Conversation

@kezhenxu94
Copy link
Member

@kezhenxu94 kezhenxu94 requested a review from wu-sheng February 4, 2021 04:28
@kezhenxu94 kezhenxu94 added backend OAP backend related. enhancement Enhancement on performance or codes labels Feb 4, 2021
@kezhenxu94 kezhenxu94 added this to the 8.5.0 milestone Feb 4, 2021
@codecov
Copy link

codecov bot commented Feb 4, 2021

Codecov Report

Merging #6318 (a42823c) into master (f44ed75) will increase coverage by 3.44%.
The diff coverage is 53.48%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #6318      +/-   ##
============================================
+ Coverage     49.57%   53.02%   +3.44%     
- Complexity     3452     3842     +390     
============================================
  Files           952     1731     +779     
  Lines         23656    36910   +13254     
  Branches       2315     4080    +1765     
============================================
+ Hits          11728    19572    +7844     
- Misses        10915    16361    +5446     
+ Partials       1013      977      -36     
Impacted Files Coverage Δ Complexity Δ
...erver/core/analysis/data/MergableBufferedData.java 66.66% <0.00%> (-33.34%) 4.00 <0.00> (ø)
...ore/analysis/meter/function/HistogramFunction.java 56.25% <0.00%> (+56.25%) 0.00 <0.00> (ø)
...re/analysis/meter/function/PercentileFunction.java 12.19% <0.00%> (+12.19%) 0.00 <0.00> (ø)
...lysis/meter/function/avg/AvgHistogramFunction.java 62.79% <0.00%> (+62.79%) 0.00 <0.00> (ø)
...nalysis/meter/function/avg/AvgLabeledFunction.java 58.13% <0.00%> (+58.13%) 0.00 <0.00> (ø)
...analysis/meter/function/latest/LatestFunction.java 50.00% <0.00%> (+50.00%) 0.00 <0.00> (ø)
...server/core/analysis/metrics/MaxDoubleMetrics.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...king/oap/server/core/analysis/metrics/Metrics.java 90.90% <ø> (+27.27%) 10.00 <0.00> (ø)
...server/core/analysis/metrics/MinDoubleMetrics.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...g/oap/server/core/analysis/metrics/PxxMetrics.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
... and 1280 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f44ed75...78ea166. Read the comment docs.

if (isAbandoned) {
cachedMetrics.calculate();
prepareRequests.add(metricsDAO.prepareBatchUpdate(model, cachedMetrics));
nextWorker(cachedMetrics);
Copy link
Member

Choose a reason for hiding this comment

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

Should be add else continue here, rather than adding if (!isAbandoned) at L190?

@kezhenxu94 kezhenxu94 force-pushed the enhance/metrics-combination branch from 8dbc02c to 4704c12 Compare February 4, 2021 07:32
* Merge the given metrics instance, these two must be the same metrics type.
*
* @param metrics to be merged
* @return {@code true} if the combined metrics should be continuously processed, {@code false} it should be abandoned.
Copy link
Member

@wu-sheng wu-sheng Feb 4, 2021

Choose a reason for hiding this comment

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

Suggested change
* @return {@code true} if the combined metrics should be continuously processed, {@code false} it should be abandoned.
* @return {@code true} if the combined metrics should be continuously processed. {@code false} means it should be abandoned, and the implementation needs to keep the data unaltered in this case.

I add a little more to the comments, from my code reading, if the change has been made, the data will still flush into the database eventually.

Copy link
Member

Choose a reason for hiding this comment

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

Also, I feel the data in the cache has refreshed repeatedly into database even without change, could you recheck about this too? If so, we need to fix that in another PR, which should be able to reduce the database load.

Copy link
Member

Choose a reason for hiding this comment

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

Also, I feel the data in the cache has refreshed repeatedly into database even without change, could you recheck about this too? If so, we need to fix that in another PR, which should be able to reduce the database load.

@kezhenxu94 ⬆️ What do you think about this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because only limited Event data falls into this case, this may be not a big problem for now. Anyway, let me check and think about how to deal with this

Copy link
Member

Choose a reason for hiding this comment

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

I don't mean the change you made, I mean for all metrics, if the metrics exist in the cache, even no update, they are keeping being updated periodly.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't mean the change you made, I mean for all metrics, if the metrics exist in the cache, even no update, they are keeping being updated periodly.

OK I mistakenly thought you only referred to the "abandoned" metrics, it makes sense to me now, I'll check

…/server/core/analysis/metrics/Metrics.java

Co-authored-by: 吴晟 Wu Sheng <wu.sheng@foxmail.com>
@kezhenxu94 kezhenxu94 merged commit 1e78a0a into master Feb 4, 2021
@kezhenxu94 kezhenxu94 deleted the enhance/metrics-combination branch February 4, 2021 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend OAP backend related. enhancement Enhancement on performance or codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants