前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SpringBoot集成prometheus监控

SpringBoot集成prometheus监控

作者头像
似水的流年
发布2020-11-27 14:39:13
7980
发布2020-11-27 14:39:13
举报
文章被收录于专栏:电光石火电光石火

Prometheus是一个根据应用的metrics来进行监控的开源工具。相信很多工程都在使用它来进行监控,有关详细介绍可以查看官网:https://prometheus.io/docs/introduction/overview/

添加依赖

在SpringBoot中使用Prometheus其实很简单,不需要配置太多的东西,加入依赖

代码语言:javascript
复制
compile group: 'io.micrometer', name: 'micrometer-registry-prometheus'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'

配置文件添加

代码语言:javascript
复制
# spring-boot-actuator配置
management:
  endpoints:
    web:
      exposure:
        include: '*'
  health:
      #关闭过滤敏感信息
      sensitive: false
  endpoint:
    shutdown:
      #是否启用 shutdown 端点
      enabled: true
    health:
      #何时显示完整的健康详情
      show-details: ALWAYS
    logfile:
      #是否启用 logfile 端点
      enabled: true
    metrics:
      #是否启用metrics端点
  enabled: true
    prometheus:
      #是否启用 prometheus 端点
      enabled: true
  metrics:
    export:
      prometheus:
        # 是否启用向prometheus导出
        enabled: true
    distribution:
      percentiles-histogram:
        http:
          server:
            # 开启Micormeter
            requests: true
      sla:
        http:
          server:
            # Micormeter bucket指标配置,千分尺分段记录
            requests: 100ms,200ms,400ms
      percentiles:
        http:
          server:
            # Micormeter quantile指标配置
            requests: 0.5,0.9,0.95,0.99,0.999
    tags:
      application: ${spring.application.name}

SpringBoot项目到这里就配置完成了,启动项目,访问http://localhost:8080/actuator/prometheus,可以看到一些度量指标。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-10-16,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 添加依赖
相关产品与服务
Prometheus 监控服务
Prometheus 监控服务(TencentCloud Managed Service for Prometheus,TMP)是基于开源 Prometheus 构建的高可用、全托管的服务,与腾讯云容器服务(TKE)高度集成,兼容开源生态丰富多样的应用组件,结合腾讯云可观测平台-告警管理和 Prometheus Alertmanager 能力,为您提供免搭建的高效运维能力,减少开发及运维成本。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档