OpenTelemetry PHP

ConsoleMetricExporter
in package
implements PushMetricExporterInterface, AggregationTemporalitySelectorInterface uses LogsMessagesTrait

Writes metrics as human-readable JSON.

The output format is unspecified, is not OTLP and may change between releases. Use it for debugging and learning, not for parsing or as input to other tools.

Tags
see
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.61.0/specification/metrics/sdk_exporters/stdout.md

Table of Contents

Interfaces

PushMetricExporterInterface
AggregationTemporalitySelectorInterface

Properties

$temporality  : Temporality|string|AggregationTemporalitySelectorInterface|null
$transport  : TransportInterface

Methods

__construct()  : mixed
export()  : bool
forceFlush()  : bool
shutdown()  : bool
temporality()  : string|Temporality|null
Returns the temporality to use for the given metric.
logDebug()  : void
logError()  : void
logInfo()  : void
logNotice()  : void
logWarning()  : void
convertInstrumentationScope()  : array<string|int, mixed>
convertMetric()  : array<string|int, mixed>
convertResource()  : array<string|int, mixed>
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.
normalize()  : mixed
JSON has no NaN or Infinity, so these use the protobuf JSON spellings.
shouldLog()  : bool

Properties

Methods

__construct()

public __construct([Temporality|string|AggregationTemporalitySelectorInterface|null $temporality = null ][, TransportInterface|null $transport = null ]) : mixed
Parameters
$temporality : Temporality|string|AggregationTemporalitySelectorInterface|null = null

a selector such as TemporalityPreference. Passing a Temporality or a string is deprecated. Null uses each stream's temporality until 2.0, and cumulative from 2.0.

$transport : TransportInterface|null = null

export()

public export(iterable<string|int, mixed> $batch) : bool
Parameters
$batch : iterable<string|int, mixed>
Tags
inheritDoc
Attributes
#[Override]
Return values
bool

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> = []

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>

normalize()

JSON has no NaN or Infinity, so these use the protobuf JSON spellings.

private static normalize(mixed $value) : mixed
Parameters
$value : mixed

shouldLog()

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

Search results