functions.php
Functions
trace_id()
Create a TraceId.
trace_id([null|string $hex = null ]) : TraceId
If a hex string is provided, creates a TraceId from it. Otherwise, generates a new random TraceId.
Parameters
- $hex : null|string = null
-
Optional 32-character hexadecimal string
Tags
Return values
TraceIdspan_id()
Create a SpanId.
span_id([null|string $hex = null ]) : SpanId
If a hex string is provided, creates a SpanId from it. Otherwise, generates a new random SpanId.
Parameters
- $hex : null|string = null
-
Optional 16-character hexadecimal string
Tags
Return values
SpanIdbaggage()
Create a Baggage.
baggage([array<string, string> $entries = [] ]) : Baggage
Parameters
- $entries : array<string, string> = []
-
Initial key-value entries
Return values
Baggagecontext()
Create a Context.
context([null|TraceId $traceId = null ][, null|Baggage $baggage = null ]) : Context
If no TraceId is provided, generates a new one. If no Baggage is provided, creates an empty one.
Parameters
- $traceId : null|TraceId = null
-
Optional TraceId to use
- $baggage : null|Baggage = null
-
Optional Baggage to use
Return values
Contextmemory_context_storage()
Create a MemoryContextStorage.
memory_context_storage([null|Context $context = null ]) : MemoryContextStorage
In-memory context storage for storing and retrieving the current context. A single instance should be shared across all providers within a request lifecycle.
Parameters
- $context : null|Context = null
-
Optional initial context
Return values
MemoryContextStorageresource()
Create a Resource.
resource([array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes $attributes = [] ]) : Resource
Parameters
- $attributes : array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes = []
-
Resource attributes
Return values
Resourcespan_context()
Create a SpanContext.
span_context(TraceId $traceId, SpanId $spanId[, null|SpanId $parentSpanId = null ]) : SpanContext
Parameters
- $traceId : TraceId
-
The trace ID
- $spanId : SpanId
-
The span ID
- $parentSpanId : null|SpanId = null
-
Optional parent span ID
Return values
SpanContextspan_event()
Create a SpanEvent (GenericEvent) with an explicit timestamp.
span_event(string $name, DateTimeImmutable $timestamp[, array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes $attributes = [] ]) : GenericEvent
Parameters
- $name : string
-
Event name
- $timestamp : DateTimeImmutable
-
Event timestamp
- $attributes : array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes = []
-
Event attributes
Return values
GenericEventspan_link()
Create a SpanLink.
span_link(SpanContext $context[, array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes $attributes = [] ]) : SpanLink
Parameters
- $context : SpanContext
-
The linked span context
- $attributes : array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes = []
-
Link attributes
Return values
SpanLinkspan_limits()
Create SpanLimits configuration.
span_limits([int $attributeCountLimit = 128 ][, int $eventCountLimit = 128 ][, int $linkCountLimit = 128 ][, int $attributePerEventCountLimit = 128 ][, int $attributePerLinkCountLimit = 128 ][, null|int $attributeValueLengthLimit = null ]) : SpanLimits
Parameters
- $attributeCountLimit : int = 128
-
Maximum number of attributes per span
- $eventCountLimit : int = 128
-
Maximum number of events per span
- $linkCountLimit : int = 128
-
Maximum number of links per span
- $attributePerEventCountLimit : int = 128
-
Maximum number of attributes per event
- $attributePerLinkCountLimit : int = 128
-
Maximum number of attributes per link
- $attributeValueLengthLimit : null|int = null
-
Maximum length for string attribute values (null = unlimited)
Return values
SpanLimitslog_record_limits()
Create LogRecordLimits configuration.
log_record_limits([int $attributeCountLimit = 128 ][, null|int $attributeValueLengthLimit = null ]) : LogRecordLimits
Parameters
- $attributeCountLimit : int = 128
-
Maximum number of attributes per log record
- $attributeValueLengthLimit : null|int = null
-
Maximum length for string attribute values (null = unlimited)
Return values
LogRecordLimitsmetric_limits()
Create MetricLimits configuration.
metric_limits([int $cardinalityLimit = 2000 ]) : MetricLimits
Parameters
- $cardinalityLimit : int = 2000
-
Maximum number of unique attribute combinations per instrument
Return values
MetricLimitsvoid_span_processor()
Create a VoidSpanProcessor.
void_span_processor() : VoidSpanProcessor
No-op span processor that discards all data.
Return values
VoidSpanProcessorvoid_metric_processor()
Create a VoidMetricProcessor.
void_metric_processor() : VoidMetricProcessor
No-op metric processor that discards all data.
Return values
VoidMetricProcessorvoid_log_processor()
Create a VoidLogProcessor.
void_log_processor() : VoidLogProcessor
No-op log processor that discards all data.
Return values
VoidLogProcessorvoid_exporter()
Create a VoidExporter.
void_exporter() : VoidExporter
No-op unified exporter that discards logs, metrics, and spans.
Return values
VoidExportermemory_exporter()
Create a MemoryExporter.
memory_exporter() : MemoryExporter
Unified exporter that stores logs, metrics, and spans in memory for direct access. Useful for testing and inspection without serialization.
Return values
MemoryExportermemory_span_processor()
Create a MemorySpanProcessor.
memory_span_processor(Exporter $exporter[, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : MemorySpanProcessor
Parameters
- $exporter : Exporter
-
The exporter to send spans to
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
MemorySpanProcessormemory_metric_processor()
Create a MemoryMetricProcessor.
memory_metric_processor(Exporter $exporter[, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : MemoryMetricProcessor
Parameters
- $exporter : Exporter
-
The exporter to send metrics to
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
MemoryMetricProcessormemory_log_processor()
Create a MemoryLogProcessor.
memory_log_processor(Exporter $exporter[, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : MemoryLogProcessor
Parameters
- $exporter : Exporter
-
The exporter to send logs to
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
MemoryLogProcessortracer_provider()
Create a TracerProvider.
tracer_provider(SpanProcessor $processor, ClockInterface $clock, ContextStorage $contextStorage[, Sampler $sampler = new AlwaysOnSampler() ][, SpanLimits $limits = new SpanLimits() ][, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : TracerProvider
Parameters
- $processor : SpanProcessor
-
The processor for spans
- $clock : ClockInterface
-
The clock for timestamps
- $contextStorage : ContextStorage
-
Storage for context propagation
- $sampler : Sampler = new AlwaysOnSampler()
-
Sampling strategy for spans
- $limits : SpanLimits = new SpanLimits()
-
Limits for span attributes, events, and links
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for runtime Throwables raised by the processor
Return values
TracerProviderlogger_provider()
Create a LoggerProvider.
logger_provider(LogProcessor $processor, ClockInterface $clock, ContextStorage $contextStorage[, LogRecordLimits $limits = new LogRecordLimits() ][, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : LoggerProvider
Parameters
- $processor : LogProcessor
-
The processor for logs
- $clock : ClockInterface
-
The clock for timestamps
- $contextStorage : ContextStorage
-
Storage for span correlation
- $limits : LogRecordLimits = new LogRecordLimits()
-
Limits for log record attributes
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for runtime Throwables raised by the processor
Return values
LoggerProvidermeter_provider()
Create a MeterProvider.
meter_provider(MetricProcessor $processor, ClockInterface $clock[, AggregationTemporality $temporality = AggregationTemporality::CUMULATIVE ][, ExemplarFilter $exemplarFilter = new TraceBasedExemplarFilter() ][, MetricLimits $limits = new MetricLimits() ][, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : MeterProvider
Parameters
- $processor : MetricProcessor
-
The processor for metrics
- $clock : ClockInterface
-
The clock for timestamps
- $temporality : AggregationTemporality = AggregationTemporality::CUMULATIVE
-
Aggregation temporality for metrics
- $exemplarFilter : ExemplarFilter = new TraceBasedExemplarFilter()
-
Filter for exemplar sampling (default: TraceBasedExemplarFilter)
- $limits : MetricLimits = new MetricLimits()
-
Cardinality limits for metric instruments
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for runtime Throwables raised by the processor
Return values
MeterProvidertelemetry()
Create a new Telemetry instance with the given providers.
telemetry(Resource $resource[, null|TracerProvider $tracerProvider = null ][, null|MeterProvider $meterProvider = null ][, null|LoggerProvider $loggerProvider = null ][, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : Telemetry
If providers are not specified, void providers (no-op) are used.
Parameters
- $resource : Resource
-
The resource describing the entity producing telemetry
- $tracerProvider : null|TracerProvider = null
-
The tracer provider (null for void/disabled)
- $meterProvider : null|MeterProvider = null
-
The meter provider (null for void/disabled)
- $loggerProvider : null|LoggerProvider = null
-
The logger provider (null for void/disabled)
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler propagated to default void providers when explicit ones are not supplied
Return values
Telemetryinstrumentation_scope()
Create an InstrumentationScope.
instrumentation_scope(string $name[, string $version = 'unknown' ][, null|string $schemaUrl = null ][, Attributes $attributes = new Attributes() ]) : InstrumentationScope
Parameters
- $name : string
-
The instrumentation scope name
- $version : string = 'unknown'
-
The instrumentation scope version
- $schemaUrl : null|string = null
-
Optional schema URL
- $attributes : Attributes = new Attributes()
Return values
InstrumentationScopebatching_span_processor()
Create a BatchingSpanProcessor.
batching_span_processor(Exporter $exporter[, int $batchSize = 512 ][, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : BatchingSpanProcessor
Parameters
- $exporter : Exporter
-
The exporter to send spans to
- $batchSize : int = 512
-
Number of spans to collect before exporting (default 512)
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
BatchingSpanProcessorpass_through_span_processor()
Create a PassThroughSpanProcessor.
pass_through_span_processor(Exporter $exporter[, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : PassThroughSpanProcessor
Parameters
- $exporter : Exporter
-
The exporter to send spans to
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
PassThroughSpanProcessorbatching_metric_processor()
Create a BatchingMetricProcessor.
batching_metric_processor(Exporter $exporter[, int $batchSize = 512 ][, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : BatchingMetricProcessor
Parameters
- $exporter : Exporter
-
The exporter to send metrics to
- $batchSize : int = 512
-
Number of metrics to collect before exporting (default 512)
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
BatchingMetricProcessorpass_through_metric_processor()
Create a PassThroughMetricProcessor.
pass_through_metric_processor(Exporter $exporter[, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : PassThroughMetricProcessor
Parameters
- $exporter : Exporter
-
The exporter to send metrics to
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
PassThroughMetricProcessorbatching_log_processor()
Create a BatchingLogProcessor.
batching_log_processor(Exporter $exporter[, int $batchSize = 512 ][, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : BatchingLogProcessor
Parameters
- $exporter : Exporter
-
The exporter to send logs to
- $batchSize : int = 512
-
Number of logs to collect before exporting (default 512)
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
BatchingLogProcessorpass_through_log_processor()
Create a PassThroughLogProcessor.
pass_through_log_processor(Exporter $exporter[, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : PassThroughLogProcessor
Parameters
- $exporter : Exporter
-
The exporter to send logs to
- $errorHandler : ErrorHandler = new ErrorLogHandler()
-
Handler for Throwables raised by the exporter
Return values
PassThroughLogProcessorpipeline_log_processor()
Create a PipelineLogProcessor: run each log entry through an ordered chain of middleware, then forward the survivors to a single sink.
pipeline_log_processor(array<int, LogMiddleware> $middleware, LogSink $sink) : PipelineLogProcessor
Parameters
- $middleware : array<int, LogMiddleware>
-
run in order; the first to drop an entry short-circuits the rest
- $sink : LogSink
-
the terminal processor that exports surviving entries
Return values
PipelineLogProcessorenriching_log_middleware()
Create an EnrichingLogMiddleware that merges default attributes into every log entry. Attributes set at the call site win over these defaults.
enriching_log_middleware(array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes $attributes) : EnrichingLogMiddleware
Parameters
- $attributes : array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes
Return values
EnrichingLogMiddlewareattribute_filtering_log_middleware()
Create an AttributeFilteringLogMiddleware that drops log entries matching the filter.
attribute_filtering_log_middleware(AttributeFilter $filter) : AttributeFilteringLogMiddleware
Parameters
- $filter : AttributeFilter
-
The attribute filter to apply
Return values
AttributeFilteringLogMiddlewareseverity_filtering_log_middleware()
Create a SeverityFilteringLogMiddleware that drops log entries below a minimum severity.
severity_filtering_log_middleware([Severity $minimumSeverity = Severity::INFO ]) : SeverityFilteringLogMiddleware
Parameters
- $minimumSeverity : Severity = Severity::INFO
-
Minimum severity level (default: INFO)
Return values
SeverityFilteringLogMiddlewareattribute_rule()
Create a single attribute-matching rule for an AttributeFilter.
attribute_rule(array<string|int, string>|string $path, MatchMode $mode, bool|DateTimeInterface|float|int|string $expected[, bool $caseSensitive = true ]) : AttributeRule
Parameters
- $path : array<string|int, string>|string
-
attribute path: a top-level key, or segments descending into nested array values
- $mode : MatchMode
-
comparison applied between the value at the path and the expected value
- $expected : bool|DateTimeInterface|float|int|string
-
expected value (must be a string for the pattern modes)
- $caseSensitive : bool = true
-
applies to the substring modes only (STARTS_WITH, ENDS_WITH, CONTAINS)
Return values
AttributeRuleall()
Combine matchers so that every one must match (logical AND).
all(Matcher ...$matchers) : All
Parameters
- $matchers : Matcher
Return values
Allany()
Combine matchers so that at least one must match (logical OR).
any(Matcher ...$matchers) : Any
Parameters
- $matchers : Matcher
Return values
Anynot()
Negate a matcher (logical NOT).
not(Matcher $matcher) : Not
Parameters
- $matcher : Matcher
Return values
Notattribute_filter()
Create an AttributeFilter from a matcher.
attribute_filter(Matcher $matcher[, bool $exclude = true ][, array<int, AttributeSource> $sources = [AttributeSource::SIGNAL] ][, null|string $cacheDir = null ][, int $cacheDirPermissions = 0700 ]) : AttributeFilter
Parameters
- $matcher : Matcher
-
the matcher to evaluate against a signal's attributes (compose with all(), any(), not())
- $exclude : bool = true
-
when true (default) a match drops the signal; when false only matching signals are kept
- $sources : array<int, AttributeSource> = [AttributeSource::SIGNAL]
-
which attribute sets to inspect (signal, resource and/or scope); the matcher is OR-combined across them, defaulting to the signal's own attributes
- $cacheDir : null|string = null
-
directory for the generated matcher file (defaults to the system temp directory). It is
required, so it MUST be trusted - not writable by untrusted users. Prefer an application-private directory over the shared system temp in multi-tenant environments. - $cacheDirPermissions : int = 0700
-
mode applied when the cache directory is created (octal, subject to umask; defaults to 0700 - owner only, since the directory holds
required PHP)
Return values
AttributeFilterattribute_filtering_metric_processor()
Create an AttributeFilteringMetricProcessor.
attribute_filtering_metric_processor(MetricProcessor $processor, AttributeFilter $filter) : AttributeFilteringMetricProcessor
Parameters
- $processor : MetricProcessor
-
The processor to wrap
- $filter : AttributeFilter
-
The attribute filter to apply
Return values
AttributeFilteringMetricProcessorattribute_filtering_span_processor()
Create an AttributeFilteringSpanProcessor.
attribute_filtering_span_processor(SpanProcessor $processor, AttributeFilter $filter) : AttributeFilteringSpanProcessor
Parameters
- $processor : SpanProcessor
-
The processor to wrap
- $filter : AttributeFilter
-
The attribute filter to apply
Return values
AttributeFilteringSpanProcessorconsole_exporter()
Create a unified ConsoleExporter for logs, metrics, and spans.
console_exporter([bool $colors = true ][, null|int $maxLogBodyLength = 100 ][, ConsoleLogOptions $logOptions = new ConsoleLogOptions() ][, ConsoleMetricOptions $metricOptions = new ConsoleMetricOptions() ][, ConsoleSpanOptions $spanOptions = new ConsoleSpanOptions() ]) : ConsoleExporter
Outputs telemetry to the console with ASCII table formatting and optional ANSI colors.
Parameters
- $colors : bool = true
-
Whether to use ANSI colors (default: true)
- $maxLogBodyLength : null|int = 100
-
Maximum length for log body+attributes column (null = no limit)
- $logOptions : ConsoleLogOptions = new ConsoleLogOptions()
-
Display options for log records
- $metricOptions : ConsoleMetricOptions = new ConsoleMetricOptions()
-
Display options for metrics
- $spanOptions : ConsoleSpanOptions = new ConsoleSpanOptions()
-
Display options for spans
Return values
ConsoleExporterconsole_span_options()
Create ConsoleSpanOptions with all display options enabled (default behavior).
console_span_options() : ConsoleSpanOptions
Return values
ConsoleSpanOptionsconsole_span_options_minimal()
Create ConsoleSpanOptions with minimal display (legacy compact format).
console_span_options_minimal() : ConsoleSpanOptions
Return values
ConsoleSpanOptionsconsole_log_options()
Create ConsoleLogOptions with all display options enabled (default behavior).
console_log_options() : ConsoleLogOptions
Return values
ConsoleLogOptionsconsole_log_options_minimal()
Create ConsoleLogOptions with minimal display (legacy compact format).
console_log_options_minimal() : ConsoleLogOptions
Return values
ConsoleLogOptionsconsole_metric_options()
Create ConsoleMetricOptions with all display options enabled (default behavior).
console_metric_options() : ConsoleMetricOptions
Return values
ConsoleMetricOptionsconsole_metric_options_minimal()
Create ConsoleMetricOptions with minimal display (legacy compact format).
console_metric_options_minimal() : ConsoleMetricOptions
Return values
ConsoleMetricOptionsalways_on_exemplar_filter()
Create an AlwaysOnExemplarFilter.
always_on_exemplar_filter() : AlwaysOnExemplarFilter
Return values
AlwaysOnExemplarFilteralways_off_exemplar_filter()
Create an AlwaysOffExemplarFilter.
always_off_exemplar_filter() : AlwaysOffExemplarFilter
Return values
AlwaysOffExemplarFiltertrace_based_exemplar_filter()
Create a TraceBasedExemplarFilter.
trace_based_exemplar_filter() : TraceBasedExemplarFilter
Return values
TraceBasedExemplarFilteralways_on_sampler()
Create an AlwaysOnSampler. Records and samples every span.
always_on_sampler() : AlwaysOnSampler
Return values
AlwaysOnSampleralways_off_sampler()
Create an AlwaysOffSampler. Drops every span.
always_off_sampler() : AlwaysOffSampler
Return values
AlwaysOffSamplertrace_id_ratio_based_sampler()
Create a TraceIdRatioBasedSampler. Samples a deterministic fraction of traces.
trace_id_ratio_based_sampler(float $ratio) : TraceIdRatioBasedSampler
Parameters
- $ratio : float
-
Sampling probability between 0.0 and 1.0
Return values
TraceIdRatioBasedSamplerparent_based_sampler()
Create a ParentBasedSampler. Honors the parent span's sampling decision, falling back to the root sampler for spans without a parent.
parent_based_sampler([Sampler $root = new AlwaysOnSampler() ]) : ParentBasedSampler
Parameters
- $root : Sampler = new AlwaysOnSampler()
-
Sampler used for root spans (no parent)
Return values
ParentBasedSamplerattribute_matching_sampler()
Create an AttributeMatchingSampler. Drops spans whose start-time attributes match the filter (or keeps ONLY matching spans when the filter's exclude is false), and defers all other spans to the delegate sampler.
attribute_matching_sampler(AttributeFilter $filter[, Sampler $delegate = new AlwaysOnSampler() ]) : AttributeMatchingSampler
Only attributes available at span start are visible; attributes added later are not.
Parameters
- $filter : AttributeFilter
-
The attribute filter evaluated against the span's start attributes
- $delegate : Sampler = new AlwaysOnSampler()
-
Sampler that decides spans which do not match (default: AlwaysOnSampler)
Return values
AttributeMatchingSamplerpropagation_context()
Create a PropagationContext.
propagation_context([null|SpanContext $spanContext = null ][, null|Baggage $baggage = null ]) : PropagationContext
Parameters
- $spanContext : null|SpanContext = null
-
Optional span context
- $baggage : null|Baggage = null
-
Optional baggage
Return values
PropagationContextarray_carrier()
Create an ArrayCarrier.
array_carrier([array<string, string> $data = [] ]) : ArrayCarrier
Parameters
- $data : array<string, string> = []
-
Initial carrier data
Return values
ArrayCarriersuperglobal_carrier()
Create a SuperglobalCarrier.
superglobal_carrier() : SuperglobalCarrier
Return values
SuperglobalCarrierw3c_trace_context()
Create a W3CTraceContext propagator.
w3c_trace_context() : W3CTraceContext
Return values
W3CTraceContextw3c_baggage()
Create a W3CBaggage propagator.
w3c_baggage() : W3CBaggage
Return values
W3CBaggagecomposite_propagator()
Create a CompositePropagator.
composite_propagator(Propagator ...$propagators) : CompositePropagator
Parameters
- $propagators : Propagator
-
The propagators to combine
Return values
CompositePropagatorchain_detector()
Create a ChainDetector.
chain_detector(ResourceDetector ...$detectors) : ChainDetector
Parameters
- $detectors : ResourceDetector
-
The detectors to chain
Return values
ChainDetectoros_detector()
Create an OsDetector.
os_detector() : OsDetector
Return values
OsDetectorhost_detector()
Create a HostDetector.
host_detector() : HostDetector
Return values
HostDetectorprocess_detector()
Create a ProcessDetector.
process_detector() : ProcessDetector
Return values
ProcessDetectorenvironment_detector()
Create an EnvironmentDetector.
environment_detector() : EnvironmentDetector
Return values
EnvironmentDetectorcomposer_detector()
Create a ComposerDetector.
composer_detector() : ComposerDetector
Return values
ComposerDetectormanual_detector()
Create a ManualDetector.
manual_detector(array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable> $attributes) : ManualDetector
Parameters
- $attributes : array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>
-
Resource attributes
Return values
ManualDetectorcaching_detector()
Create a CachingDetector.
caching_detector(ResourceDetector $detector[, null|string $cachePath = null ]) : CachingDetector
Parameters
- $detector : ResourceDetector
-
The detector to wrap
- $cachePath : null|string = null
-
Cache file path (default: sys_get_temp_dir()/flow_telemetry_resource.cache)
Return values
CachingDetectorresource_detector()
Create a resource detector chain.
resource_detector([array<string|int, ResourceDetector> $detectors = [] ]) : ChainDetector
Parameters
- $detectors : array<string|int, ResourceDetector> = []
-
Optional custom detectors (empty = use defaults)
Return values
ChainDetectorerror_log_handler()
Create the default ErrorLogHandler. Writes via PHP's error_log().
error_log_handler([ErrorLogMessageType $messageType = ErrorLogMessageType::OperatingSystem ][, bool $expandNewlines = false ][, string $messagePrefix = '[flow-telemetry]' ]) : ErrorLogHandler
Parameters
- $messageType : ErrorLogMessageType = ErrorLogMessageType::OperatingSystem
- $expandNewlines : bool = false
- $messagePrefix : string = '[flow-telemetry]'
Return values
ErrorLogHandlerstream_error_handler()
Create a StreamHandler. Appends formatted Throwables (one per line) to a file path or php:// stream wrapper.
stream_error_handler(string $destination[, int $filePermissions = 0644 ][, bool $createDirectories = true ][, string $messagePrefix = '[flow-telemetry]' ]) : StreamHandler
Parameters
- $destination : string
- $filePermissions : int = 0644
- $createDirectories : bool = true
- $messagePrefix : string = '[flow-telemetry]'
Return values
StreamHandlersyslog_error_handler()
Create a SyslogHandler. Writes via openlog/syslog/closelog.
syslog_error_handler([string $ident = 'flow-telemetry' ][, SyslogFacility $facility = SyslogFacility::User ][, int $logOpts = LOG_PID ][, SyslogSeverity $severity = SyslogSeverity::Error ]) : SyslogHandler
Parameters
- $ident : string = 'flow-telemetry'
- $facility : SyslogFacility = SyslogFacility::User
- $logOpts : int = LOG_PID
- $severity : SyslogSeverity = SyslogSeverity::Error
Return values
SyslogHandlerudp_syslog_error_handler()
Create a UdpSyslogHandler. Sends RFC 5424-style syslog frames over UDP.
udp_syslog_error_handler(string $host[, int $port = 514 ][, string $ident = 'flow-telemetry' ][, SyslogFacility $facility = SyslogFacility::User ][, SyslogSeverity $severity = SyslogSeverity::Error ]) : UdpSyslogHandler
Parameters
- $host : string
- $port : int = 514
- $ident : string = 'flow-telemetry'
- $facility : SyslogFacility = SyslogFacility::User
- $severity : SyslogSeverity = SyslogSeverity::Error
Return values
UdpSyslogHandlercomposite_error_handler()
Fan errors out to multiple handlers.
composite_error_handler(ErrorHandler ...$handlers) : CompositeErrorHandler
Parameters
- $handlers : ErrorHandler
Return values
CompositeErrorHandlernull_error_handler()
Discard every error. Use only in tests or for explicit silence.
null_error_handler() : NullErrorHandler