推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wudc
V2EX  ›  Python

求助:在 flask 服务中用 prometheus_flask_exporter 做服务基础监控,其中 Counter 类型的指标不是递增的是什么原因?

  •  
  •   wudc · Dec 15, 2023 · 2099 views
    This topic created in 907 days ago, the information mentioned may be changed or developed.

    服务没有被外部请求的话,/metrics 页面中的 flask_http_request_total 应该是不变的,但是 Prometheus 采集到的该指标值会上下波动,我去/metrics 页面连续刷几次发现它确实会上下波动,有时候是 2031 ,有时候是 200 ,这个指标是 Counter 类型只是递增或者不变。上下波动就会导致 Prometheus 抓取的该指标的值来回跳动,没办法用 rate 或者 increase 来计算 QPS ,希望有用到的同学帮忙看下,感谢!

    4 replies    2023-12-15 18:22:50 +08:00
    RedisMasterNode
        1
    RedisMasterNode  
       Dec 15, 2023
    如果暴露的指标也波动说明是服务内的问题,那应该去检查上报位置的代码,另外检查服务是否有重启,重置了计数器。
    Kinnice
        2
    Kinnice  
       Dec 15, 2023
    使用多进程了?
    wudc
        4
    wudc  
    OP
       Dec 15, 2023
    @Kinnice 可以了👍,thx
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3990 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 05:11 · PVG 13:11 · LAX 22:11 · JFK 01:11
    ♥ Do have faith in what you're doing.