Download the PHP package extraswoft/prometheus-exporter without Composer
On this page you can find all versions of the php package extraswoft/prometheus-exporter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download extraswoft/prometheus-exporter
More information about extraswoft/prometheus-exporter
Files in extraswoft/prometheus-exporter
Download extraswoft/prometheus-exporter
More information about extraswoft/prometheus-exporter
Files in extraswoft/prometheus-exporter
Vendor extraswoft
Package prometheus-exporter
Short Description prometheusExporter for swoft
License Apache-2.0
Package prometheus-exporter
Short Description prometheusExporter for swoft
License Apache-2.0
Please rate this library. Is it a good library?
Informations about the package prometheus-exporter
简介
本项目基于github上的swoft开源项目进行组件开发,扩展了一个prometheusExporter sdk组件, prometheus 是一个开源的系统监控和告警平台,通过Exporter即可快速地生成prometheus需要的记录信息, 通过中间件和注解来对监控数据非侵入式注入。
目前新增prometheus 是否持久化的选项
环境强制要求
- 根据swoft官方要求即可
配置步骤
1.加载包
2.在base.php文件的middlewares里加入middleware
注意:加入该中间件是对所有请求进行的基本监控,包括持久化。
3.在app.php文件的bootScan和beanScan加入bean需要扫描的命名空间
4.在.env配置文件中添加以下配置
PROMETHEUSEXPORTER_REDIS_PREFIX,持久化到redis的命名前缀
PROMETHEUSEXPORTER_PUSHGATEWAY_HOST, 若采用pushGateway,它的地址
PROMETHEUSEXPORTER_INSTANCE, 实例名,可以配置,也可以用主机名,适合多实例
PROMETHEUSEXPORTER_COUNTER_LINE,swoole table 申请的行数,下两个同理,若为0则不创建table
PROMETHEUSEXPORTER_GAUGE_LINE,
PROMETHEUSEXPORTER_HISTOGRAM_LINE,histogram需要的行数要较其他的较多,建议配置多点
PROMETHEUSEXPORTER_PERSISTENCE,prometheus 是否从redis获取持久化数据
日常使用
1.注解使用(只支持方法)
注意,若想在Controller里的方法使用(普通的bean可以不关心),需要同时给Controller添加注解,比如:
2.方法调用
持久化
1.注解,给某个方法或接口加上缓存注解,调用即可,灵活方便(推荐)
2.自行使用方法
使用pushGateway
获取prometheus文本
具体可参照下面例子
效果图
![image]()
注意事项
- namespace 和 name加上的大小最好不要超过40字节,可能会被截断
- help参数限制的字符串为30字节以下
- 一开始配置的line大小可能随着业务发展不够了,需要及时扩大
问题
1.prometheus怎么用,好用不,搭配grafana怎么用?
答:好用,看完这本你都会了,prometheus实战
All versions of prometheus-exporter with dependencies
PHP Build Version
Package Version
Requires
swoft/http-message Version
*
swoft/framework Version *
swoft/http-client Version *
doctrine/annotations Version ^1.4
swoft/redis Version *
swoft/memory Version *
swoft/http-server Version *
swoft/framework Version *
swoft/http-client Version *
doctrine/annotations Version ^1.4
swoft/redis Version *
swoft/memory Version *
swoft/http-server Version *
The package extraswoft/prometheus-exporter contains the following files
Loading the files please wait ....