Analyzing Incoming Web Services Request Telemetry
INTRODUCED IN: Business Central 2020 release wave 1
Web services telemetry gathers data about SOAP, OData, and API requests through the service. It provides information like the request's endpoint, time to complete, the SQL statements run, and more.
General dimensions
The following table explains the general dimensions included in an incoming Web Services Call trace. The table lists the dimensions that are specific to Business Central.
| Dimension | Description or value |
|---|---|
| operation_Name | Web Services Call Note: The use of the operation_Name column was deprecated in version 16.1. In future versions, data won't be stored in this column. So in version 16.1 and later, use the custom dimension column eventID column custom in Kusto queries instead of operation_Name. |
| message | Version 16.1 and later (depending on the type):
|
| severityLevel | 1 |
Custom dimensions
The following table explains the custom dimensions included in a Web Services Call trace.
| Dimension | Description or value |
|---|---|
| aadTenantId | Specifies the Azure Active Directory (Azure AD) tenant ID used for Azure AD authentication. For on-premises, if you aren't using Azure AD authentication, this value is common. |
| alObjectId | Specifies the ID of the AL object that was run by request.[1] |
| alObjectName | Specifies the name of the AL object that was run by the request.[1] |
| alObjectType | Specifies the type of the AL object that was run by the request.[1] |
| category | Specifies the service type. Values include: API, ODataV4, ODataV3, and SOAP. |
| component | Dynamics 365 Business Central Server |
| componentVersion | Specifies the version number of the component that emits telemetry (see the component dimension.) |
| deprecatedKeys | A comma-separated list of all the keys that have been deprecated. The keys in this list are still supported but will eventually be removed in the next major release. We recommend that update any queries that use these keys to use the new key name. |
| diagnosticsMessage | Logged in case of an error in a OData/API call. This dimension was introduced in Business Central 2023 release wave 1, version 22.0. |
| endpoint | Specifies the endpoint for the request. |
| environmentName | Specifies the name of the tenant environment. See Managing Environments. |
| environmentType | Specifies the environment type for the tenant, such as Production, Sandbox, Trial. See Environment Types |
| eventId | RT0008 This dimension was introduced in Business Central 2020 release wave 1, version 16.1. |
| failureReason | Logged in case of an error in a OData/API call. Contains the exception as seen from the server. This dimension was introduced in Business Central 2023 release wave 1, version 22.0. |
| httpHeaders | Introduced in version 16.3. Specifies the http headers set in the request. In version 17.3, a truncated version of the Authorization header was introduced to enable querying for the use of basic or token authorization. |
| httpMethod | Introduced in version 16.3. Specifies the HTTP method used in the request. Values include: POST, GET, PUT, PATCH, or DELETE. |
| httpStatusCode | Introduced in version 16.3. Specifies the http status code returned when a request has completed. This dimension further indicates whether request succeeded or not, and why. Use it to verify whether there was an issue with a request even though the request was logged as successful. The dimension displays one of the following values:
Data isn't populated for SOAP endpoints. |
| requestQueueTime | Specifies the amount of time the request spent in the request queue before it was started by the server.[3] The time has the format hh:mm:ss.sssssss. |
| serverExecutionTime | Specifies the amount of time it took the server to complete the request**. The time has the format hh:mm:ss.sssssss. Time spent in the request queue isn't included. |
| sqlExecutes | Specifies the number of SQL statements that the request executed.[1] [2] |
| sqlRowsRead | Specifies the number of table rows that were read by the SQL statements.[1] [2] |
| totalTime | Specifies the amount of time it took to process the request.[2] The time has the format hh:mm:ss.sssssss. Time spent in the request queue isn't included. |
| telemetrySchemaVersion | Specifies the version of the Business Central telemetry schema. |
1This dimension isn't relevant for $metadata calls, like https://localhost:7048/BC/ODataV4/$metadata, so it won't be in the trace.
2From telemetrySchemaVersion 0.6 and onwards, this value also includes the CompanyOpen operation.
3This dimension was introduced in Business Central 2023 release wave 1, version 22.0.
4This HTTP status code was introduced in Business Central 2023 release wave 1, version 22.2.
Analyze web service call performance using telemetry
As a developer, you use the data to learn about conditions that you can change to improve performance. The following table provides some examples:
| Condition | Analysis |
|---|---|
| A web service request results in a long running SQL query | Adjust or fine-tune code. |
| Web service requests to a specific endpoint read more rows than requests to the other endpoints | Consider adding filtering to limit the rows that are read. |
| Fewer API type requests compared with other types | With SOAP and OData requests to UI pages, computation resources are used on UI elements that aren't relevant. Instead of exposing normal pages as web service endpoints, use the built-in API pages. API pages are optimized for this scenario. |
| High number of requests to endpoints that include Power BI | This condition may indicate excessive Power BI integration. |
For more performance guidelines, see Writing efficient Web Services.
Analyze web service call stability using telemetry
Business Central telemetry on web service calls have two important dimensions to troubleshoot failed web service calls.
HTTP status codes
When you try to access content on a server by using the HTTP protocol, it returns a numeric code that indicates the result of the request and semantics of the response, including whether the request was successful.
The first digit of the status code defines the class of response. The last two digits don't have any categorization role. There are five values for the first digit:
1xx (Informational): Provisional response - the request was received, continuing process. 2xx (Successful): The server successfully received and accepted the request. 3xx (Redirection): Further action needs to be taken in order to complete the request. 4xx (Client Error): The request contains an error and can't be fulfilled. 5xx (Server Error): The server failed to fulfill the request.
For more information, see HTTP Semantics
The custom dimension httpStatusCode
The custom dimension httpStatusCode is key to understanding unsuccessful web service calls. Any call with an HTTP status code in the 4xx range should be investigated because these calls are likely failing due to a misconfiguration on the web service client (the caller).
Business Central online and on-premises are configured with various limits on web service requests. For example, there's a request timeout and a maximum connections limit. For online, you can't change these limits, but it's helpful to know what the limits are. See Current API Limits. For on-premises, you change the limits on the Business Central Server instance. See Configuring Business Central Server. Web service calls that exceed the timeout limit result in a 408 - Request Timeout. These calls are recorded in Application Insights with a totalTime that is equal to the timeout threshold.
The custom dimension failureReason
The custom dimension failureReason is used to troubleshoot further, mostly error conditions happening in the AL code behind the web service endpoint.
For more information on error codes for the various exceptions that are logged in the custom dimension failureReason, please see Troubleshooting OData/API calls.
Sample KQL code for combinations of httpStatusCode and failureReason
This KQL code can help you see combinations of httpStatusCode and failureReason in your web service call telemetry:
traces
| where timestamp > ago(60d) // adjust as needed
| where customDimensions has 'RT0008'
| where customDimensions.httpStatusCode <> 200
| where customDimensions.category <> 'SOAP' // no httpStatusCode or failureReason logged for SOAP calls
| project failureReason = tostring( customDimensions.failureReason )
, httpStatusCode = tostring(customDimensions.httpStatusCode)
| where isnotempty( httpStatusCode )
| distinct httpStatusCode, failureReason
Sample KQL code
To make it easier to get started using Azure Application Insights with Business Central, samples of KQL code are available in the Business Central BCTech repository on GitHub.
Specifically, the KQL query WebServiceCalls.kql illustrates how to extract HTTP headers, user agents, and authorization type from web service call telemetry.
If you want to analyze web service call telemetry from the usage of the Microsoft connector (Power BI, Power Apps, ...), then the query MicrosoftConnectorUsage.kql might be useful.
See also
Monitoring and Analyzing Telemetry
Enable Sending Telemetry to Application Insights
Writing efficient Web Services
API Limits
Feedback
Submit and view feedback for