当前位置: 首页 > news >正文

【博客654】prometheus配置抓取保护以防止压力过载

prometheus抓取保护配置以防止压力过载

场景

担心您的应用程序指标可能突然激增,以及指标突然激增导致prometheus压力过载

就像生活中的许多事情一样,标签要有节制。当带有用户 ID 或电子邮件地址的标签被添加到指标时,虽然它不太可能结束,因为突然之间,您的一个目标可能会在每次抓取时抽出数十万个时间序列,从而导致 Prometheus 出现性能问题。

设置scrap抓取指标过载保护

sample_limit 是一个抓取配置字段,如果返回的时间序列超过给定数量,它将导致抓取失败。默认情况下禁用。例如:

scrape_configs:- job_name: 'my_job'sample_limit: 5000static_configs:- targets:- my_target:1234

如果返回的时间序列超过 5000 个,将导致目标的抓取失败,将 up 设置为 0,就好像目标已关闭一样。从那里,您可以在抓取时使用普罗米修斯删除指标来删除有问题的指标,同时等待应用程序被修复。也就是说metric_relabel_configs在sample_limit之前应用。

各类过载保护汇总

  • sample_limit
# Per-scrape limit on number of scraped samples that will be accepted.
# If more than this number of samples are present after metric relabeling
# the entire scrape will be treated as failed. 0 means no limit.
[ sample_limit: <int> | default = 0 ]
  • body_size_limit:
# An uncompressed response body larger than this many bytes will cause the
# scrape to fail. 0 means no limit. Example: 100MB.
# This is an experimental feature, this behaviour could
# change or be removed in the future.
[ body_size_limit: <size> | default = 0 ]
  • label_limit
# Per-scrape limit on number of labels that will be accepted for a sample. If
# more than this number of labels are present post metric-relabeling, the
# entire scrape will be treated as failed. 0 means no limit.
[ label_limit: <int> | default = 0 ]
  • label_name_length_limit
# Per-scrape limit on length of labels name that will be accepted for a sample.
# If a label name is longer than this number post metric-relabeling, the entire
# scrape will be treated as failed. 0 means no limit.
[ label_name_length_limit: <int> | default = 0 ]
  • label_value_length_limit
# Per-scrape limit on length of labels value that will be accepted for a sample.
# If a label value is longer than this number post metric-relabeling, the
# entire scrape will be treated as failed. 0 means no limit.
[ label_value_length_limit: <int> | default = 0 ]
  • target_limit
# Per-scrape config limit on number of unique targets that will be
# accepted. If more than this number of targets are present after target
# relabeling, Prometheus will mark the targets as failed without scraping them.
# 0 means no limit. This is an experimental feature, this behaviour could
# change in the future.
[ target_limit: <int> | default = 0 ]
http://www.lryc.cn/news/92643.html

相关文章:

  • Backtrader官方中文文档:第十三章Observers观察者
  • 算法leetcode|54. 螺旋矩阵(rust重拳出击)
  • 单容水箱建模(自衡单容水箱+无自衡单容水箱)
  • 分享Python7个爬虫小案例(附源码)
  • 我用ChatGPT写2023高考语文作文(一):全国甲卷
  • c++ modbusTCP
  • linux(信号结尾)
  • 【漏洞修复】node-exporter被检测出来pprof调试信息泄露漏洞
  • 在linux 上安装 NFS服务器软件
  • 网卡中的Ring buffer -- 解决 rx_resource_errors 丢包
  • 六月九号补题日记:Codeforces Round 877 (Div. 2)
  • python基础选择题,高中适用
  • Linux 面试题-(腾讯,百度,美团,滴滴)
  • DDD--战略设计步骤
  • Web Scoket简述
  • “Docker 技术在企业中的应用及挑战解决方案“
  • vue中开发包、生产包、全局包的区别以及安装语法
  • list的模拟实现
  • ChatGLM简介和SSE聊天接口测试效果
  • darknet yolo标注、训练详细说明
  • chatgpt赋能python:Python如何产生随机整数?
  • 大话Stable-Diffusion-Webui-客制化主题(四)
  • Excel函数VLOOKUP常用方法
  • systemV的工作原理+原理代码
  • Kubeflow--TFJob实现机制学习
  • 百度出品,Nature重磅 -- 优化的mRNA设计算法可改善mRNA的稳定性和免疫原性
  • CKA 01_docker部署Kubernetes 部署docker 使用kubeadm引导集群 安装Pod网络
  • Redis的使用规范小建议
  • 操作受限的线性表——栈
  • C++基类指针或引用指向或引用派生类对象(实现动态多态四种手段)父类指针访问子类成员变量(需要dynamic_cast)