Skip to content

Configuration

Everything Belemetry does is set on one BelemetryOptions, passed to AddBitBelemetryServices. The tables on this page are reflected from the shipped assembly - names, types, the defaults a fresh options object really has, and the XML documentation you see in IntelliSense - so they cannot describe an option that does not exist.

One registration

AddBitBelemetryServices follows the Options pattern and is idempotent: call it in every project that hosts Blazor, and every configure callback passed across calls runs, in order, on the same BelemetryOptions. A shared method called from both the server and the client project keeps the two in step, and each project adds what is its own on top. Every line below sets an option to something other than its default, or spells a default out where it is a decision worth reading in code.

using Bit.Belemetry;
using Microsoft.Extensions.Logging;

builder.Services.AddBitBelemetryServices(options =>
{
    // The resource: who is sending. service.name is what every backend groups by.
    options.ServiceName = "MyShop";
    options.ServiceNamespace = "contoso";
    options.Environment = builder.Environment.EnvironmentName;
    options.ResourceAttributes["deployment.region"] = "westeurope";

    // What may be collected at all. A feature is sent only when it is here AND the user granted it.
    options.Features = BelemetryFeatures.All & ~BelemetryFeatures.Interactions;

    // Consent: opt-in, so nothing is sent before the user decides - except error reports,
    // which this app covers by legitimate interest.
    options.Consent.Default = BelemetryFeatures.Errors;
    options.Consent.Persist = true;
    options.Consent.HonorGlobalPrivacyControl = true;

    // Privacy rules, applied on both sides before anything is queued.
    options.Privacy.RedactQueryParameters.Add("voucher");
    options.Privacy.BlockedAttributes.Add("user_agent.original");

    // The browser script.
    options.Browser.Transport = BelemetryBrowserTransport.Auto;      // Relay in Hybrid, Direct elsewhere
    options.Browser.ResourceTiming = true;
    options.Browser.PropagateTraceContextTo.Add(@"^https://api\.contoso\.com/");
    options.Browser.IgnoreUrls.Add("/health");
    options.Browser.SessionSampleRatio = 0.5;

    // The .NET collectors.
    options.Logs.MinimumLevel = LogLevel.Information;
    options.Traces.Sources.Add("MyShop*");
    options.Traces.SamplingRatio = 0.25;
    options.Metrics.Meters.Add("MyShop*");
    options.Metrics.ExportInterval = TimeSpan.FromSeconds(30);

    // Delivery.
    options.Batch.FlushInterval = TimeSpan.FromSeconds(5);
    options.Persistence.MaxAge = TimeSpan.FromHours(24);

    // The server's own telemetry (ASP.NET Core hosts only), governed by Server.Features.
    options.Server.CollectDotnetTelemetry = true;

    // Exporters: any number, combined.
    options.AddOtlpExporter("http://otel-collector:4318", otlp =>
    {
        otlp.Protocol = BelemetryOtlpProtocol.HttpProtobuf;
        otlp.BrowserEndpoint = new Uri("https://otel.contoso.com");  // public, CORS-enabled
        otlp.Compression = BelemetryCompression.Gzip;
    });

    options.AddAzureMonitorExporter(builder.Configuration["ApplicationInsights:ConnectionString"]!, azure =>
    {
        azure.Signals = BelemetrySignals.Traces | BelemetrySignals.Logs;
    });

    if (builder.Environment.IsDevelopment())
    {
        options.AddConsoleExporter();
        options.Debug = true;
        options.Browser.Debug = true;
    }
});

From appsettings

Every option can come from configuration instead. Bind the section the way a trimmed or AOT app binds any options: the configuration binder's source generator (EnableConfigurationBindingGenerator in the app's project) handles BelemetryOptions without reflection, and Belemetry takes no dependency on the binder. What only code can add - custom exporters, processors, a token provider - goes on top.

// Program.cs - the binder's source generator (EnableConfigurationBindingGenerator) makes this trim- and AOT-safe.
builder.Services.AddBitBelemetryServices(options =>
{
    builder.Configuration.GetSection("Belemetry").Bind(options);
    options.AddExporter(new MyExporter());   // what only code can add: custom exporters, processors, token providers
});

