Monitoring and Analyzing Telemetry
APPLIES TO: Business Central 2019 release wave 2 and later
Business Central emits telemetry data for various activities and operations on tenants and extensions. Whether running Business Central online or on-premises, you can set up your tenants to send telemetry to Application Insights. Application Insights is a service hosted within Azure that gathers telemetry data for analysis and presentation. Monitoring telemetry gives you a look at the activities and general health of your tenants. It helps you diagnose problems and analyze operations that affect performance.
Tenant-level and extension-level telemetry
Application Insights can be enabled on two different levels:
When enabled on the tenant, either for a Business Central online tenant or on-premises Business Central Server instance, telemetry is emitted to a single Application Insights resource for gathering data on tenant-wide operations.
With Business Central 2020 release wave 2 and later, Application Insights can also be enabled on a per-extension basis. An Application Insights key is set in the extension's manifest (app.json file). At runtime, certain events related to the extension are emitted to the Application Insights resource. This feature targets publishers of per-tenant extensions to give them insight into issues in their extension before partners and customers report them.
Both for tenant-level and for extension-level telemetry, it is possible to craft custom telemetry messages directly from AL using the LogMessage Method.
In Application Insights, telemetry from Business Central is logged as traces. Currently, Business Central offers telemetry on the following operations:
|Area||Description||Online||On-premises||Extension support||More information|
|AppSource Submission Validation||Provides information about validation when an extension is submitted to AppSource.||See...|
|App key vault secrets||Provides information about the retrieval of secrets from Azure Key Vaults by extensions.||||||See...|
|Authorization||Provides information about user sign-in attempts. Information includes success or failure indication, reason for failure, user type, and more.||See...|
|Company lifecycle||Provides information about creating, copying, and deleting of companies.||See...|
|Configuration package lifecycle||Provides information about operations done on configuration packages, including exporting, importing, applying, and deleting.||See...|
|Database lock timeouts||Provides information about database locks that have timed out.||See...|
|Provides information about the success or failure of sending emails.||See...|
|Extension lifecycle ||Provides information about the success or failure of extension-related operations, like publishing, synchronizing, installing, and more.||See...|
|Extension update||Provides information about errors that occur and upgrade tags used when upgrading an extension.||See...|
|Field monitoring trace||Provides information about the usage of the field monitoring feature.||See...|
|Job queue||Provides information about creating and running job queue entries.||See...|
|Long running AL method trace||Provides information about long running AL methods.||See...|
|Long running operation (SQL query)||Provides information about SQL queries that take longer than expected to execute.||See...|
|Page views||Provides information about the pages that users open in the modern client.||||See...|
|Permissions||Provides information about adding, removing, and assigning permission sets.||See...|
|Report generation||Provides information about the execution of reports.||See...|
|Retention policy trace||Provides information about the usage of the retention policy feature.||See...|
|Incoming web service requests||Provides information about the execution time of incoming web service requests.||See...|
|Outgoing web service requests||Provides information about the execution time of outgoing web service requests.||See...|
|Table index trace||Provides information about the addition or removal of a table index.||See...|
|Web service access key authentication||Provides information about the authentication of web server access keys on web service requests.||See...|
Enabling Application Insights
Sending telemetry data to Application Insights requires you have an Application Insights resource in Azure. Once you have the Application Insights resource, you can start to configure your tenants and extensions to send telemetry data to your Application Insights resource. For more information, see Enable Sending Telemetry to Application Insights.
For extensions, see Sending Extension Telemetry to Azure Application Insights.
Viewing telemetry data in Application Insights
Telemetry from Business Central is stored in Azure Monitor Logs in the traces table. You can view collected data by writing log queries. Log queries are written in the Kusto query language (KQL). For more information, see Logs in Azure Monitor and Overview of log queries in Azure Monitor.
As a simple example, follow these steps:
In the Azure portal, open your Application Insights resource.
In the Monitoring menu, select Logs.
On the New Query tab, type the following to get the last 100 traces:
traces | take 100 | sort by timestamp desc
About Custom Dimensions
Each trace includes a
customDimensions column. The
customDimensions column, in turn, includes a set dimensions that contain metrics specific to the trace. Each of these custom dimensions has a limit of 8000 characters. If a dimension's value exceeds 8000 characters, additional dimensions will be added to the trace for containing the excess characters. There can be up to two additional parameters, each with a maximum 8000 characters. The additional dimensions will have the names that
<custom_dimension_name> is the name of the original dimension. For example, if the custom dimension is
extensionCompilationDependencyList, then the additional dimensions would be
The 8000 character limit is governed by the Application Insights API.
Application Insights sample code
In the Business Central BCTech repository on GitHub, samples of KQL code are available to make it easy to get started using Application Insights.
For more information, see Business Central BCTech repository on GitHub.
Telemetry Event IDs
Enable Sending Telemetry to Application Insights
Working with Administration Tools
The Business Central Administration Center
Managing Tenant Notifications
Introduction to automation APIs