-
Notifications
You must be signed in to change notification settings - Fork 328
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
[Metric] Add prometheus metric implementation #2752
[Metric] Add prometheus metric implementation #2752
Conversation
ci/requirements-wheel.txt
Outdated
@@ -13,3 +13,4 @@ scipy==1.7.2; python_version>='3.10' | |||
cython==0.29.26 | |||
requests>=2.4.0 | |||
cloudpickle>=1.5.0 | |||
prometheus-client>=0.10.0 |
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.
Not needed when building wheels.
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.
Ok.
# limitations under the License. | ||
|
||
from typing import Optional, Dict | ||
from prometheus_client import Gauge as PGauge |
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.
We do not intend to depend on prometheus_client
, thus use a try..except ImportError
to wrap this import line.
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.
Good idea. I'll fix it.
import requests | ||
import time | ||
|
||
from prometheus_client import start_http_server |
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.
Ditto.
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.
I'll fix it.
setup.cfg
Outdated
@@ -44,6 +44,7 @@ install_requires = | |||
sqlalchemy>=1.2.0 | |||
defusedxml>=0.5.0 | |||
uvloop>=0.14.0; sys.platform!="win32" and python_version>="3.7" | |||
prometheus-client>=0.10.0 |
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.
We do not intend to depend on prometheus_client
, thus remove this.
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.
Ok.
f62374d
to
8b430db
Compare
8d81c2a
to
8f0d6d8
Compare
8f0d6d8
to
ad8649e
Compare
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.
LGTM over all, I left one comment.
mars/metric/api.py
Outdated
logger.info("Finished startup prometheus http server and port is %d", port) | ||
except ImportError: | ||
logger.info( | ||
"Do not startup prometheus http server because there is no prometheus_client" |
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.
Use logger.warning("Failed to start...")
.
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.
Ok. Thanks.
92d8a6b
to
9108be2
Compare
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.
LGTM
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.
LGTM
What do these changes do?
This pr adds prometheus metrics implementation. We can use prometheus metrics as follows:
Related issue number
Issuse #2743
Check code requirements