Repository navigation
ObservabilityAdapter
Pair\Core\ObservabilityAdapter receives completed runtime spans from Observability.
public function record(\Pair\Core\ObservabilitySpan $span): void;ObservabilitySpan exposes the operation name, start/end timestamps, duration in milliseconds, status, sanitized attributes, and correlation ID through accessor methods and toArray().
use Pair\Core\Observability;
use Pair\Core\ObservabilityAdapter;
use Pair\Core\ObservabilitySpan;
final class LogSpanAdapter implements ObservabilityAdapter {
/**
* Forward one completed span to the application log.
*/
public function record(ObservabilitySpan $span): void {
error_log(json_encode($span->toArray(), JSON_UNESCAPED_SLASHES));
}
}
Observability::setAdapter(new LogSpanAdapter());Installing an adapter enables instrumentation unless it is explicitly disabled with Observability::enable(false). Applications can also register it under AdapterKeys::OBSERVABILITY; see AdapterRegistry.
Implement ObservabilityEventAdapter as well when the collector should receive non-span warning/error events. The two interfaces are separate so existing span-only adapters remain compatible.
See Observability for sampling, environment configuration, event limits, and debug headers. Built-in collectors include SentryObservabilityAdapter and OpenTelemetryHttpExporter.
Home · Setup · Configuration
Build with Pair 4
- Generator
- Controllers and responses
- Read models
- ActiveRecord and queries
- Forms and validation
- PairUI.js and HTML fragments
APIs and authentication
- API guide and CRUD
- Middleware and rate limits
- Users, sessions, and ACL
- Passkeys and social login
- Native mobile setup
Integrate and operate
- Integrations
- Runtime extensions and adapter keys
- Cache and cache stores
- Logs and observability
- PWA and push
- Packages and distribution
- Upgrade to v4