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

[Metrics] Fix metrics and docs #3233

Merged
merged 9 commits into from
Sep 9, 2022

Conversation

zhongchun
Copy link
Contributor

@zhongchun zhongchun commented Aug 22, 2022

What do these changes do?

In the previous design, metrics are allowed to be used without initialization. In this case, the default metrics, namely console metrics, are used, but this may lead to wrong use. For example, using metrics before initializing metrics, then using the default console metrics, but we may think that we have initialized metrics with prometheus or ray, then it should be the corresponding metrics. So this pr:

  • Lazy initialization if not call init_metrics
  • Fix ray storage metrics
  • Fix mars usage demo

Related issue number

Fixes #xxxx

Check code requirements

  • tests added / passed (if needed)
  • Ensure all linting tests pass, see here for how to run them

* Fix ray storage metrics
* Add valid check for metrics
* Fix mars usage demo
@zhongchun zhongchun requested a review from a team as a code owner August 22, 2022 03:01
@zhongchun zhongchun changed the title Fix metrics and docs [Metrics] Fix metrics and docs Aug 22, 2022
chaokunyang
chaokunyang previously approved these changes Sep 6, 2022
Copy link
Contributor

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -490,7 +488,18 @@ def execute(results: Dict[str, Any], op: OperandType):
try:
result = executor(results, op)
succeeded = True
op_executed_number.record(1, {"op": op.__class__.__name__})
global op_executed_number
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems not easy to use compared to previsous API

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we update the metrics Counter/Guage instance when metris are init?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we update the metrics Counter/Guage instance when metris are init?

Yes, good idea. I'll fix it.

@zhongchun zhongchun force-pushed the fix-metrics-initialization branch from c25eb91 to 73acfe9 Compare September 8, 2022 01:38
Copy link
Contributor

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@fyrestone fyrestone left a comment

Choose a reason for hiding this comment

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

LGTM

@zhongchun zhongchun merged commit 6c6fc48 into mars-project:master Sep 9, 2022
qianduoduo0904 pushed a commit to qianduoduo0904/mars that referenced this pull request Sep 22, 2022
* Fix metrics and docs

* Fix ray storage metrics
* Add valid check for metrics
* Fix mars usage demo

* Fix metrics check

* Remove unused log

* Update mars/metrics/api.py

Co-authored-by: Shawn <[email protected]>

* Update mars/metrics/api.py

Co-authored-by: Shawn <[email protected]>

* Support lazy initialize metrics

* Restore op_executed_number

* Fix log

Co-authored-by: buhe <[email protected]>
Co-authored-by: Shawn <[email protected]>
(cherry picked from commit 6c6fc48)
UranusSeven pushed a commit to xorbitsai/mars that referenced this pull request Sep 22, 2022
* Fix metrics and docs

* Fix ray storage metrics
* Add valid check for metrics
* Fix mars usage demo

* Fix metrics check

* Remove unused log

* Update mars/metrics/api.py

Co-authored-by: Shawn <[email protected]>

* Update mars/metrics/api.py

Co-authored-by: Shawn <[email protected]>

* Support lazy initialize metrics

* Restore op_executed_number

* Fix log

Co-authored-by: buhe <[email protected]>
Co-authored-by: Shawn <[email protected]>
(cherry picked from commit 6c6fc48)
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.

3 participants