InvergeDocs
.NETAPI reference

Telescope

Telescope in the .NET SDK.

SymbolKindSummary
NexusTelescopeApplicationBuilderExtensionsstatic classWires Nexus Telescope into the ASP.NET Core pipeline.
NexusTelescopeMiddlewareclassAdds the request's details to its Telescope journey: method, URL, headers, query, body, response status/headers/body, the matched route pattern, the user, and any unhandled exception.
NexusTelescopeclassNexus Telescope for .NET — records every unit of work (an ASP.NET Core request, a message consumer, a job or command you wrap) and everything it did, and ships the journeys to the Nexus console.
TelescopeLoggerProviderclassRecords log records into the journey they were written in (and only while a journey is open).
TelescopeOptionsclassWhat Nexus Telescope records.
TelescopeServiceCollectionExtensionsstatic classRegisters Nexus Telescope.

NexusTelescopeApplicationBuilderExtensions

static class Inverge.Nexus.AspNetCore
static class Inverge.Nexus.AspNetCore.NexusTelescopeApplicationBuilderExtensions

Wires Nexus Telescope into the ASP.NET Core pipeline.

UseNexusTelescope()

extension method
static IApplicationBuilder UseNexusTelescope(IApplicationBuilder app)

Adds request details to each Telescope journey. Put it early in the pipeline (before routing/auth so it wraps them). Requires services.AddNexusTelescope().

Parameters

Prop

Type

Returns IApplicationBuilder

NexusTelescopeMiddleware

class Inverge.Nexus.AspNetCore
class Inverge.Nexus.AspNetCore.NexusTelescopeMiddleware

Adds the request's details to its Telescope journey: method, URL, headers, query, body, response status/headers/body, the matched route pattern, the user, and any unhandled exception. (The journey itself — and every query, HttpClient call and log inside it — is recorded by NexusTelescope.)

NexusTelescopeMiddleware

constructor
new NexusTelescopeMiddleware(RequestDelegate next, NexusTelescope telescope)

Creates the middleware.

Parameters

Prop

Type

InvokeAsync()

method
Task InvokeAsync(HttpContext context)

Runs the middleware.

Parameters

Prop

Type

NexusTelescope

class Inverge.Nexus.Telescope
class Inverge.Nexus.Telescope.NexusTelescope

Nexus Telescope for .NET — records every unit of work (an ASP.NET Core request, a message consumer, a job or command you wrap) and everything it did, and ships the journeys to the Nexus console.

It listens to Activity, which the runtime and most libraries already emit: ASP.NET Core requests, HttpClient calls (with W3C traceparent propagation, so downstream services join the trace), Npgsql, MassTransit, the Azure SDKs… EF Core and SqlClient queries come from their DiagnosticListener events; log records from the ILogger provider. Your own work: Span, RunAsync``1.

Nothing here throws into the application.

NexusTelescope

constructor
new NexusTelescope(INexusClient client, TelescopeOptions? options = null)

Creates the recorder. Call Start to begin listening (the DI registration does).

Parameters

Prop

Type

Traceparent()

static method
static string? Traceparent()

A W3C traceparent for the current point — put it on a message so its consumer joins the trace.

Returns string?

BodyLimitBytes

property
int BodyLimitBytes { get; }

The body capture limit in bytes.

IsEnabled

property
bool IsEnabled { get; }

Whether recording is on: options, the service switch, and the console's pause.

IsRecording

property
bool IsRecording { get; }

Whether a unit of work is being recorded at the current point.

Options

property
TelescopeOptions Options { get; }

The options in effect.

Source

field
static ActivitySource Source

The ActivitySource Telescope's own spans and jobs are created from.

Discard()

method
void Discard()

Stops recording the current unit of work and drops it (e.g. an ignored path).

Dispose()

method
void Dispose()

Enrich()

method
void Enrich(IDictionary<string, object?> content)

Adds fields to the current unit of work's own record (the request, the job…).

Parameters

Prop

Type

FlushAsync()

method
Task FlushAsync(CancellationToken cancellationToken = default)

Ships everything finished so far.

Parameters

Prop

Type

IgnoresPath()

method
bool IgnoresPath(string path)

Whether a request path is ignored (options + console settings).

Parameters

Prop

Type

Returns bool

Log()

method
void Log(string level, string message, IDictionary<string, object?>? context = null)

Records a log line in the current journey.

Parameters

Prop

Type

Record()

method
void Record(string type, IDictionary<string, object?> content, double? durationMs = null, string? status = null, string? name = null)

Records an entry in the current journey.

Parameters

Prop

Type

RecordException()

method
void RecordException(Exception exception, bool handled = true)

Records an exception in the current journey. Unhandled ones fail it.

Parameters

Prop

Type

