Download the PHP package hyperf-apex/metrics without Composer

On this page you can find all versions of the php package hyperf-apex/metrics. 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 metrics

hyperf-apex/metrics

基于 Swoole Table 共享内存的低基数运行指标:Prometheus 抓取端点、请求耗时拦截、以及一个运维大屏。

安装

端点

端点 用途
GET /metrics Prometheus 抓取(文本格式)
GET /metrics/dashboard 运维大屏页面
GET /metrics/overview 大屏数据(大屏页面自己取它)

访问控制由 metrics.allow_ips 决定,默认只允许本机(127.0.0.1,::1)—— 抓取方在容器/另一台机器上时 需要显式放行,否则拿到的是 403。

配置项

键 环境变量(默认值) 说明
metrics.enabled METRICS_ENABLED(true) 关掉后不注册端点与拦截器
metrics.table_size METRICS_TABLE_SIZE(65536) 指标表行数
metrics.gauge_cache_ttl_seconds METRICS_GAUGE_CACHE_TTL_SECONDS(15) 采集器结果缓存时长(用单调时钟计时)
metrics.process_table_size METRICS_PROCESS_TABLE_SIZE(64) 进程维度的行数
metrics.pool_snapshot_ttl_seconds METRICS_POOL_SNAPSHOT_TTL_SECONDS(30) 连接池快照缓存时长
metrics.histogram_buckets — 直方图分桶
metrics.allow_ips METRICS_ALLOW_IPS(127.0.0.1,::1) 允许访问端点的来源,支持 CIDR
metrics.collectors — 采集器清单
metrics.overview.enabled METRICS_OVERVIEW_ENABLED(true) 是否启用大屏
metrics.overview.refresh_seconds METRICS_OVERVIEW_REFRESH_SECONDS(10) 大屏刷新间隔
metrics.overview.aggregates — 大屏聚合项
metrics.overview.thresholds — 大屏告警阈值(错误率、P95、积压、连接池超时等)
metrics.definitions — 自定义指标定义(type / help / labels)

内置指标

指标 类型 标签
core_http_requests_total counter method、route、status_class
core_http_request_duration_seconds histogram method、route
core_http_unhandled_exceptions_total counter route
core_outbound_requests_total counter target、result
core_outbound_request_duration_seconds histogram target
core_pool_wait_seconds histogram pool
core_pool_timeout_total counter pool
core_metrics_series_dropped_total counter metric

装了 hyperf-apex/websocket 时另有一组连接类指标(连接数、容量、空闲连接数)—— 连接索引不可用(未启用网关)时整组不输出,而不是给出一串 0。

说明


All versions of metrics with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
hyperf-apex/core Version ^0.1
hyperf/memory Version ~3.2.0
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 hyperf-apex/metrics contains the following files

Loading the files please wait ...