Skip to content

[Feature][Metrics] Add resource download related metrics for workers#10749

Merged
EricGao888 merged 9 commits intoapache:devfrom
EricGao888:Fix-9324-add-resource-related-metrics
Jul 12, 2022
Merged

[Feature][Metrics] Add resource download related metrics for workers#10749
EricGao888 merged 9 commits intoapache:devfrom
EricGao888:Fix-9324-add-resource-related-metrics

Conversation

@EricGao888
Copy link
Copy Markdown
Member

@EricGao888 EricGao888 commented Jul 3, 2022

Purpose of the pull request

Brief change log

Added following metrics:

  • ds.worker.resource.download.count, sliced by tag status
  • ds.worker.resource.download.duration
  • ds.worker.resource.download.size

Verify this pull request

  • Verified by manual test.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 3, 2022

Codecov Report

Merging #10749 (534c647) into dev (aa8b88a) will increase coverage by 0.05%.
The diff coverage is 83.78%.

❗ Current head 534c647 differs from pull request most recent head d444411. Consider uploading reports for the commit d444411 to get more accurate results

@@             Coverage Diff              @@
##                dev   #10749      +/-   ##
============================================
+ Coverage     40.13%   40.19%   +0.05%     
- Complexity     4843     4844       +1     
============================================
  Files           940      940              
  Lines         36945    36982      +37     
  Branches       4033     4033              
============================================
+ Hits          14828    14864      +36     
+ Misses        20630    20625       -5     
- Partials       1487     1493       +6     
Impacted Files Coverage Δ
...eduler/server/worker/runner/TaskExecuteThread.java 19.25% <66.66%> (+1.42%) ⬆️
...ler/server/worker/metrics/WorkerServerMetrics.java 72.91% <87.09%> (+72.91%) ⬆️
...er/master/dispatch/host/assign/RandomSelector.java 77.77% <0.00%> (-5.56%) ⬇️
...e/dolphinscheduler/remote/NettyRemotingClient.java 50.00% <0.00%> (-1.39%) ⬇️
...org/apache/dolphinscheduler/remote/utils/Host.java 45.65% <0.00%> (+2.17%) ⬆️

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 aa8b88a...d444411. Read the comment docs.

@EricGao888
Copy link
Copy Markdown
Member Author

Codecov Report

Merging #10749 (16b7bb4) into dev (4ac3349) will increase coverage by 0.08%.
The diff coverage is 88.63%.

@@             Coverage Diff              @@
##                dev   #10749      +/-   ##
============================================
+ Coverage     40.71%   40.79%   +0.08%     
- Complexity     4820     4825       +5     
============================================
  Files           900      900              
  Lines         36143    36187      +44     
  Branches       3982     3982              
============================================
+ Hits          14717    14764      +47     
+ Misses        19972    19969       -3     
  Partials       1454     1454              

Impacted Files Coverage Δ
...pache/dolphinscheduler/common/utils/FileUtils.java 51.42% <0.00%> (-1.52%) ⬇️
...eduler/server/worker/runner/TaskExecuteThread.java 21.32% <85.71%> (+3.49%) ⬆️
...ler/server/worker/metrics/WorkerServerMetrics.java 78.84% <94.28%> (+78.84%) ⬆️
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 4ac3349...16b7bb4. Read the comment docs.

I didn't add a line of UT, not sure why code coverage increased 🤣 .

@EricGao888 EricGao888 force-pushed the Fix-9324-add-resource-related-metrics branch from 1580074 to a4e2bc7 Compare July 5, 2022 02:17
@EricGao888
Copy link
Copy Markdown
Member Author

EricGao888 commented Jul 11, 2022

I will submit another PR some time this week to switch to use tags to indicate status instead of putting them in names for all the previous metrics in master and worker. #10867