Two binder rules worth knowing: a bound list adds to the option's defaults (Privacy.RedactQueryParameters keeps its built-in names and gains yours), and a bound array replaces nothing either, which is why Metrics.HistogramBoundaries is empty by default and means the OpenTelemetry defaults until you set it. Enums and flags bind by name ("Features": "Errors, Logs, Traces"), TimeSpans by hh:mm:ss.

Per-category log levels

Logs.MinimumLevel is the floor: nothing below it is collected, whatever a category says. Above it, per-category levels use the standard logging configuration, under the Belemetry provider alias, so they can differ from what the console logger shows.

{
  "Logging": {
    "Belemetry": {
      "LogLevel": {
        "Default": "Information",
        "Microsoft.AspNetCore": "Warning",
        "MyShop.Polling": "Warning"
      }
    }
  }
}

Environment variables

Outside the browser, with options.UseEnvironmentVariables (on by default), the standard variables fill in what the code leaves unset - this is how the .NET Aspire AppHost and most container platforms wire telemetry in. Explicit options always win.

VariableEffect
OTEL_SERVICE_NAMEservice.name
OTEL_RESOURCE_ATTRIBUTESExtra resource attributes (k=v,k2=v2)
OTEL_EXPORTER_OTLP_ENDPOINTAdds an OTLP exporter when none is configured, and fills unset endpoints
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, _LOGS_ENDPOINT, _METRICS_ENDPOINTPer-signal endpoints; any of them adds the exporter too
OTEL_EXPORTER_OTLP_HEADERSOTLP headers (k=v,k2=v2)
OTEL_EXPORTER_OTLP_PROTOCOLhttp/protobuf, http/json or grpc, unless Protocol is set in code
OTEL_EXPORTER_OTLP_COMPRESSION, OTEL_EXPORTER_OTLP_TIMEOUTgzip/none and the timeout in milliseconds, unless set in code
APPLICATIONINSIGHTS_CONNECTION_STRINGAdds an Azure Monitor exporter when none is configured
WEBSITE_*, REGION_NAME, CONTAINER_APP_*The Azure App Service, Functions or Container Apps resource attributes and instance id of a server

The browser has no environment. In a Blazor Web App the browser script gets its configuration from the server's options through <BelemetryScript />, so variables set on the server reach it. A standalone WebAssembly app has to set everything in code.

BelemetryOptions

BelemetryOptions Class

The settings of Belemetry, configured through AddBitBelemetryServices.

