Telescope
Telescope in the PHP SDK.
// access
$nexus->telescope()| Symbol | Kind | Summary |
|---|---|---|
Telescope | class | 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, except |
TraceContext | class | W3C Trace Context (traceparent: 00-<32 hex trace>-<16 hex span>-<flags>). |
Redactor | class | Removes secrets before anything leaves the process. |
Telescope
classclass Inverge\Nexus\Telescope\TelescopeNexus 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.
| Constant | Value |
|---|---|
0 | \{"name":"VERSION","value":"1.8.0"\} |
__construct
constructorfunction __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
frames()
static methodstatic function frames(Throwable $e): arrayStack frames in the shape Nexus Errors renders.
Parameters
Prop
Type
Returns list<array{function:string,filename:string,lineno:int}>
scalarize()
static methodstatic 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
enabled()
methodfunction enabled(): boolWhether Telescope records at all (local switch, service switch, remote pause). */
Returns bool
active()
methodfunction active(): boolWhether a unit of work is being recorded right now. */
Returns bool
current()
methodfunction current(): ?Inverge\Nexus\Telescope\BatchReturns ?Inverge\Nexus\Telescope\Batch
ignores()
methodfunction ignores(string $type): boolWhether this entry type is switched off locally or from the console. */
Parameters
Prop
Type
Returns bool
ignoresPath()
methodfunction ignoresPath(string $path): boolWhether a request path is ignored (/health, /horizon/*, …). */
Parameters
Prop
Type
Returns bool
redactor()
methodfunction redactor(): Inverge\Nexus\Telescope\RedactorReturns Inverge\Nexus\Telescope\Redactor
option()
methodfunction option(string $key)Parameters
Prop
Type
Returns mixed — */
start()
methodfunction start(string $type, array $content = [], array $context = []): ?stringOpen 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
finish()
methodfunction finish(array $content = [], ?string $status = NULL, ?string $name = NULL): voidClose 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
finishAll()
methodfunction finishAll(array $content = []): voidClose every open unit of work (e.g. a fatal error ended the process). */
Parameters
Prop
Type
record()
methodfunction record(string $type, array $content = [], array $opts = []): ?stringRecord an entry in the current unit of work.
Options: durationMs, startedAt (microtime float), status, name,
tags, parentId, id.
Parameters
Prop
Type
Returns ?string
span()
methodfunction 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
openSpan()
methodfunction openSpan(string $type, string $name, array $content = []): ?stringOpen a span manually (pair with closeSpan()); returns its id.
Parameters
Prop
Type
Returns ?string
closeSpan()
methodfunction closeSpan(?string $id, array $extra = []): voidParameters
Prop
Type
query()
methodfunction query(string $sql, array $bindings, float $durationMs, ?string $connection = NULL, array $extra = []): ?stringParameters
Prop
Type
Returns ?string
exception()
methodfunction exception(Throwable $e, bool $handled = false, array $context = []): ?stringParameters
Prop
Type
Returns ?string
log()
methodfunction log(string $level, string $message, array $context = []): ?stringParameters
Prop
Type
Returns ?string
tag()
methodfunction tag(string ...$tags): voidParameters
Prop
Type
user()
methodfunction user(array $user): voidThe authenticated user of the current unit of work. id becomes the
Auth:<id> tag and correlates the journey into Nexus Sessions.
Parameters
Prop
Type
traceparent()
methodfunction traceparent(?string $spanId = NULL): ?stringA W3C traceparent for an outgoing call made from the current point. */
Parameters
Prop
Type
Returns ?string
propagation()
methodfunction propagation(?string $spanId = NULL): ?arrayWhat a queued job carries so its execution joins this trace.
Parameters
Prop
Type
Returns array{traceId:string,parentSpanId:string}|null
flush()
methodfunction flush(): voidSend queued batches now. Never throws. */
View sourceTraceContext
classclass Inverge\Nexus\Telescope\TraceContextW3C 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.
parse()
static methodstatic function parse(?string $header): ?arrayParameters
Prop
Type
Returns array{traceId:string,spanId:string}|null — */
format()
static methodstatic function format(string $traceId, string $spanId): stringParameters
Prop
Type
Returns string
newTraceId()
static methodstatic function newTraceId(): stringReturns string
newSpanId()
static methodstatic function newSpanId(): stringReturns string
Redactor
classclass Inverge\Nexus\Telescope\RedactorRemoves 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.
| Constant | Value |
|---|---|
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\\"]"\} |
__construct
constructorfunction __construct(array $extra = [])Parameters
Prop
Type
globMatch()
static methodstatic function globMatch(string $glob, string $value): boolParameters
Prop
Type
Returns bool
redact()
methodfunction redact(array $data, int $depth = 0): arrayParameters
Prop
Type
Returns array<mixed>
