promphp/prometheus_push_gateway_php
Composer 安装命令:
composer require promphp/prometheus_push_gateway_php
包简介
Prometheus Push Gateway client for PHP applications.
README 文档
README
This package provides an easy PHP API for Prometheus Push Gateway. It was part of promphp/prometheus_client_php and was moved into a seperate package as of Prometheus Client PHP Version 2.0.0.
How does it work?
The PushGateway allows Prometheus to get Metrics from Systems that are not scrableable (Your Prometheus cannot access that systems). With this library you can easily send your metrics to the PushGateway.
Installation
Add as Composer dependency:
composer require promphp/prometheus_push_gateway_php
Usage
Let's assume you have that simple counter and want to send it to your PushGateway.
\Prometheus\CollectorRegistry::getDefault() ->getOrRegisterCounter('', 'some_quick_counter', 'just a quick measurement') ->inc(); // Now send it to the PushGateway: $pushGateway = new \PrometheusPushGateway\PushGateway('http://192.168.59.100:9091'); $pushGateway->push(\Prometheus\CollectorRegistry::getDefault(), 'my_job', ['instance' => 'foo']);
Also look at the examples.
Development
Dependencies
- PHP ^7.2 | ^8.0
- Composer
Black box testing
Just start the PushGateway by using docker-compose
docker-compose up
Use composer to grab all dependencies
docker run --rm --interactive --tty --volume $PWD:/app composer install
Execute the tests:
docker-compose run phpunit vendor/bin/phpunit tests/Test/
promphp/prometheus_push_gateway_php 适用场景与选型建议
promphp/prometheus_push_gateway_php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.43M 次下载、GitHub Stars 达 31, 最近一次更新时间为 2020 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 promphp/prometheus_push_gateway_php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 promphp/prometheus_push_gateway_php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.43M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 19
- 依赖项目数: 6
- 推荐数: 7
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2020-09-30