Skip to main content

Observability

Reveal records every AI call it makes: chat, insights, and background metadata work, on every provider.

Without any setup, each call is written to the developer's logs and counted in OpenTelemetry metrics, so the developer can see where tokens go per intent, profile, and model before going live. Clients also receive the profile and token usage of each response.

The log and metrics belong to the ASP.NET server. To receive the same records in the developer's own store, or in a Node.js or Java application, register a usage sink.

Usage log​

Each AI call is logged as one structured line under the Reveal.Sdk.AI.Usage category: at Information for user calls, and at Debug for background calls Reveal makes on its own. The line includes the user, intent, profile, provider, model, token counts, duration, whether the call succeeded, and the finish reason, and the IDs that group the calls of one operation. It never includes prompt or response text.

Silence or redirect it with standard log filtering:

appsettings.json
{
"Logging": {
"LogLevel": {
"Reveal.Sdk.AI.Usage": "Warning"
}
}
}

Metrics​

Reveal publishes these instruments on the reveal.sdk.ai meter:

InstrumentTypeDescription
ai.callsCounterAI provider calls.
ai.tokens.inputCounterInput tokens.
ai.tokens.outputCounterOutput tokens.
ai.tokens.reasoningCounterTokens spent on internal reasoning.
ai.tokens.input.cachedCounterInput tokens served from the provider's prompt cache.
ai.call.durationHistogramCall duration, in milliseconds.

Each measurement is tagged with:

TagValue
gen_ai.operation.nameThe intent, such as generation-build-report.
reveal.ai.profileThe profile that served the call.
gen_ai.provider.nameThe provider registration name.
gen_ai.request.modelThe model.
reveal.ai.succeededWhether the call succeeded.
reveal.ai.stageThe dashboard generation step, for calls made by the multi-step dashboard generator (UseDashboardGeneratorV2).

To export them, add the meter to the OpenTelemetry configuration:

Program.cs
builder.Services.AddOpenTelemetry()
.WithMetrics(metrics => metrics
.AddMeter("reveal.sdk.ai")
.AddOtlpExporter());

Usage in responses​

Chat and insights responses tell the client which profile served the request and how many tokens it used. profile is the profile that served the request's default intent; when other intents are mapped to other profiles, those calls may have run elsewhere. usage is summed across the request's AI calls, except datasource ranking during a dashboard generation, which runs as background work:

const response = await client.ai.chat.sendMessage({
message: 'Show me sales by region',
datasourceId: 'sales',
});

console.log(response.profile); // for example, "default"
console.log(response.usage?.totalTokens); // undefined when the provider reported no usage
console.log(response.finishReason); // of the last AI call: "Stop", "Length", "ContentFilter", or "Other"