InvergeDocs
PHPAPI reference

Telescope

Telescope in the PHP SDK.

// access
$nexus->telescope()
SymbolKindSummary
TelescopeclassNexus Telescope — records the journey of every unit of work (an HTTP request, a queued job, a console command, a scheduled task) and everything it did: queries, outgoing HTTP, cache, events, jobs dispatched, mail, except
TraceContextclassW3C Trace Context (traceparent: 00-<32 hex trace>-<16 hex span>-<flags>).
RedactorclassRemoves secrets before anything leaves the process.

Telescope

class
class Inverge\Nexus\Telescope\Telescope

Nexus Telescope — records the journey of every unit of work (an HTTP request, a queued job, a console command, a scheduled task) and everything it did: queries, outgoing HTTP, cache, events, jobs dispatched, mail, exceptions, logs… Framework-agnostic; the Laravel and Symfony integrations drive it automatically.

$t = $nexus->telescope();
$t->start('request', ['method' => 'GET', 'uri' => '/orders/7'], ['traceparent' => $_SERVER['HTTP_TRACEPARENT'] ?? null]);
$t->query('select * from orders where id = ?', [7], 1.8, 'mysql');
$result = $t->span('price lookup', fn () => $pricing->quote($order));
$t->finish(['responseStatus' => 200]);

Nothing here ever throws into the host application: recording and delivery failures are swallowed. Batches are tail-sampled at finish, so failed and slow work is always kept whatever the sample rate.

Batches nest (a sync queue job runs inside the request that dispatched it), so the recorder keeps a STACK; entries always go to the innermost batch.

ConstantValue
0\{"name":"VERSION","value":"1.8.0"\}
View source

__construct

constructor
function __construct(Inverge\Nexus\NexusClient $client, array $options = [])

enabled?: bool, service?: string|null, host?: string|null, release?: string|null, timeout?: float, max_entries?: int, ignore_types?: list<string>, ignore_paths?: list<string>, redact_keys?: list<string>, sample_rate?: float|null, capture_response_bodies?: bool, body_size_limit?: int, cache_dir?: string|null, transport?: Transport, } $options

Parameters

Prop

Type

View source

frames()

static method
static function frames(Throwable $e): array

Stack frames in the shape Nexus Errors renders.

Parameters

Prop

Type

Returns list<array{function:string,filename:string,lineno:int}>

View source

scalarize()

static method
static function scalarize(mixed $value, int $depth = 0)

Make values JSON-safe: objects become their class (or id for models), resources their type, long strings are clipped.

Parameters

Prop

Type

Returns mixed

View source

enabled()

method
function enabled(): bool

Whether Telescope records at all (local switch, service switch, remote pause). */

Returns bool

View source

active()

method
function active(): bool

Whether a unit of work is being recorded right now. */

Returns bool

View source

current()

method
function current(): ?Inverge\Nexus\Telescope\Batch

Returns ?Inverge\Nexus\Telescope\Batch

View source

ignores()

method
function ignores(string $type): bool

Whether this entry type is switched off locally or from the console. */

Parameters

Prop

Type

Returns bool

View source

ignoresPath()

method
function ignoresPath(string $path): bool