Name Type and default Description
Enabled bool= true Master switch: when false nothing is collected or exported. Defaults to true.
ServiceName string service.name - the logical name of the app, the key every backend groups by. Defaults to OTEL_SERVICE_NAME when set (outside the browser), else the entry assembly name.
ServiceVersion string service.version. Defaults to the entry assembly's informational version.
ServiceNamespace string service.namespace.
ServiceInstanceId string service.instance.id. Defaults to a random id per process (per page load in the browser).
Environment string deployment.environment.name, e.g. Production.
ResourceAttributes Dictionary<string, object>= {} Extra resource attributes. Merged with OTEL_RESOURCE_ATTRIBUTES outside the browser.
Features BelemetryFeatures= BelemetryFeatures.All The features switched on by configuration. Defaults to BelemetryFeatures.All. A feature is only collected when it is both in here and granted by the user (see BelemetryOptions.Consent).
Host BelemetryHostKind= BelemetryHostKind.Auto The host kind. Defaults to BelemetryHostKind.Auto (detected).
UseEnvironmentVariables bool= true Whether the standard OTEL_* environment variables (OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_EXPORTER_OTLP_PROTOCOL) and APPLICATIONINSIGHTS_CONNECTION_STRING fill in unset values. Ignored in the browser. Defaults to true.
Consent BelemetryConsentOptions Consent.
Privacy BelemetryPrivacyOptions Data minimization.
Browser BelemetryBrowserOptions The browser script.
Logs BelemetryLoggingOptions ILogger collection.
Traces BelemetryTracingOptions Activity collection.
Metrics BelemetryMetricsOptions Meter collection.
Batch BelemetryBatchOptions Batching of the .NET pipeline.
Persistence BelemetryPersistenceOptions Offline persistence.
Server BelemetryServerOptions The server side.
OtlpExporters List<BelemetryOtlpExporterOptions>= [] The OTLP exporters.
AzureMonitorExporters List<BelemetryAzureMonitorExporterOptions>= [] The Azure Monitor exporters.
ConsoleExporter BelemetryConsoleExporterOptions The console exporter, when added.
Exporters List<IBelemetryExporter>= [] Custom exporters (.NET side only).
Processors List<IBelemetryProcessor>= [] Custom processors, run in order on every .NET-side record after the built-in privacy processor.
Debug bool= false Whether Belemetry logs its own diagnostics (export failures, drops, consent changes) at Debug level. Defaults to false.
AddOtlpExporter(Action<BelemetryOtlpExporterOptions>? configure = null) BelemetryOptions Adds an OTLP/HTTP exporter.
AddOtlpExporter(string endpoint, Action<BelemetryOtlpExporterOptions>? configure = null) BelemetryOptions Adds an OTLP/HTTP exporter posting to endpoint.
AddAzureMonitorExporter(Action<BelemetryAzureMonitorExporterOptions>? configure = null) BelemetryOptions Adds an Azure Monitor (Application Insights) exporter.
AddAzureMonitorExporter(string connectionString, Action<BelemetryAzureMonitorExporterOptions>? configure = null) BelemetryOptions Adds an Azure Monitor (Application Insights) exporter for connectionString.
AddConsoleExporter(Action<BelemetryConsoleExporterOptions>? configure = null) BelemetryOptions Adds the console exporter (development only).
AddExporter(IBelemetryExporter exporter) BelemetryOptions Adds a custom exporter (.NET side only).
AddProcessor(IBelemetryProcessor processor) BelemetryOptions Adds a custom processor.

BelemetryConsentOptions

options.Consent - see Consent and GDPR.

BelemetryConsentOptions Class

How consent is obtained and kept.

Name Type and default Description
Default BelemetryFeatures= BelemetryFeatures.None The features granted before the user has decided. Defaults to BelemetryFeatures.None (opt-in: nothing is sent until consent is given). Set it to e.g. BelemetryFeatures.Errors when error reporting is covered by legitimate interest, or to BelemetryFeatures.All for apps that do not need consent at all.
Persist bool= true Whether the user's choice is remembered on the device (localStorage key bit-belemetry-consent, which records the choice itself and is therefore strictly necessary). Defaults to true.
HonorGlobalPrivacyControl bool= true Whether a browser signalling Global Privacy Control (navigator.globalPrivacyControl) never gets the BelemetryFeatures.Analytics features, whatever is requested. Defaults to true.
PendingLimit int= 500 How many records of not-yet-granted features are held in memory while the user has not decided, to be sent if granted and dropped if not. Defaults to 500.

BelemetryPrivacyOptions

options.Privacy - see Privacy.

BelemetryPrivacyOptions Class

Data-minimization rules applied to every record, on both the browser and the .NET side, before it is queued.

Name Type and default Description
RedactQueryParameters List<string>= ["token", "code", "password", "pwd", "secret", "key", "apikey", "api_key", "auth", "authorization", "session", "sid", "sig", "signature", "email", "access_token", "id_token", "refresh_token"] Query-string parameters (case-insensitive) whose values are replaced with REDACTED in every URL attribute.
StripQueryString bool= false Whether to drop query strings from URLs entirely. Defaults to false.
StripFragment bool= true Whether to drop URL fragments (which may carry OAuth tokens). Defaults to true.
ScrubPatterns bool= true Whether messages, stack traces and URLs are scrubbed of e-mail addresses, JWTs, bearer tokens, card numbers (Luhn-checked) and IPv4 addresses. Defaults to true.
CollectUserAgent bool= true Whether the browser's user agent string is part of the browser resource. Defaults to true.
BlockedAttributes List<string>= [] Attribute keys removed from every record (exact match).

BelemetryBrowserOptions

options.Browser - see Browser instrumentation and Transport.

BelemetryBrowserOptions Class

