OpenTelemetry PHP

ConfigurationFactory
in package
uses LogsMessagesTrait

FinalYes
Tags
template

Table of Contents

Properties

$compiledFactory  : CompiledConfigurationFactory
$componentProviders  : iterable<string|int, mixed>
$envReader  : EnvReader
$rootComponent  : ComponentProvider

Methods

__construct()  : mixed
parseFile()  : ComponentPlugin
process()  : ComponentPlugin<string|int, T>
logDebug()  : void
logError()  : void
logInfo()  : void
logNotice()  : void
logWarning()  : void
compileFactory()  : CompiledConfigurationFactory
doLog()  : void
Logging is best effort: a failing log writer (for example an error handler that throws on `trigger_error`) must not break the code that is being observed.
includeCache()  : mixed
shouldLog()  : bool
writeCache()  : void

Properties

Methods

parseFile()

public parseFile(string $file[, string|null $cacheFile = null ][, bool $debug = true ]) : ComponentPlugin
Parameters
$file : string

path to parse

$cacheFile : string|null = null

path to cache parsed configuration to

$debug : bool = true

will check for cache freshness if debug mode enabled

Tags
throws
Exception

if loading of a configuration file fails for any reason

InvalidConfigurationException

if the configuration is invalid

see
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.61.0/specification/configuration/sdk.md#parse
Return values
ComponentPlugin —

parsed component plugin

process()

public process(array<string|int, mixed> $configs[, ResourceCollection|null $resources = null ]) : ComponentPlugin<string|int, T>
Parameters
$configs : array<string|int, mixed>

configs to process

$resources : ResourceCollection|null = null

resources that can be used for cache invalidation

Tags
throws
InvalidConfigurationException

if the configuration is invalid

Return values
ComponentPlugin<string|int, T> —

processed component plugin

logDebug()

protected static logDebug(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = []

logError()

protected static logError(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = []

logInfo()

protected static logInfo(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = []

logNotice()

protected static logNotice(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = []

logWarning()

protected static logWarning(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = []

compileFactory()

private compileFactory() : CompiledConfigurationFactory
Return values
CompiledConfigurationFactory

doLog()

Logging is best effort: a failing log writer (for example an error handler that throws on `trigger_error`) must not break the code that is being observed.

private static doLog(string $level, string $message, array<string|int, mixed> $context) : void
Parameters
$level : string
$message : string
$context : array<string|int, mixed>

includeCache()

private static includeCache(string $path) : mixed
Parameters
$path : string

shouldLog()

private static shouldLog(string $level) : bool
Parameters
$level : string
Return values
bool

writeCache()

private static writeCache(ResourceCheckerConfigCache $cache, ComponentPlugin $configuration, ResourceCollection $resources) : void
Parameters
$cache : ResourceCheckerConfigCache
$configuration : ComponentPlugin
$resources : ResourceCollection
On this page

Search results