Download the PHP package imiphp/imi-prometheus without Composer

On this page you can find all versions of the php package imiphp/imi-prometheus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package imi-prometheus

imi-prometheus

Latest Version Php Version Swoole Version imi License

介绍

此项目是 imi 框架的普罗米修斯(Prometheus)服务监控指标组件。

普罗米修斯官方文档:https://prometheus.io/docs/introduction/overview/

正在开发中,随时可能修改,请勿用于生产环境!

安装

composer require imiphp/imi-prometheus:~2.1.0

使用说明

普罗米修斯组件只支持以实例为单位上报,不支持以 Worker 进程为单位。

配置

首先需要配置 Redis 连接,可以参考文档,这里不再赘述。

配置监控指标:

@app.beans

使用

内置监控

连接池监控

@app.beans

Swoole 服务器指标监控

@app.beans

注解

@Counted

类名:\Imi\Meter\Annotation\Counted

计数统计,适合只累加,不减少的统计数据类型。

例如:访问次数统计。

参数名 类型 默认值 描述
name string imi.counted 指标名称
recordFailuresOnly false bool 是否只在抛出异常时记录
tags array [] 标签,键值数组
description string 描述
options array [] 额外参数,每个驱动不同
@Gauged

类名:\Imi\Meter\Annotation\Gauged

适合数字有上下波动的统计。

例如:CPU 占用率统计。

参数名 类型 默认值 描述
name string imi.counted 指标名称
recordFailuresOnly false bool 是否只在抛出异常时记录
tags array [] 标签,键值数组
description string 描述
value string\|float {returnValue} 写入的值;{returnValue} 表示方法返回值;{returnValue.xxx} 表示方法返回值的属性值;{params.0} 表示方法参数值;{params.0.xxx} 表示方法参数值的属性值;也可以是固定的 float
operation int \Imi\Meter\Enum\GaugeOperation::SET 操作类型。设置GaugeOperation::SET;增加GaugeOperation::INCREMENT;减少GaugeOperation::DECREMENT
options array [] 额外参数,每个驱动不同
@Timed

类名:\Imi\Meter\Annotation\Timed

耗时统计。

例如:方法执行耗时

参数名 类型 默认值 描述
name string imi.counted 指标名称
tags array [] 标签,键值数组
description string 描述
baseTimeUnit int \Imi\Meter\Enum\TimeUnit::NANO_SECOND 基础时间单位,默认纳秒,可以使用 \Imi\Meter\Enum\TimeUnit::XXX 常量设置。
options array [] 额外参数,每个驱动不同

options 在普罗米修斯的特定配置:

@Histogram

类名:\Imi\Meter\Annotation\Histogram

柱状图,一般人用不懂,如无特殊需求可以无视。

参数名 类型 默认值 描述
name string imi.counted 指标名称
tags array [] 标签,键值数组
description string 描述
buckets array [] 桶,例如:[100, 500, 1000]
baseTimeUnit int \Imi\Meter\Enum\TimeUnit::NANO_SECOND 基础时间单位,默认纳秒,可以使用 \Imi\Meter\Enum\TimeUnit::XXX 常量设置。
value string\|float {returnValue} 写入的值;{returnValue} 表示方法返回值;{returnValue.xxx} 表示方法返回值的属性值;{params.0} 表示方法参数值;{params.0.xxx} 表示方法参数值的属性值;也可以是固定的 float
options array [] 额外参数,每个驱动不同
@Summary

类名:\Imi\Meter\Annotation\Summary

采样点分位图,一般人用不懂,如无特殊需求可以无视。

参数名 类型 默认值 描述
name string imi.counted 指标名称
tags array [] 标签,键值数组
description string 描述
percentile array [] 百分位数,例如:[0.01, 0.5, 0.99]
baseTimeUnit int \Imi\Meter\Enum\TimeUnit::NANO_SECOND 基础时间单位,默认纳秒,可以使用 \Imi\Meter\Enum\TimeUnit::XXX 常量设置。
value string\|float {returnValue} 写入的值;{returnValue} 表示方法返回值;{returnValue.xxx} 表示方法返回值的属性值;{params.0} 表示方法参数值;{params.0.xxx} 表示方法参数值的属性值;也可以是固定的 float
options array [] 额外参数,每个驱动不同

代码示例:

手动操作

清除 Redis 驱动存储数据

如果你的同名指标,修改了 tags,那么必须清理存储数据,否则会报错。

vendor/bin/imi-swoole prometheus/wipe

免费技术支持

QQ群:17916227 点击加群,如有问题会有人解答和修复。

运行环境

版权信息

imi-prometheus 遵循 MulanPSL-2.0 开源协议发布,并提供免费使用。

捐赠

开源不求盈利,多少都是心意,生活不易,随缘随缘……


All versions of imi-prometheus with dependencies

PHP Build Version
Package Version
Requires imiphp/imi-meter Version ~2.1.0
promphp/prometheus_push_gateway_php Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package imiphp/imi-prometheus contains the following files

Loading the files please wait ....