Editar

Partilhar via


Analyzing error method telemetry

APPLIES TO: Business Central 2022 release wave 1 and later

Note

Azure Active Directory is now Microsoft Entra ID. Learn more

When a user gets an error dialog while working in Business Central, a telemetry signal is emitted, which can be logged in an Azure Application Insights resource.

This telemetry data let's you identify and analyze calls to the Error method from AL code. You can also set up alerts in Azure Application Insights to get notified if many users experience errors.

Error dialog displayed

Occurs when the Error method is called and displays a dialog to the user.

General dimensions

Dimension Description or value
message Error dialog displayed: {failureReason}
severityLevel 3
user_Id The user telemetry ID for the user. From the user card, you can use user_Id to identify the user who triggered this telemetry event. Learn more in Assign a telemetry ID to users.

Custom dimensions

Dimension Description or value
eventId RT0030
alErrorMessage The error string defined in the error method and displayed in the client.

The actual error string from AL code is shown in this dimension only if the string is a Label or TextConst data type. For all other data types, the string Use ERROR with a text constant to improve telemetry details is shown instead of the actual string.

Some messages can contain customer data. As a precaution, Business Central only emits information that's classified as SystemMetadata. Information that belongs to other data classifications, like customer data, isn't shown. Instead, the following message is shown: "Message not shown because the NavBaseException(string, Exception, bool) constructor was used."
alEnglishLanguageDiagnosticsMessage The error message in English (no matter which language the user had specified in the client).

This dimension was introduced in Business Central 2023 release wave 1, version 22.0.
alObjectId Specifies the ID of the AL object.
alObjectType Specifies the type of the AL object.
alStackTrace The stack trace in AL.
clientType Specifies the type of client that opened the session, such as Background or Web. For a list of the client types, see ClientType Option Type.
companyName The current company name.
failureReason Dialog means the error was the result of an error method call in AL. Errors thrown by the platform have other reasons, like MetadataNotFound.

Common custom dimensions

The following table explains other custom dimensions that are common to all error telemetry.

Dimension Description or value
aadTenantId The Microsoft Entra tenant ID that's used for Microsoft Entra authentication. For on-premises, if you aren't using Microsoft Entra authentication, this value is common.
component Dynamics 365 Business Central Server
componentVersion The version number of the component that emits telemetry (see the component dimension)
environmentName The name of the tenant environment. See Managing Environments. This dimension isn't included for Business Central on-premises environments.
environmentType The environment type for the tenant, such as Production, Sandbox, Trial. See Environment Types
telemetrySchemaVersion The version of the Business Central telemetry schema

Sample KQL code (error dialogs)

This KQL code can help you get started analyzing which error dialogs users see:

traces
| where timestamp > ago(60d) // adjust as needed
| where customDimensions.eventId == 'RT0030'
| project timestamp
// in which environment/company did it happen
, aadTenantId = customDimensions.aadTenantId
, environmentName = customDimensions.environmentName
, environmentType = customDimensions.environmentType
, companyName = customDimensions.companyName
// in which extension/app
, extensionId = customDimensions.extensionId
, extensionName = customDimensions.extensionName
, extensionVersion = customDimensions.extensionVersion
, extensionPublisher = customDimensions.extensionPublisher
// in which object
, alObjectId = customDimensions.alObjectId
, alObjectName = customDimensions.alObjectName
, alObjectType = customDimensions.alObjectType
// which user got the error
, usertelemetryId = case(
  toint( substring(customDimensions.componentVersion,0,2)) >= 20, user_Id // user telemetry id was introduced in the platform in version 20.0
, 'N/A'
)
// error information
, clientType = customDimensions.clientType
, errorMessageInUsersLanguage = customDimensions.alErrorMessage
, errorMessageInEnglish = customDimensions.alEnglishLanguageDiagnosticsMessage // This dimension was introduced in Business Central 2023 release wave 1, version 21.4.
, alStackTrace = customDimensions.alStackTrace
, failureReason = customDimensions.failureReason

Understanding the error dialog

To effectively help users mitigate any issues they might encounter, you should learn more about the different parts of the error dialog, including how to interpret the AL stack trace. For more information, see Understanding the error dialog.

Dialog.Error Method Dialog.Error Method
Understanding the error dialog
Monitoring and Analyzing Telemetry
Enable Sending Telemetry to Application Insights