LaunchDarkly PHP SDK 6.2.0

OpTracker
in package

An OpTracker is responsible for managing the collection of measurements that which a user might wish to record throughout a migration-assisted operation.

Example measurements include latency, errors, and consistency.

The OpTracker is not expected to be instantiated directly. Consumers should instead call \LaunchDarkly\LDClient:migration_variation() and use the returned tracker instance.

Table of Contents

__construct()  : mixed
build()  : array<string, mixed>|string
Returns an array representing a migration operation event.
consistent()  : OpTracker
Allows recording the results of a consistency check.
error()  : OpTracker
Allows recording whether an error occurred during the operation.
invoked()  : OpTracker
Allows recording which {@see Origin}s were called during a migration.
latency()  : OpTracker
Allows tracking the recorded latency for an individual operation.
operation()  : OpTracker
Sets the migration related Operation associated with these tracking measurements.

Methods

__construct()

public __construct(LoggerInterface $logger, string $key, FeatureFlag|null $flag, LDContext $context, EvaluationDetail $detail, Stage $default_stage) : mixed
Parameters
$logger : LoggerInterface
$key : string
$flag : FeatureFlag|null
$context : LDContext
$detail : EvaluationDetail
$default_stage : Stage
Return values
mixed

build()

Returns an array representing a migration operation event.

public build() : array<string, mixed>|string

This event data can be provided to LDClient::trackMigrationOp() to relay this metric information upstream to LaunchDarkly services.

Return values
array<string, mixed>|string

consistent()

Allows recording the results of a consistency check.

public consistent(callable $isConsistent) : OpTracker

This method accepts a callable which should take no parameters and return a single boolean to represent the consistency check results for a read operation.

A callable is provided in case sampling rules do not require consistency checking to run. In this case, we can avoid the overhead of a function by not using the callable.

Parameters
$isConsistent : callable

Callable that accepts 0 parameters and must return a boolean

Return values
OpTracker

latency()

Allows tracking the recorded latency for an individual operation.

public latency(Origin $origin, float $elapsedMs) : OpTracker
Parameters
$origin : Origin
$elapsedMs : float
Return values
OpTracker

Search results