The browser script (bit-belemetry.js): what it instruments and how it ships records.

Name Type and default Description
Enabled bool= true Whether the browser script runs at all. Defaults to true.
Transport BelemetryBrowserTransport= BelemetryBrowserTransport.Auto How browser records leave the page. Defaults to BelemetryBrowserTransport.Auto.
TrackHashChanges bool= false Whether URL changes made only to the fragment (#...) count as page views. Defaults to false.
TrackPageVisitTime bool= false Whether the time spent on each page is recorded, as a browser.page_visit_time event carrying page.visit.duration (milliseconds) when the next page view starts or the page is hidden (Application Insights shows it as the PageVisitTime event). Defaults to false.
InteractionEvents List<string>= ["click"] The DOM events recorded as interactions. Defaults to click.
CaptureInteractionText bool= false Whether the visible text of the clicked element is recorded (truncated to BelemetryBrowserOptions.MaxInteractionTextLength). Defaults to false because text can contain personal data; prefer data-bit-belemetry-name. Input values are never read.
MaxInteractionTextLength int= 64 The maximum length of recorded element text. Defaults to 64.
WebVitals bool= true Whether web vitals (LCP, INP, CLS, FCP, TTFB) are recorded. Defaults to true.
DocumentLoad bool= true Whether the initial document load is recorded as a span with navigation-timing events. Defaults to true.
ResourceTiming bool= false Whether every resource fetched by the page (scripts, styles, images) is recorded as a span. Defaults to false.
LongTasks bool= false Whether main-thread tasks longer than 50 ms are recorded. Defaults to false.
Fetch bool= true Whether fetch calls are recorded as dependency spans. Defaults to true.
Xhr bool= true Whether XMLHttpRequest calls are recorded as dependency spans. Defaults to true.
PropagateTraceContextTo List<string>= ["same-origin"] Where a W3C traceparent header is added to fetch/XHR calls, so the browser span and the server span join one trace: same-origin, *, or regular expressions matched against the absolute URL. Defaults to same-origin. Cross-origin targets must allow the header (CORS).
IgnoreUrls List<string>= ["/_framework/", "/_blazor", "/_content/"] Regular expressions of URLs never recorded as dependencies. Defaults to the Blazor framework routes.
IgnoreErrorMessages List<string>= ["ResizeObserver loop"] Regular expressions of JS error messages never recorded.
CaptureConsole bool= false Whether console calls are recorded as logs. Defaults to false.
ConsoleLevels List<string>= ["error", "warn"] The console levels recorded when BelemetryBrowserOptions.CaptureConsole is on. Defaults to error and warn.
SessionInactivityTimeout TimeSpan= 00:30:00 How long without activity ends a session. Defaults to 30 minutes.
SessionMaxDuration TimeSpan= 1.00:00:00 The maximum length of a session. Defaults to 24 hours.
SessionSampleRatio double= 1 The fraction of sessions whose browser telemetry is recorded (decided once per session). Defaults to 1.0.
MaxQueueSize int= 1024 The maximum number of records the script holds; the oldest are dropped past it. Defaults to 1024.
MaxBatchSize int= 100 The maximum number of records per request. Defaults to 100.
FlushInterval TimeSpan= 00:00:05 How often the script exports. Defaults to 5 seconds (it also exports when the page is hidden).
Debug bool= false Whether the script writes its own diagnostics to console.debug. Defaults to false.

BelemetryLoggingOptions

options.Logs - see .NET instrumentation.

BelemetryLoggingOptions Class

ILogger collection.

Name Type and default Description
MinimumLevel LogLevel= LogLevel.Information The minimum level collected. Defaults to LogLevel.Information. Per-category levels can also be set through the standard logging configuration under the Belemetry provider alias ("Logging": { "Belemetry": { "LogLevel": { ... } } }).
IncludeScopes bool= true Whether the values of active logging scopes become attributes. Defaults to true.
IncludeMessageTemplate bool= false Whether the message template of structured entries is kept as log.record.template. Defaults to false.
ExcludedCategories List<string>= [] Category prefixes never collected (Belemetry's own categories are always excluded).

BelemetryTracingOptions

options.Traces.

BelemetryTracingOptions Class

Activity collection.

Name Type and default Description
Sources List<string>= ["System.Net.Http", "Microsoft.AspNetCore.Components*", "Bit.Belemetry.*"] The ActivitySource names collected; a trailing * matches a prefix. Defaults to System.Net.Http, Microsoft.AspNetCore.Components* and Bit.Belemetry.* (the instrumentation packages, such as Bit.Belemetry.EntityFrameworkCore and Bit.Belemetry.Hangfire), plus Microsoft.AspNetCore for the server pipeline. Add your own sources here.
IgnoredActivityNames List<string>= [] Activity names (Activity.OperationName; a trailing * matches a prefix) never recorded, decided when the activity is created so it costs nothing - e.g. Microsoft.AspNetCore.Components.HandleEvent to drop Blazor's per-event spans. The children of an ignored activity attach to its parent. Empty by default.
SamplingRatio double= 1 The fraction of new traces recorded (parent-based: a child follows its parent's decision). Defaults to 1.0.
MaxEventsPerSpan int= 128 The maximum number of events kept per span. Defaults to 128.
MaxLinksPerSpan int= 128 The maximum number of links kept per span. Defaults to 128.

BelemetryMetricsOptions

options.Metrics.

BelemetryMetricsOptions Class

Meter collection.

Name Type and default Description
DefaultHistogramBoundaries double[]= [0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000] The OpenTelemetry default histogram bucket boundaries, used while BelemetryMetricsOptions.HistogramBoundaries is empty.
Meters List<string>= ["System.Net.Http", "Microsoft.AspNetCore.Components*", "System.Runtime"] The Meter names collected; a trailing * matches a prefix. Defaults to System.Net.Http, Microsoft.AspNetCore.Components* and System.Runtime (plus the ASP.NET Core hosting and Kestrel meters for the server pipeline). Add your own meters here.
ExportInterval TimeSpan= 00:01:00 How often metrics are collected and exported. Defaults to 60 seconds (the OpenTelemetry default).
Temporality BelemetryMetricTemporality= BelemetryMetricTemporality.Cumulative The aggregation temporality sent over OTLP. Defaults to cumulative (Azure Monitor always gets deltas).
HistogramBoundaries double[]= [] The histogram bucket boundaries, used unless an instrument advises its own. Empty, the default, means BelemetryMetricsOptions.DefaultHistogramBoundaries - empty rather than those values themselves because a configuration binder appends to an array it binds, and boundaries must replace the defaults, never grow them.
CardinalityLimit int= 2000 The maximum number of attribute sets per instrument (the OpenTelemetry default is 2000). Measurements with new attribute sets past it are folded into one point carrying otel.metric.overflow = true.

BelemetryBatchOptions

options.Batch - the .NET pipeline. The browser script batches with options.Browser.FlushInterval, MaxBatchSize and MaxQueueSize.

BelemetryBatchOptions Class

Batching of the .NET pipeline.

Name Type and default Description
MaxQueueSize int= 2048 The maximum number of spans and of log records held in memory each; the oldest are dropped past it. Defaults to 2048.
MaxBatchSize int= 512 The maximum number of records per export request; reaching it triggers an export early. Defaults to 512.
FlushInterval TimeSpan= 00:00:05 How often spans and log records are exported. Defaults to 5 seconds.

BelemetryPersistenceOptions

options.Persistence - see Offline persistence.

BelemetryPersistenceOptions Class

Offline persistence: export requests that fail with a network error or a retryable status are kept on the device and retried later, as long as the user granted BelemetryFeatures.Persistence.

Name Type and default Description
Enabled bool= true Whether persistence is used at all. Defaults to true (still subject to consent).
Directory string The folder the .NET side stores requests in (Hybrid and Server). Defaults to {LocalApplicationData}/bit-belemetry/{service.name}. In WebAssembly the browser storage is used.
MaxBytes long= 20971520 The maximum size of the .NET store; the oldest requests are evicted past it. Defaults to 20 MB.
BrowserMaxBytes long= 1048576 The maximum size of the browser store (localStorage is small). Defaults to 1 MB.
MaxAge TimeSpan= 2.00:00:00 How long a stored request is kept before it is discarded unsent. Defaults to 48 hours.
RetryInterval TimeSpan= 00:01:00 How often stored requests are retried. Defaults to 1 minute.

BelemetryServerOptions

options.Server - see Server pipeline.

BelemetryServerOptions Class

The server side (Blazor Server, static SSR, the server half of Auto). By default Belemetry only serves the browser script there - an ASP.NET Core host usually has its own OpenTelemetry setup - and its .NET pipeline stays off.

Name Type and default Description
CollectDotnetTelemetry bool= false Whether the .NET pipeline (ILogger, Activity, Meter collection and export) also runs on the server. Defaults to false.
Features BelemetryFeatures= BelemetryFeatures.Errors | BelemetryFeatures.Logs | BelemetryFeatures.Traces | BelemetryFeatures.Metrics The features the server pipeline collects when BelemetryServerOptions.CollectDotnetTelemetry is on. Defaults to errors, logs, traces and metrics.
IgnoredRequestPaths List<string>= [] Path prefixes (case-insensitive) of requests whose Microsoft.AspNetCore server span is dropped, e.g. /health, /alive, /_framework, /_content and /_blazor for health probes and Blazor's own traffic. Matched against url.path (.NET 10) or, failing that, http.route, which on .NET 8 and 9 is all a request span carries: there, a request that matched no endpoint (a static file) cannot be matched either. The span is dropped when it ends, so a child it had (a database check behind /health) is still exported, with a parent that never arrives. Empty by default.

BelemetryOtlpExporterOptions

Configured by options.AddOtlpExporter(...) - see OTLP.

BelemetryOtlpExporterOptions Class

Settings of an OTLP exporter - the vendor-neutral OpenTelemetry protocol understood by the OpenTelemetry Collector, the Aspire dashboard, Grafana (Tempo/Loki/Mimir), Jaeger, Honeycomb, Datadog, New Relic, Elastic and many more - over HTTP (protobuf or JSON) or gRPC.

Name Type and default Description
Endpoint Uri The base endpoint; /v1/traces, /v1/logs and /v1/metrics (or the gRPC service methods) are appended to it. Defaults to OTEL_EXPORTER_OTLP_ENDPOINT when set (outside the browser), else http://localhost:4318 for OTLP/HTTP and http://localhost:4317 for gRPC.
TracesEndpoint Uri A full traces endpoint, used verbatim instead of BelemetryOtlpExporterOptions.Endpoint + /v1/traces. Defaults to OTEL_EXPORTER_OTLP_TRACES_ENDPOINT when set (outside the browser). With gRPC it is a base address (the service method is appended), as the specification defines the variable.
LogsEndpoint Uri A full logs endpoint, used verbatim instead of BelemetryOtlpExporterOptions.Endpoint + /v1/logs. Defaults to OTEL_EXPORTER_OTLP_LOGS_ENDPOINT when set.
MetricsEndpoint Uri A full metrics endpoint, used verbatim instead of BelemetryOtlpExporterOptions.Endpoint + /v1/metrics. Defaults to OTEL_EXPORTER_OTLP_METRICS_ENDPOINT when set.
BrowserEndpoint Uri The endpoint the browser script exports to, when it differs from BelemetryOtlpExporterOptions.Endpoint - typically a public, CORS-enabled route of a collector while the .NET side talks to it over an internal address. With BelemetryOtlpProtocol.Grpc this is the only way the browser exports: it posts OTLP/HTTP protobuf here, since a page cannot speak gRPC; in a WebAssembly app the .NET pipeline does the same, so the endpoint must be absolute there.
Protocol BelemetryOtlpProtocol= BelemetryOtlpProtocol.HttpProtobuf The payload encoding. Defaults to OTEL_EXPORTER_OTLP_PROTOCOL when set (outside the browser), else BelemetryOtlpProtocol.HttpProtobuf. A value set in code always wins over the variable.
Headers Dictionary<string, string>= {} Extra request headers (e.g. an API key). Merged with OTEL_EXPORTER_OTLP_HEADERS outside the browser.
Compression BelemetryCompression= BelemetryCompression.None The request-body compression (for gRPC, the message compression with grpc-encoding). Defaults to OTEL_EXPORTER_OTLP_COMPRESSION when set (outside the browser), else none.
Timeout TimeSpan= 00:00:10 The maximum time one export request may take. Defaults to OTEL_EXPORTER_OTLP_TIMEOUT (milliseconds) when set (outside the browser), else 10 seconds (the OTLP default).
IncludeInBrowser bool= true Whether the browser script exports to this endpoint too (with BelemetryBrowserTransport.Direct). Defaults to true.
Signals BelemetrySignals= BelemetrySignals.All The signals sent to this endpoint. Defaults to all three.
MinimumLogLevel LogLevel? The least severe log level this exporter receives from the .NET pipeline (its own logs and the records the browser relays); plain log records below it are left out of this exporter's batches only. Events - page views, interactions, web vitals, custom events, exceptions - are not logs to a log level and always pass, as do spans and metrics. null (the default) sends every collected record. Use it when one backend should get errors only while another gets everything, as a per-provider logging level would with two logging providers.

BelemetryAzureMonitorExporterOptions

Configured by options.AddAzureMonitorExporter(...) - see Azure Monitor.

BelemetryAzureMonitorExporterOptions Class

Settings of the Azure Monitor (Application Insights) exporter, which posts to the ingestion endpoint (/v2.1/track) directly, so page views, requests, dependencies, exceptions and custom events land in their usual Application Insights tables without a collector in between.

Name Type and default Description
ConnectionString string The Application Insights connection string (InstrumentationKey=...;IngestionEndpoint=https://...;LiveEndpoint=https://...). Defaults to APPLICATIONINSIGHTS_CONNECTION_STRING when set (outside the browser).
AccessTokenProvider Func<CancellationToken, ValueTask<string>> Supplies a Microsoft Entra ID access token (scope https://monitor.azure.com//.default) sent as Authorization: Bearer, for resources with local authentication disabled. Belemetry takes no dependency on Azure.Identity: pass e.g. ct => credential.GetTokenAsync(...).
MaskIp bool= true Whether to send ai.location.ip = 0.0.0.0 so the ingestion service does not derive the user's location from the client IP address. Defaults to true.
Compression BelemetryCompression= BelemetryCompression.None The request-body compression. Defaults to none.
Timeout TimeSpan= 00:00:30 The maximum time one export request may take. Defaults to 30 seconds.
EnableLiveMetrics bool= false Whether to stream Live Metrics (requests, dependencies, exceptions, CPU and memory, once per second while someone watches the Live Metrics blade). Not available in the browser. Defaults to false.
IncludeInBrowser bool= true Whether the browser script exports to Application Insights too (with BelemetryBrowserTransport.Direct). Defaults to true.
Signals BelemetrySignals= BelemetrySignals.All The signals sent to Application Insights. Defaults to all three.
MinimumLogLevel LogLevel? The least severe log level this exporter receives from the .NET pipeline (its own logs and the records the browser relays); plain log records below it are left out of this exporter's batches only. Events - page views, interactions, web vitals, custom events, exceptions - are not logs to a log level and always pass, as do spans and metrics. null (the default) sends every collected record. Use it when Application Insights should get warnings and errors only while an OTLP backend gets everything, as a per-provider logging level would with two logging providers.

BelemetryConsoleExporterOptions

Configured by options.AddConsoleExporter(...) - see Console, in-memory and custom.

BelemetryConsoleExporterOptions Class

Settings of the console exporter, which prints every exported record - for development only.

Name Type and default Description
IncludeInBrowser bool= true Whether the browser script prints its records to the browser console too. Defaults to true.
Signals BelemetrySignals= BelemetrySignals.All The signals printed. Defaults to all three.

BelemetryFeatures

BelemetryFeatures Enum

The independently consentable parts of Belemetry. Every telemetry record belongs to exactly one feature, and a record is only sent while its feature is both enabled by configuration and granted by the user.

Value Number Description
None 0 Nothing.
Errors 1 JS errors and unhandled rejections, .NET logs at Error/Critical or carrying an exception, and TrackException.
PageViews 2 Page views - history and enhanced navigation, and TrackPageView.
Interactions 4 Clicks and other user interactions.
Performance 8 Web vitals (LCP, INP, CLS, FCP, TTFB), the document-load span, resource timing and long tasks.
Dependencies 16 Browser fetch/XHR client spans.
Sessions 32 A session id that survives page reloads (kept in sessionStorage). Without it the session id lives in memory only.
UserTracking 64 The pseudonymous user id (enduser.pseudo.id, persisted on the device) and the authenticated user id (user.id).
Logs 128 .NET logs below Error, and browser console capture below error.
Traces 256 .NET Activity spans.
Metrics 512 .NET Meter metrics.
Persistence 1024 Keeping unsent telemetry on the device (browser storage or files) to retry it after going offline or restarting.
Events 2048 Custom events (TrackEvent).
Diagnostics 401 Errors, logs, traces and dependencies - what is needed to troubleshoot the app.
Analytics 2150 Page views, interactions, sessions, user tracking and custom events - what describes how the app is used.
Monitoring 520 Web vitals and metrics - how the app performs.
All 4095 Every feature.

BelemetryHostKind

BelemetryHostKind Enum

The kind of Blazor host Belemetry runs in, which decides its defaults.

Value Number Description
Auto 0 Detect it: WebAssembly in the browser, Server when ASP.NET Core hosting is registered, Hybrid otherwise.
WebAssembly 1 Blazor WebAssembly (standalone, or the client half of a Blazor Web App). The .NET pipeline runs in the browser.
Server 2 An ASP.NET Core host (Blazor Server, static SSR, the server half of Auto). The .NET pipeline is off unless BelemetryServerOptions.CollectDotnetTelemetry is set.
Hybrid 3 Blazor Hybrid (MAUI, WPF, WinForms). The .NET pipeline runs in the app process and browser telemetry is relayed to it.

BelemetryBrowserTransport

BelemetryBrowserTransport Enum

How browser telemetry leaves the page.

Value Number Description
Auto 0 BelemetryBrowserTransport.Relay in Blazor Hybrid, BelemetryBrowserTransport.Direct everywhere else.
Direct 1 The script exports straight to the configured endpoints with fetch. The endpoints must allow the page origin (CORS).
Relay 2 The script hands its records to .NET over JS interop and the .NET pipeline exports them. Needs an interactive component (<BelemetryInitializer />); avoids CORS and keeps exporter credentials out of the page. On Blazor Server the records travel over the circuit.

BelemetryOtlpProtocol

BelemetryOtlpProtocol Enum

The OTLP transport encoding.

Value Number Description
HttpProtobuf 0 OTLP/HTTP with binary protobuf payloads (application/x-protobuf) - the most widely supported encoding.
HttpJson 1 OTLP/HTTP with JSON payloads (application/json).
Grpc 2 OTLP/gRPC: protobuf payloads over HTTP/2 (application/grpc), the default of the OpenTelemetry SDKs and what the .NET Aspire AppHost hands its resources. Belemetry speaks it without a gRPC library: unary calls are plain HTTP/2 POSTs with a 5-byte message prefix, and the status comes back in the response trailers. .NET side only - a browser cannot send gRPC, so the browser script posts to BelemetryOtlpExporterOptions.BrowserEndpoint over OTLP/HTTP instead, and gets nothing when that is unset.

BelemetryCompression

BelemetryCompression Enum

The request-body compression an exporter applies.

Value Number Description
None 0 No compression.
Gzip 1 gzip (Content-Encoding: gzip).

BelemetrySignals

BelemetrySignals Enum

The OpenTelemetry signals.

Value Number Description
None 0 None.
Traces 1 Spans.
Logs 2 Log records and events.
Metrics 4 Metrics.
All 7 Every signal.

BelemetryMetricTemporality

BelemetryMetricTemporality Enum

The OTLP aggregation temporality (numbered as in opentelemetry/proto/metrics/v1/metrics.proto).

Value Number Description
Delta 1 Each point reports the change since the previous export.
Cumulative 2 Each point reports the total since the stream started (the OpenTelemetry default for OTLP).
An unhandled error has occurred. Reload 🗙