Troubleshooting
Telemetry fails quietly: no exception when nothing is granted, when a collector refuses the page's origin, or
when a backend rejects a key. Belemetry keeps the evidence - in the browser script's counters, in the
Bit.Belemetry log category and on the Bit.Belemetry meter. This page is the checklist,
in the order worth following, with a live check of the page you are reading.
Check this page
In any app, the first two calls to make in the browser console are BitBelemetry.getContext() - what
is granted, and the session - and BitBelemetry.getStats() - what the script dropped and why, and
what became of its requests. The button runs both on this page and reads the answer for you.
The check runs once the page is interactive.
Nothing arrives
- Is the script on the page? View the page source.
<BelemetryScript />renders a<script type="application/json" id="bit-belemetry-config">element and the module after it; in the console,window.BitBelemetryexists. A literal<BelemetryScript>tag in the HTML means_Imports.razorlacks@using Bit.Belemetry- the component compiled as an unknown element, with only a warning. - Has anything been granted? By default nothing is sent until the user consents
(
Consent.Default = None). CheckgetContext().consentin the browser, orIBelemetryConsent.Grantedin .NET - and that the app shows a banner at all. Records of features not yet decided are held (getStats().pending), not sent. - What did the script drop?
getStats().droppedcounts every record that never left, by reason (the table below). - Did the backend accept it?
getStats().requests.rejectedmeans the backend refused requests for good - a wrong key, a wrong endpoint, a body it cannot read. On .NET each refusal is a warning in theBit.Belemetrylog category, naming the exporter and the URL. - Turn on the diagnostics.
options.Debugraises Belemetry's own log messages from Debug to Information,options.Browser.Debugwrites the script's toconsole.debug, and a console exporter prints every record the pipeline hands over.
builder.Services.AddBitBelemetryServices(options =>
{
if (builder.Environment.IsDevelopment())
{
options.Debug = true; // Belemetry's own messages at Information, in the Bit.Belemetry category
options.Browser.Debug = true; // the script's diagnostics in console.debug
options.AddConsoleExporter(); // every record, printed
}
options.Metrics.Meters.Add("Bit.Belemetry"); // what was dropped and exported, as metrics
});
// appsettings.Development.json - make sure the console logger shows the category:
// { "Logging": { "LogLevel": { "Bit.Belemetry": "Information" } } }What getStats() counts
Counted since the page loaded. The reasons are the same words as the belemetry.reason attribute of
the .NET belemetry.records.dropped counter, where both sides drop for the same cause (see
.NET instrumentation).
dropped reason | Means | Look at |
|---|---|---|
not_consented | Their feature was not granted when the user decided | The consent the app asks for, and Consent.Default |
consent_revoked | Their feature was revoked while they were queued | Expected after a revoke |
pending_full | More than Consent.PendingLimit records waited for a decision; the oldest went first | A banner the user never answers |
queue_full | More than Browser.MaxQueueSize records waited for an export; the oldest went first | An endpoint that does not answer, or a flood of records |
error_limit | An identical error within Errors.DuplicateWindow, or over Errors.MaxPerMinute | The error loop it held back |
sampled_out | This session is outside Browser.SessionSampleRatio | Expected with a ratio below 1 |
filtered | A processor (BitBelemetry.addProcessor) returned false | Your processors |
requests outcome | Means |
|---|---|
delivered | Accepted by the backend |
rejected | Refused for good - a wrong key, a wrong endpoint, a body it cannot read |
kept | Not delivered, and stored for a later retry (needs Persistence) |
dropped | Neither delivered nor stored: lost |
queued is what waits for the next export, and pending what is held until the user
decides on consent.
Symptoms
| Symptom | Cause | Fix |
|---|---|---|
| CORS errors in the browser console | The browser posts to the collector from the page's origin, and the collector does not allow it | Allow the origin on the receiver (OTLP), give the exporter a CORS-enabled BrowserEndpoint, or switch to the Relay transport |
| No .NET telemetry from the server | The server pipeline is off by default on ASP.NET Core hosts | options.Server.CollectDotnetTelemetry = true (Server pipeline) |
| Nothing reaches the Aspire dashboard | The AppHost hands its resources a gRPC endpoint; an exporter with its protocol fixed to HTTP in code posts HTTP to the gRPC port and fails quietly | Leave Protocol unset so OTEL_EXPORTER_OTLP_PROTOCOL=grpc applies, or give the AppHost WithOtlpExporter(OtlpProtocol.HttpProtobuf). An unknown protocol value is reported at startup |
| Logs and traces from WebAssembly, but no metrics | System.Diagnostics.Metrics is off in the app (MetricsSupport=false); Belemetry logs a startup warning saying so |
Remove <MetricsSupport>false</MetricsSupport>, or - when referencing Bit.Belemetry as a project rather than the package - import buildTransitive/Bit.Belemetry.props |
No System.Net.Http spans in WebAssembly |
The WebAssembly SDK turns HttpClient's tracing off; its requests show up as the script's fetch spans instead |
<HttpActivityPropagationSupport>true</HttpActivityPropagationSupport> - then HttpClient sends traceparent to every origin, which a cross-origin API must allow |
| Duplicate HTTP spans in WebAssembly | A custom handler strips the traceparent .NET added, so the script cannot tell the request was traced |
Add the URL to Browser.IgnoreUrls |
| The browser exports without its API key | A server never writes an exporter's Headers into the page; a startup warning names the exporter |
Move a key meant to be public to BrowserHeaders; keep a secret one in a collector, or use Relay |
The endpoint's user:password@ never reaches the collector |
No export sends user info (HttpClient leaves it out, the browser refuses such a URL), and the page never gets it; a server's startup warning names the exporter |
Put the credential in Headers (an Authorization header); for the browser's exports, a collector in between or Relay |
| A 400, 401, 403 - or for OTLP a 408 or 500 - is dropped, not retried | Only the statuses the backend's protocol calls transient are retried (Offline persistence) | Read the warning in the Bit.Belemetry category: it is the backend's final word on the key, the endpoint or the body |
| Only one of many identical errors arrives | By design: Errors.DuplicateWindow and Errors.MaxPerMinute cap error loops (error_limit) |
Shorten the window or raise the limit; zero switches either off |
An attribute reads REDACTED, [email] or [ip] |
The privacy rules - a credential name, or a pattern in free text | Remove the name from Privacy.RedactedAttributes, or turn off Privacy.ScrubPatterns |
| A long value ends abruptly | MaxValueLength (32768 characters) cuts attribute values, bodies and status messages |
Raise it, or set 0 to keep strings whole |
| Nothing at all, not even Belemetry's own diagnostics | OTEL_SDK_DISABLED=true in the environment turns Belemetry off, whatever the code says |
Unset the variable on that host |