@EricGao888 EricGao888 force-pushed the Fix-9324-add-resource-related-metrics branch from a0dfc58 to 73cd48f Compare July 11, 2022 05:51
@EricGao888 EricGao888 force-pushed the Fix-9324-add-resource-related-metrics branch from 7c0d4e1 to 4ec5890 Compare July 11, 2022 09:15
kezhenxu94
kezhenxu94 previously approved these changes Jul 11, 2022
Copy link
Copy Markdown
Member

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

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

Generally LGTM. Some nits

Comment on lines +253 to +256
public static long getFileSizeInByte(String filename) {
File file = new File(filename);
return file.length();
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is one-line code, just inline this util method and remove this method?

new File(filename).length()

Comment on lines +286 to +287
WorkerServerMetrics.recordWorkerResourceDownloadSize(
FileUtils.getFileSizeInByte(execLocalPath + File.separator + fullName));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
WorkerServerMetrics.recordWorkerResourceDownloadSize(
FileUtils.getFileSizeInByte(execLocalPath + File.separator + fullName));
WorkerServerMetrics.recordWorkerResourceDownloadSize(
Files.size(Paths.get(execLocalPath, fullName)));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Pretty and neat! Have fixed it in the latest commit. Thx

@EricGao888 EricGao888 force-pushed the Fix-9324-add-resource-related-metrics branch from 5171f34 to d444411 Compare July 11, 2022 11:06
@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

83.8% 83.8% Coverage
0.0% 0.0% Duplication

@EricGao888
Copy link
Copy Markdown
Member Author

CI seems somehow not stable today. I've pushed multiple times and it finally passes.

@EricGao888 EricGao888 requested a review from zhongjiajie July 11, 2022 12:02
@EricGao888
Copy link
Copy Markdown
Member Author

@ruanwenjun @zhongjiajie Could you please take another look when available? Thx~

Copy link
Copy Markdown
Member

@ruanwenjun ruanwenjun left a comment

Choose a reason for hiding this comment

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

LGTM

@EricGao888 EricGao888 merged commit 2f7281c into apache:dev Jul 12, 2022
@kezhenxu94
Copy link
Copy Markdown
Member

kezhenxu94 commented Jul 12, 2022

Hi @EricGao888 a hint. When merging pull request please take a minute to cleanup/rewrite the commit message so that we can have a more clean git history
Screen Shot 2022-07-12 at 11 52 53

@EricGao888
Copy link
Copy Markdown
Member Author

Hi @EricGao888 a hint. When merging pull request please take a minute to cleanup/rewrite the commit message so that we can have a more clean git history Screen Shot 2022-07-12 at 11 52 53

@kezhenxu94 Thanks for the hint! I will follow this guide next time when merging commits https://dolphinscheduler.apache.org/en-us/community/development/commit-message.html

@ruanwenjun
Copy link
Copy Markdown
Member

ruanwenjun commented Jul 12, 2022

Yes, we need to clean up some messages,
e.g.

Fix demos, docs and remove redundant code
Fix style check
Make code neat
...

@EricGao888
Copy link
Copy Markdown
Member Author

Yes, we need to clean up some messages, e.g.

Fix demos, docs and remove redundant code
Fix style check
Make code neat
...

Thx for the explanation. I will remove those redundant commit msgs next time. : )

zhongjiajie pushed a commit to zhongjiajie/dolphinscheduler that referenced this pull request Jul 12, 2022
…pache#10749)

* [Feature][Metrics] Add resource download related metrics for workers (apache#9324)

* [Feature][Metrics] Fix bugs and add grafana demos for worker resource download metrics (apache#9324)

* [Feature][Metrics] Add docs to resource related metrics (apache#9324)

* [Feature][Metrics] Use tags to indicate status in metrics (apache#9324)

* [Feature][Metrics] Fix demos, docs and remove redundant code (apache#9324)

* [Feature][Metrics] Remove .pnpm-debug.log (apache#9324)

* [Feature][Metrics] Fix style check (apache#9324)

* [Feature][Metrics] Replace KB with bytes for the unit of resource file size in metrics (apache#9324)

* [Feature][Metrics] Make code neat (apache#9324)
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.

6 participants