Whether a request path is ignored (/health, /horizon/*, …). */

Parameters

Prop

Type

Returns bool

View source

redactor()

method
function redactor(): Inverge\Nexus\Telescope\Redactor

Returns Inverge\Nexus\Telescope\Redactor

View source

option()

method
function option(string $key)

Parameters

Prop

Type

Returns mixed — */

View source

start()

method
function start(string $type, array $content = [], array $context = []): ?string

Open a unit of work. $context may carry an incoming traceparent header, or an explicit traceId / parentSpanId (from a job payload), plus tags, user, name, sessionKey, deviceKey.

Parameters

Prop

Type

Returns ?string

View source

finish()

method
function finish(array $content = [], ?string $status = NULL, ?string $name = NULL): void

Close the innermost unit of work: merge final content, decide whether to keep it (tail sampling) and queue it for delivery. Sends when the outermost one closes.

Parameters

Prop

Type

View source

finishAll()

method
function finishAll(array $content = []): void

Close every open unit of work (e.g. a fatal error ended the process). */

Parameters

Prop

Type

View source

record()

method
function record(string $type, array $content = [], array $opts = []): ?string

Record an entry in the current unit of work.

Options: durationMs, startedAt (microtime float), status, name, tags, parentId, id.

Parameters

Prop

Type

Returns ?string

View source

span()

method
function span(string $name, callable $fn, array $content = [], string $type = 'span')

Run $fn inside a named span; entries recorded meanwhile nest under it.

Parameters

Prop

Type

Returns T

View source

openSpan()

method
function openSpan(string $type, string $name, array $content = []): ?string

Open a span manually (pair with closeSpan()); returns its id.

Parameters

Prop

Type

Returns ?string

View source

closeSpan()

method
function closeSpan(?string $id, array $extra = []): void

Parameters

Prop

Type

View source

query()

method
function query(string $sql, array $bindings, float $durationMs, ?string $connection = NULL, array $extra = []): ?string

Parameters

Prop

Type

Returns ?string

View source

exception()

method
function exception(Throwable $e, bool $handled = false, array $context = []): ?string

Parameters

Prop

Type

Returns ?string

View source

log()

method
function log(string $level, string $message, array $context = []): ?string

Parameters

Prop

Type

Returns ?string

View source

tag()

method
function tag(string ...$tags): void

Parameters

Prop

Type

View source

user()

method
function user(array $user): void

The authenticated user of the current unit of work. id becomes the Auth:<id> tag and correlates the journey into Nexus Sessions.

Parameters

Prop

Type

View source

traceparent()

method
function traceparent(?string $spanId = NULL): ?string

A W3C traceparent for an outgoing call made from the current point. */

Parameters

Prop

Type

Returns ?string

View source

propagation()

method
function propagation(?string $spanId = NULL): ?array

What a queued job carries so its execution joins this trace.

Parameters

Prop

Type

Returns array{traceId:string,parentSpanId:string}|null

View source

flush()

method
function flush(): void

Send queued batches now. Never throws. */

View source

TraceContext

class
class Inverge\Nexus\Telescope\TraceContext

W3C Trace Context (traceparent: 00-<32 hex trace>-<16 hex span>-<flags>). Interoperates with OpenTelemetry, so a PHP service and an OTel-instrumented Go/Java/Node service show up in the same Nexus trace.

View source

parse()

static method
static function parse(?string $header): ?array

Parameters

Prop

Type

Returns array{traceId:string,spanId:string}|null — */

View source

format()

static method
static function format(string $traceId, string $spanId): string

Parameters

Prop

Type

Returns string

View source

newTraceId()

static method
static function newTraceId(): string

Returns string

View source

newSpanId()

static method
static function newSpanId(): string

Returns string

View source

Redactor

class
class Inverge\Nexus\Telescope\Redactor

Removes secrets before anything leaves the process. Keys are matched case-insensitively; any key containing "password" or "secret" is always redacted. The Nexus server redacts again with the environment's own list.

ConstantValue
0\{"name":"REDACTED","value":"********"\}
1\{"name":"DEFAULT_KEYS","value":"[\\"authorization\\",\\"proxy-authorization\\",\\"cookie\\",\\"set-cookie\\",\\"x-api-key\\",\\"x-csrf-token\\",\\"x-xsrf-token\\",\\"php-auth-pw\\",\\"token\\",\\"access_token\\",\\"refresh_token\\",\\"id_token\\",\\"api_key\\",\\"apikey\\",\\"client_secret\\",\\"private_key\\",\\"credit_card\\",\\"card_number\\",\\"cvv\\",\\"cvc\\",\\"ssn\\",\\"_token\\"]"\}
View source

__construct

constructor
function __construct(array $extra = [])

Parameters

Prop

Type

View source

globMatch()

static method
static function globMatch(string $glob, string $value): bool

Parameters

Prop

Type

Returns bool

View source

redact()

method
function redact(array $data, int $depth = 0): array

Parameters

Prop

Type

Returns array<mixed>

View source

On this page