定制 waffle-commons/telemetry 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

waffle-commons/telemetry

Composer 安装命令:

composer require waffle-commons/telemetry

包简介

SDK-free enterprise telemetry for Waffle Commons: contract-first tracing no-ops, a Prometheus /waffle-metrics exporter, and stateless worker-metric collectors.

README 文档

README

Discord PHP Version Require PHP CI codecov Latest Stable Version Packagist License

Waffle Commons — Telemetry

SDK-free enterprise telemetry for the Waffle Commons framework. This package provides the no-op tracing defaults, a Prometheus /waffle-metrics exporter + diagnostics middleware, and stateless worker-metric collectors (memory peaks, GC cycles, request timing, cache hit ratio, DB-pool utilization) for long-running FrankenPHP workers.

Status: shipped in Beta 5 / AXE 5 (RFC-005). The OpenTelemetry SDK bridge lives in the separate waffle-commons/telemetry-otel package so the vendor SDK never enters the core perimeter.

What's inside

  • MetricsMetric\MetricsRegistry (counters / gauges / histograms) backed by Metric\ApcuMetricStore, so counters live in APCu shared memory and never on the worker heap. Falls back to the contract's NullMetricsRegistry when APCu is unavailable.
  • Collectors — stateless Collector\MemoryCollector (usage + peak), Collector\GcCollector (cycles, collected objects, root buffer) and Collector\PoolUtilizationCollector (DB-pool active / idle / capacity).
  • Exporter & endpointExporter\PrometheusExporter renders the text exposition format; Middleware\MetricsMiddleware serves a fail-closed /waffle-metrics scrape (404 unless a bearer token or allow-listed client IP matches — the endpoint is never revealed to unauthorized callers).
  • Request instrumentationMiddleware\TracingMiddleware opens the per-request server span (extracting an inbound W3C traceparent) and records request count + duration; defaults to the contract no-ops so it is safe to install unconditionally.
  • DecoratorsCache\MeteredCache (hit / miss counters around any PSR-16 cache) and Repository\TracingRepositoryDecorator (optional client spans around an RFC-022 repository; core data/ now emits DB spans natively, so this decorator is an add-on for non-core repositories).

Perimeter

Depends only on waffle-commons/contracts (+ waffle-commons/utils). Every telemetry interface (Waffle\Commons\Contracts\Telemetry\*) lands in contracts first — mago guard enforces the boundary. Counters live in shared memory (APCu), never on the resettable worker heap (wfl igor 0 KO).

Development

composer install
composer mago     # fmt + lint + analyze + guard — must be ZERO output
composer tests    # PHPUnit 12.5, >=95% coverage
composer igor     # worker-safety audit — 0 KO

License

MIT — see LICENSE.md.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固