V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 134 天前 · 760 次点击
    这是一个创建于 134 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    4 条回复    2023-12-15 18:22:50 +08:00
    RedisMasterNode
        1
    RedisMasterNode  
       134 天前
    如果暴露的指标也波动说明是服务内的问题,那应该去检查上报位置的代码,另外检查服务是否有重启,重置了计数器。
    Kinnice
        2
    Kinnice  
       134 天前
    使用多进程了?
    wudc
        4
    wudc  
    OP
       134 天前
    @Kinnice 可以了👍,thx
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3731 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 04:20 · PVG 12:20 · LAX 21:20 · JFK 00:20
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.