Telescope
Telescope in the .NET SDK.
| Symbol | Kind | Summary |
|---|---|---|
NexusTelescopeApplicationBuilderExtensions | static class | Wires Nexus Telescope into the ASP.NET Core pipeline. |
NexusTelescopeMiddleware | class | 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. |
NexusTelescope | class | 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. |
TelescopeLoggerProvider | class | Records log records into the journey they were written in (and only while a journey is open). |
TelescopeOptions | class | What Nexus Telescope records. |
TelescopeServiceCollectionExtensions | static class | Registers Nexus Telescope. |
NexusTelescopeApplicationBuilderExtensions
static class Inverge.Nexus.AspNetCorestatic class Inverge.Nexus.AspNetCore.NexusTelescopeApplicationBuilderExtensionsWires Nexus Telescope into the ASP.NET Core pipeline.
UseNexusTelescope()
extension methodstatic 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.AspNetCoreclass Inverge.Nexus.AspNetCore.NexusTelescopeMiddlewareAdds 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
constructornew NexusTelescopeMiddleware(RequestDelegate next, NexusTelescope telescope)Creates the middleware.
Parameters
Prop
Type
InvokeAsync()
methodTask InvokeAsync(HttpContext context)Runs the middleware.
Parameters
Prop
Type
NexusTelescope
class Inverge.Nexus.Telescopeclass Inverge.Nexus.Telescope.NexusTelescopeNexus 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
constructornew NexusTelescope(INexusClient client, TelescopeOptions? options = null)Creates the recorder. Call Start to begin listening (the DI registration does).
Parameters
Prop
Type
Traceparent()
static methodstatic string? Traceparent()A W3C traceparent for the current point — put it on a message so its consumer joins the trace.
Returns string?
BodyLimitBytes
propertyint BodyLimitBytes { get; }The body capture limit in bytes.
IsEnabled
propertybool IsEnabled { get; }Whether recording is on: options, the service switch, and the console's pause.
IsRecording
propertybool IsRecording { get; }Whether a unit of work is being recorded at the current point.
Options
propertyTelescopeOptions Options { get; }The options in effect.
Source
fieldstatic ActivitySource SourceThe ActivitySource Telescope's own spans and jobs are created from.
Discard()
methodvoid Discard()Stops recording the current unit of work and drops it (e.g. an ignored path).
Dispose()
methodvoid Dispose()Enrich()
methodvoid Enrich(IDictionary<string, object?> content)Adds fields to the current unit of work's own record (the request, the job…).
Parameters
Prop
Type
FlushAsync()
methodTask FlushAsync(CancellationToken cancellationToken = default)Ships everything finished so far.
Parameters
Prop
Type
IgnoresPath()
methodbool IgnoresPath(string path)Whether a request path is ignored (options + console settings).
Parameters
Prop
Type
Returns bool
Log()
methodvoid Log(string level, string message, IDictionary<string, object?>? context = null)Records a log line in the current journey.
Parameters
Prop
Type
Record()
methodvoid 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()
methodvoid RecordException(Exception exception, bool handled = true)Records an exception in the current journey. Unhandled ones fail it.
Parameters
Prop
Type
RecordQuery()
methodvoid 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()
methodTask<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()
methodTask 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()
methodvoid SetStatus(string status)Sets the status of the current unit of work (HTTP status, processed, an exit code…).
Parameters
Prop
Type
SetUser()
methodvoid 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()
methodIDisposable 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()
methodvoid Start()Starts listening and the background sender. Idempotent.
Tag()
methodvoid Tag(string[] tags)Tags the current journey.
Parameters
Prop
Type
TelescopeLoggerProvider
class Inverge.Nexus.Telescopeclass Inverge.Nexus.Telescope.TelescopeLoggerProviderRecords 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
constructornew TelescopeLoggerProvider(NexusTelescope telescope)Creates the provider.
Parameters
Prop
Type
CreateLogger()
methodILogger CreateLogger(string categoryName)Parameters
Prop
Type
Returns ILogger
Dispose()
methodvoid Dispose()TelescopeOptions
class Inverge.Nexus.Telescopeclass Inverge.Nexus.Telescope.TelescopeOptionsWhat Nexus Telescope records. Most of it can also be changed from the console without a deploy.
TelescopeOptions
constructornew TelescopeOptions()BodySizeLimitKb
propertyint BodySizeLimitKb { get; set; }Largest body recorded, in KB. Default 64.
CaptureBodies
propertybool CaptureBodies { get; set; }Record request/response bodies (JSON is parsed). Default true.
Enabled
propertybool Enabled { get; set; }Master switch (also NEXUS_TELESCOPE_ENABLED=false, or pausing it in the console).
FlushInterval
propertyTimeSpan FlushInterval { get; set; }How often finished journeys are shipped. Default 2 s.
IgnoreActivitySources
propertyIList<string> IgnoreActivitySources { get; }ActivitySource names never turned into entries.
IgnorePaths
propertyIList<string> IgnorePaths { get; }Request paths never recorded (globs, * = anything).
IgnoreTypes
propertyIList<string> IgnoreTypes { get; }Entry types never recorded (log, cache, …).
MaxEntries
propertyint MaxEntries { get; set; }Entries kept per journey; the rest are counted. Default 2000.
MinimumLogLevel
propertyLogLevel MinimumLogLevel { get; set; }Log records at or above this level become entries. Default Information.
RedactKeys
propertyIList<string> RedactKeys { get; }Extra keys redacted from headers and payloads (passwords, tokens and cookies always are).
Release
propertystring? Release { get; set; }Release / version shown with each journey.
SampleRate
propertydouble? SampleRate { get; set; }Fraction of journeys kept, 0..1. null = the console's sample rate. Failed, slow and monitored journeys are always kept.
Service
propertystring? Service { get; set; }The service name shown in traces. Default: NEXUS_SERVICE_NAME, else the entry assembly name.
TelescopeServiceCollectionExtensions
static class Inverge.Nexus.Telescopestatic class Inverge.Nexus.Telescope.TelescopeServiceCollectionExtensionsRegisters Nexus Telescope.
AddNexusTelescope()
extension methodstatic 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