RecordQuery()

method
void RecordQuery(string sql, IEnumerable<object?>? bindings, double durationMs, string? connection = null)

Records a query you ran outside EF Core / ADO.NET instrumentation.

Parameters

Prop

Type

RunAsync()

method
Task<T?> RunAsync<T>(string type, string name, Func<Task<T?>> work, string? traceparent = null, IDictionary<string, object?>? content = null)

Runs work as its own journey — a job, command or scheduled task. Pass the traceparent the producer put on the message (see Traceparent) so the run joins the producer's trace.

Parameters

Prop

Type

Returns Task<T?>

RunAsync()

method
Task RunAsync(string type, string name, Func<Task> work, string? traceparent = null, IDictionary<string, object?>? content = null)

Runs work as its own journey (see RunAsync``1).

Parameters

Prop

Type

SetStatus()

method
void SetStatus(string status)

Sets the status of the current unit of work (HTTP status, processed, an exit code…).

Parameters

Prop

Type

SetUser()

method
void SetUser(string id, string? email = null, string? name = null)

The signed-in user of the current journey: tags it Auth:<id> and links it to Nexus Sessions.

Parameters

Prop

Type

Span()

method
IDisposable Span(string name)

A named span: everything recorded inside it (queries, HTTP calls, logs — across awaits) nests under it. using (telescope.Span("pricing")) { … }

Parameters

Prop

Type

Returns IDisposable

Start()

method
void Start()

Starts listening and the background sender. Idempotent.

Tag()

method
void Tag(string[] tags)

Tags the current journey.

Parameters

Prop

Type

TelescopeLoggerProvider

class Inverge.Nexus.Telescope
class Inverge.Nexus.Telescope.TelescopeLoggerProvider

Records log records into the journey they were written in (and only while a journey is open). A record carrying an exception becomes an exception entry.

TelescopeLoggerProvider

constructor
new TelescopeLoggerProvider(NexusTelescope telescope)

Creates the provider.

Parameters

Prop

Type

CreateLogger()

method
ILogger CreateLogger(string categoryName)

Parameters

Prop

Type

Returns ILogger

Dispose()

method
void Dispose()

TelescopeOptions

class Inverge.Nexus.Telescope
class Inverge.Nexus.Telescope.TelescopeOptions

What Nexus Telescope records. Most of it can also be changed from the console without a deploy.

TelescopeOptions

constructor
new TelescopeOptions()

BodySizeLimitKb

property
int BodySizeLimitKb { get; set; }

Largest body recorded, in KB. Default 64.

CaptureBodies

property
bool CaptureBodies { get; set; }

Record request/response bodies (JSON is parsed). Default true.

Enabled

property
bool Enabled { get; set; }

Master switch (also NEXUS_TELESCOPE_ENABLED=false, or pausing it in the console).

FlushInterval

property
TimeSpan FlushInterval { get; set; }

How often finished journeys are shipped. Default 2 s.

IgnoreActivitySources

property
IList<string> IgnoreActivitySources { get; }

ActivitySource names never turned into entries.

IgnorePaths

property
IList<string> IgnorePaths { get; }

Request paths never recorded (globs, * = anything).

IgnoreTypes

property
IList<string> IgnoreTypes { get; }

Entry types never recorded (log, cache, …).

MaxEntries

property
int MaxEntries { get; set; }

Entries kept per journey; the rest are counted. Default 2000.

MinimumLogLevel

property
LogLevel MinimumLogLevel { get; set; }

Log records at or above this level become entries. Default Information.

RedactKeys

property
IList<string> RedactKeys { get; }

Extra keys redacted from headers and payloads (passwords, tokens and cookies always are).

Release

property
string? Release { get; set; }

Release / version shown with each journey.

SampleRate

property
double? SampleRate { get; set; }

Fraction of journeys kept, 0..1. null = the console's sample rate. Failed, slow and monitored journeys are always kept.

Service

property
string? Service { get; set; }

The service name shown in traces. Default: NEXUS_SERVICE_NAME, else the entry assembly name.

TelescopeServiceCollectionExtensions

static class Inverge.Nexus.Telescope
static class Inverge.Nexus.Telescope.TelescopeServiceCollectionExtensions

Registers Nexus Telescope.

AddNexusTelescope()

extension method
static IServiceCollection AddNexusTelescope(IServiceCollection services, Action<TelescopeOptions>? configure = null, Action<NexusOptions>? configureNexus = null)

Adds Nexus Telescope: a singleton NexusTelescope that starts with the host and flushes on shutdown, and an ILogger provider that records log lines into journeys. Calls AddNexus() if it has not been. For ASP.NET Core also add app.UseNexusTelescope().

Parameters

Prop

Type

Returns IServiceCollection

On this page