Download the PHP package waffle-commons/telemetry without Composer

On this page you can find all versions of the php package waffle-commons/telemetry. 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 telemetry

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

Waffle Telemetry Component

Release: 0.1.0-beta6  |  CHANGELOG.md RFC: RFC-005 (OBS-02) β€” contract-first, SDK-free observability

SDK-free enterprise telemetry for the Waffle Commons framework: a Prometheus /waffle-metrics exporter fed by stateless worker-metric collectors (memory, GC, DB-pool utilization), plus request instrumentation that defaults to the contract's no-op tracer so it costs nothing until a real backend is wired in. The OpenTelemetry SDK bridge lives in the separate waffle-commons/telemetry-otel package, so the vendor SDK never enters this core perimeter.

πŸ“¦ Installation

🧱 Surface

Class Role
Waffle\Commons\Telemetry\Metric\MetricsRegistry final readonly implementation of MetricsRegistryInterface and MetricsCollectorInterface. Records increment() / gauge() / observe() into a MetricStoreInterface and reads them back as MetricSamples for export.
Waffle\Commons\Telemetry\Metric\ApcuMetricStore final readonly MetricStoreInterface backed by APCu shared memory β€” counters live off the worker heap so one scrape aggregates every worker on the instance.
Waffle\Commons\Telemetry\Collector\MemoryCollector Stateless collector β€” current + peak real memory usage (memory_get_usage(true) / memory_get_peak_usage(true)).
Waffle\Commons\Telemetry\Collector\GcCollector Stateless collector β€” cumulative GC cycle runs, objects collected, and current root-buffer size (gc_status()).
Waffle\Commons\Telemetry\Collector\PoolUtilizationCollector Stateless collector β€” DB connection-pool active / idle / capacity from a bound PoolStatsInterface (reports zeros until a pool is wired in).
Waffle\Commons\Telemetry\Exporter\PrometheusExporter final readonly β€” renders a set of collectors' samples into the Prometheus text exposition format (v0.0.4), no SDK required.
Waffle\Commons\Telemetry\Middleware\MetricsMiddleware final readonly PSR-15 middleware serving the fail-closed /waffle-metrics scrape endpoint.
Waffle\Commons\Telemetry\Middleware\TracingMiddleware final readonly PSR-15 middleware opening the per-request SpanKind::Server root span and recording request count + duration.
Waffle\Commons\Telemetry\Cache\MeteredCache final readonly decorator β€” wraps any Contracts\Cache\CacheInterface to record hit/miss counters.
Waffle\Commons\Telemetry\Repository\TracingRepositoryDecorator final readonly decorator β€” wraps any RFC-022 RepositoryInterface to emit a waffle.db.query client span per call.

πŸ”Œ Wiring

Real wiring from the template AppKernelFactory (see skeleton/src/Factory/AppKernelFactory.php):

$tracer defaults to Contracts\Telemetry\NullTracer and $tracePropagator to Contracts\Telemetry\NullTextMapPropagator. Swap in waffle-commons/telemetry-otel's OtelTracerFactory::console(...) (or an OTLP exporter) to activate real distributed tracing without touching this package.

πŸ›‘οΈ Configuration β€” /waffle-metrics is fail-closed

MetricsMiddleware answers the scrape path only when the request presents the configured bearer token or comes from an allow-listed client IP; every other request to that path gets a 404 β€” the endpoint's existence is never revealed to an unauthorized caller (mirrors AXE 0 LEAK-03).

Constructor argument Default Effect
?string $bearerToken null When set, a request with Authorization: Bearer <token> (compared via hash_equals()) is authorised.
array $allowedIps [] Exact REMOTE_ADDR values permitted to scrape (e.g. ['127.0.0.1', '::1'] for localhost-only).

Both are opt-in allow-lists β€” an empty configuration means the endpoint accepts nothing, not everything.

πŸ“Š Collectors

Metric(s) Type Source
waffle_memory_usage_bytes, waffle_memory_peak_bytes Gauge MemoryCollector β€” memory_get_usage(true) / memory_get_peak_usage(true).
waffle_gc_runs_total, waffle_gc_collected_total, waffle_gc_roots Counter / Counter / Gauge GcCollector β€” gc_status().
waffle_db_pool_active, waffle_db_pool_idle, waffle_db_pool_capacity Gauge PoolUtilizationCollector β€” a bound PoolStatsInterface (zeros until a pool is wired in).
waffle_http_requests_total, waffle_http_request_duration_seconds Counter / Counter (_sum/_count) TracingMiddleware, via MetricsRegistryInterface.
waffle_cache_hits_total, waffle_cache_misses_total Counter MeteredCache, judged with has() so the cached value is never captured into a mixed local.

MetricsRegistry::observe() stores a summary (<name>_sum + <name>_count), so a mean is derivable downstream without a histogram implementation.

🧭 Perimeter

Depends only on waffle-commons/contracts. Every telemetry interface (Waffle\Commons\Contracts\Telemetry\*) lands in contracts first β€” mago guard enforces the boundary at [guard.perimeter] in mago.toml; a forbidden use statement fails the build, not a reviewer. Production code under Waffle\Commons\Telemetry may depend only on itself, Contracts\**, Psr\**, and PHP core / Psl\**. Test code under WaffleTests\Commons\Telemetry is unrestricted (@all).

Contract-first, component-agnostic by construction: components compose through waffle-commons/contracts, never directly through one another.

🧡 Worker safety

Every cumulative counter lives in ApcuMetricStore (APCu shared memory), never on the resident worker heap β€” the only instance field on the store is its immutable key prefix. Collectors and decorators are all final readonly and stateless per request, so the component passes the igor-php worker-mode audit with zero findings (wfl igor 0 KO).

πŸ§ͺ Testing

πŸ“š Documentation

Central framework docs (DiΓ‘taxis) for this component:

πŸ“„ License

MIT β€” see LICENSE.md.


All versions of telemetry with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
waffle-commons/contracts Version self.version
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 waffle-commons/telemetry contains the following files

Loading the files please wait ...