Download the PHP package monkeyscloud/monkeyslegion-telemetry without Composer

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

🐒 MonkeysLegion Telemetry 2.0

A production-grade observability toolkit for PHP 8.4+ providing metrics, distributed tracing, and structured logging in a single, unified package. Ships with Prometheus, StatsD, W3C Trace Context, and PSR-3/PSR-15 integrations out of the box.

PHP Version [Tests]()


What's New in 2.0

Area v1 v2
PHP version 8.1+ 8.4+readonly, final, enums, named args
Metrics Basic Prometheus only MetricsInterface — Prometheus, StatsD, InMemory, Null drivers
Tracing Full W3C Trace Context — spans, events, exporters
Logging PSR-3 TelemetryLogger with automatic trace correlation
Middleware PSR-15 RequestMetricsMiddleware + RequestTracingMiddleware
Attributes #[Traced], #[Counted], #[Timed]
Factory Manual construction TelemetryFactory::create() — one-line bootstrapping
Facade Telemetry::counter(), Telemetry::trace(), Telemetry::log()

Features

📊 Metrics — Counter, Gauge, Histogram, Summary with Prometheus and StatsD backends

🔍 Distributed Tracing — W3C Trace Context compatible spans, events, and exception recording

📝 Structured Logging — PSR-3 logger with automatic trace/span ID injection

🌐 PSR-15 Middleware — Automatic HTTP request metrics and distributed tracing

🏷️ PHP 8 Attributes#[Traced], #[Counted], #[Timed] for declarative instrumentation

🏭 Factory Pattern — One-line bootstrap via TelemetryFactory::create()

Zero-cost Null DriversNullMetrics, NullTracer for safe development


Installation

Optional Dependencies


Quick Start

One-line Bootstrap


Metrics

All metric drivers implement MetricsInterface and support Counter, Gauge, Histogram, Summary, and Timer operations.

Drivers

Driver Class Use Case
null NullMetrics Development — zero overhead
memory InMemoryMetrics Testing, single-request
prometheus PrometheusMetrics Production — Prometheus scraping
statsd StatsDMetrics Production — StatsD / DogStatsD / Telegraf

Counter (Monotonically Increasing)

Gauge (Point-in-Time Value)

Histogram (Distribution / Timing)

Timer Helper

Direct Driver Construction


Distributed Tracing

W3C Trace Context compatible tracing with automatic parent-child span relationships.

Traced Callback (Recommended)

Manual Span Management

Span Events

Trace Context Propagation

Span Kinds

Kind Use
SpanKind::INTERNAL Default — internal application logic
SpanKind::SERVER Incoming HTTP request handling
SpanKind::CLIENT Outgoing HTTP / DB / RPC call
SpanKind::PRODUCER Message queue publish
SpanKind::CONSUMER Message queue consume

Exporters

Exporter Class Use Case
console ConsoleExporter Local development / debugging
http JsonHttpExporter OTLP/HTTP — Jaeger, Tempo, Zipkin
InMemoryExporter Unit testing

Logging with Trace Correlation

PSR-3 compatible logging that automatically injects trace_id and span_id into every log entry.

Direct Logger Construction

Log Processors


PSR-15 Middleware

Request Metrics

Automatically records http_requests_total, http_request_duration_seconds, and http_requests_in_progress for every request.

Recorded metrics:

Metric Type Labels
http_requests_total Counter method, route, status
http_request_duration_seconds Histogram method, route, status
http_requests_in_progress Gauge

Request Tracing

Creates a root SERVER span per request with W3C trace context propagation.

Span attributes:

Attribute Example
http.method GET
http.url https://api.example.com/users/42
http.target /users/42
http.status_code 200
http.host api.example.com
net.peer.ip 192.168.1.1

PHP 8 Attributes

Declarative instrumentation via attributes. Combine with an AOP framework or the MonkeysLegion service container for automatic weaving.

#[Traced] — Automatic Span Creation

#[Counted] — Automatic Call Counting

#[Timed] — Automatic Duration Measurement


Factory & Configuration

TelemetryFactory

Configuration Reference

Metrics

Key Type Default Description
driver string 'null' null, memory, prometheus, statsd
namespace string 'app' Metric name prefix
host string '127.0.0.1' StatsD host
port int 8125 StatsD port
dogstatsd bool false Enable DogStatsD tag format
sample_rate float 1.0 StatsD sampling rate (0.0–1.0)
prometheus_adapter Adapter InMemory Prometheus storage adapter

Tracing

Key Type Default Description
enabled bool true Enable/disable tracing
service_name string 'app' Service identifier
sample_rate float 1.0 Trace sampling rate (0.0–1.0)
exporter string 'console' console, http, none
endpoint string 'http://localhost:4318/v1/traces' OTLP endpoint
headers array [] Extra HTTP headers for exporter

Logging

Key Type Default Description
stream string\|resource 'php://stderr' Output stream
level string 'debug' Minimum log level (PSR-3)
json bool false Enable JSON formatting
pretty bool false Pretty-print JSON

Complete Application Example


Prometheus Metrics Endpoint


Architecture


Testing


License

MIT © MonkeysCloud


All versions of monkeyslegion-telemetry with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
psr/log Version ^3.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 monkeyscloud/monkeyslegion-telemetry contains the following files

Loading the files please wait ...