Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

Dual-write monitoring with Azure App Insights

Corina Balan Profile Picture Corina Balan
What is Dual-write?
Dual-write is a powerful integration feature that enables data to be synchronized bi-directionally between Dataverse and finance and operations apps, providing real-time data consistency across systems. This seamless synchronization ensures that changes made in one system are immediately reflected in the other, thereby enhancing operational efficiency.

Monitoring and troubleshooting
For monitoring dual-write there are features accessible from the dual-write workspace, and for troubleshooting you can analyze the Dataverse plugins logs and DualWriteErrorLog table in finance and operations. To augment these capabilities and to enhance your monitoring strategy, you can now use an Azure Data Explorer dashboard provided by Microsoft which is focusing on dual-write integrations.

ExperienceCapabilities
Dual-write workspace
  • Set up alerts when dual-write table maps have errors, to handle cases of planned or unplanned maintenance. For example, you can set up the dual-write system to notify you by email if a specific error threshold is reached because of, for example, network errors. The dual-write system can also act on your behalf. For example, it can pause or stop dual-write.
  • Troubleshoot errors related to initial sync synchronization. For example, error count, direction in which the sync failed, and details of why it failed. Upon resolving the underlying issue, you can re-run execution for full set or only for new records.
  • Troubleshoot errors related to paused table maps records synchronization with detailed error messages per records and option to retry selected or all records.
Dataverse plugin logs
  • Troubleshoot dual-write live sync issues using Dataverse plugin trace logs
DualWriteErrorLog with debug mode in finance and operations

  • Troubleshoot dual-write live sync issues using finance and operations apps logs
NEW Azure Data Explorer dashboard
  • Monitoring dual-write transactions – errors raised by finance and operations apps for transactions initiated in Dataverse, errors raised by Dataverse for transactions initiated in finance and operations apps, or any Dataverse errors for your dual-written tables. Use the details provided such as error message, table name, record id, correlation id for analysis and troubleshooting.
  • Observe daily error trends for your dual-written tables and create alerts for when errors are above a defined threshold.
  • Monitor critical functionality plugins for errors and performance. Identify plugins that are performance bottleneck.
  • Advanced performance analysis for your dual-write operations. Identify for your dual-written tables the performance of Dataverse SDK requests.

Monitor and troubleshoot using Azure App Insights

The dual-write live sync integration can be monitored by leveraging the telemetry feed from Dataverse and finance and operations app to Azure App Insights. This complements the out-of-the-box monitoring and troubleshooting features.
The Microsoft FastTrack for Dynamics 365 team has published several assets that give you a kick start on predefined dashboards, queries, and how to consume App Insights. These resources are available on GitHub and can help you get started, refer to https://github.com/microsoft/Dynamics-365-FastTrack-Implementation-Assets/tree/master/MonitoringAndTelemetry.

For dual-write monitoring, we have recently published a Dual-write monitoring dashboard in github â€“ the dashboard includes metrics on dual-write operations, performance, trends and exceptions, with the benefit of improved decision-making and optimized business processes. 
Please carefully consider the cost implications for Azure services when enabling telemetry feed to Azure App Insights from Dataverse and finance and operations apps. For more details and strategies on how to manage costs please see Understand and control costs - Finance & Operations | Dynamics 365 | Microsoft LearnNext, we will describe each tile on the dashboard, its purpose, and how you can expand or duplicate the provided queries for your specific dual-write tables of interest.

Finance and operations dual-write errors

Description

List of errors for dual-write operations that were initiated in finance and operations and failed in Dataverse. Use this query to monitor overall health of the integration and create alerts for increases in failure counts above a threshold. For further troubleshooting, the outerMessage and customDimensions columns may contain relevant details to pinpoint the underlying issue.

Query

exceptions
| where timestamp > _startTime and timestamp <= _endTime
| where customDimensions has 'DualWriteChangeProcessor'
| order by timestamp desc

Dataverse dual-write errors

Description

List of errors for dual-write operations that were initiated in Dataverse which failed in finance and operations or Dataverse. Personalize the query with the tables of interest in your dual-write implementation.
Use this query to monitor overall health of the integration and create alerts for increases in failure counts above a threshold. For further troubleshooting, the customDimensions column may contain relevant details to pinpoint the underlying issue such as entityName, entityId, organizationid, correlationId.

Query

exceptions
| where timestamp > _startTime and timestamp <= _endTime
| extend cd = parse_json(tostring(customDimensions))
| where customDimensions contains "Microsoft.Dynamics.Integrator" or cd.entityName in ('account','contact','quote','msdyn_party', 'msdyn_postaladdress')
| order by timestamp desc

Daily dual-write errors distribution


Description

A line chart visualizing the daily dual-write errors for operations initiated in Dataverse which failed in finance and operations or Dataverse as well as operations initiated in finance and operations that failed Dataverse. Personalize the query with the tables of interest for your dual-write implementation.
Use it to observe declining trends early and to intervene proactively. You can generate alerts when the number of errors is higher than acceptable levels.

Query

exceptions
| where timestamp >= _startTime and timestamp <= _endTime
| extend cd = parse_json(tostring(customDimensions))
| where customDimensions has 'DualWriteChangeProcessor' or customDimensions contains "Microsoft.Dynamics.Integrator" or cd.entityName in ('account','contact','quote','msdyn_party', 'msdyn_postaladdress')
| extend Day = startofday(timestamp)  // Extract only the date part
| summarize ErrorCount = count() by Day
| order by Day asc
| render linechart

Dual-write Supply Chain App plugin errors

Description

List of plugin errors for dual-write operations specific to dual-write supply chain extended app (SCM) that were initiated and failed in Dataverse. Use this query to monitor overall health of the SCM app (product, quote, order, purchaseorder, uom) and create alerts for increases in failure counts above a threshold. You can replicate or personalize the query to monitor your custom plugin assemblies.   

Query

exceptions
| where timestamp >= _startTime and timestamp <= _endTime
| where customDimensions has "Microsoft.Dynamics.SCMExtended"
| project timestamp, outerMessage, type, customDimensions, operation_Id, operation_ParentId, user_Id, session_Id

Dual-written tables Dataverse SDK operations success


Description

A line chart visualizing the daily success count and total count of Dataverse initiated SDK requests for accounts table, helping you quickly assess the overall volumes and reliability of operations for this table. The chart will consider requests for dual-written tables initiated in Dataverse.
You can replicate this chart for other dual-written tables specific to your implementation such as contact, quote, salesorder and others.
Use this chart to spot declining trends early and intervene proactively. Generate alerts when the success rate dips below acceptable levels.

Query

dependencies
| where timestamp >= _startTime and timestamp <= _endTime
| where type in~ ("SDKCreate", "SDKUpdate", "SDKDelete", "SDKUpsert", "SDKUpsertMultiple","SDKRetrieve")
| where name in~ ("account")
| where isempty(operation_SyntheticSource)
| where user_Id != "00000000-0000-0000-0000-000000000000"
| extend Day = startofday(timestamp)  // Extract only the date part
| summarize SuccessCount = countif(success == true), TotalCount = count() by bin(timestamp, 1d)
| extend SuccessRate = todouble(SuccessCount) / todouble(TotalCount) * 100
| render timechart

Dual-written tables Dataverse SDK operations performance


Description

This tile categorizes the daily performance of Dataverse initiated SDK operations for account table. The operations are grouped into performance buckets based on their response times, highlighting the overall response time distribution and trends over time. You can replicate this chart for other dual-written tables specific to your implementation such as contact, quote, salesorder and others.
Create an alert when the percentage of SDK operations in slow buckets (e.g., >5sec) exceeds the normal pattern.

Query

dependencies
| where timestamp >= _startTime and timestamp <= _endTime
| where type in~ ("SDKCreate", "SDKUpdate", "SDKDelete", "SDKUpsert", "SDKUpsertMultiple","SDKRetrieve")
| where name in~ ("account")
| where isempty(operation_SyntheticSource)
| where user_Id != "00000000-0000-0000-0000-000000000000"
| extend Day = startofday(timestamp)  // Extract only the date part
| summarize TotalCount = count() by bin(timestamp, 1d), performanceBucket
| render columnchart

Dataverse plugins triggered by dual-written tables and their performance

Description

This table lists the plugins that were executed for account table events. The table filters for the plugins target table to be the account, however you can extend to include your tables of interest who are dual-written and have plugins triggered in Dataverse. Or you can choose to filter rather on your custom plugins that you would like to monitor and use the cd.pluginName column.
Use this table to monitor your custom synchronous plugins duration as these directly contribute to the overall performance of dual-write transactions.

Query

// Performance of Dataverse plugins triggered by table account events
dependencies
| where timestamp between (ago(1d) .. now())
| where type == "Plugin"
| extend cd = parse_json(tostring(customDimensions))
| where cd.entityName == "account"
| extend Day = startofday(timestamp)  // Extract only the date part
| summarize TotalExecution = count(), PerceivedErrors = countif(success=="False"), AverageDuration = toint(avg(duration)),maxExecutionTime = max(duration),
            Slow3s = countif(duration >=3000),Slow5s = countif(duration >=5000),        
            Slow8s = countif(duration >=8000),Slow15s = countif(duration >=15000),Slow30s = countif(duration >=30000)
  by tostring(cd.pluginName)

How to connect Azure Data Explorer with App Insights instance

Enable telemetry feed to App Insights

Enable export to AppInsights from your Dataverse for Dataverse diagnostics and performance, and for the connected finance and operations environment. Use the same AppInsights instance for both.

Connect Azure Data Explorer to your App Insights instance

To connect Azure Data Explorer to your App Insights instance, you will need to use a specific URL and add your Subscription ID. Here are the key components you will need to update the URL:
  • TENANT_ID: ID of your Azure AD Tenant where your Azure Application Insights instance lives.
  • SUBSCRIPTION_ID: ID of the Azure Subscription that contains the Application Insights instance.
  • RESOURCE_GROUP: Name of the Resource Group where the Application Insights instance is deployed.
  • APPINSIGHTS_INSTANCE_NAME: Name of the Application Insights instance.
  • ENCODED_KQL_QUERY: Encoded KQL query to execute.
  • TIMESPAN: Time filter for the query (optional)
Simply, go to https://dataexplorer.azure.com/ and then connect Dashboard’s to data sources with and https://ade.applicationinsights.io/subscriptions/[SUBSCRIPTIONID]
And for running direct queries connect complete URL -> https://ade.applicationinsights.io/subscriptions/[SUBSCRIPTIONID]/

How to Import this dashboard in Azure Data Explorer


Always import the dashboard into a non-production (test or sandbox) environment first, validate that the visualizations and queries align with your organization's data model and monitoring requirements, and only then promote it to your production Application Insights workspace.
  1. Import the file dashboard-Dual-write App Insights.json

  1. Name the dashboard appropriately and then click to select Datasources.
  2. In the Datasources selection pane you have to input your Azure Application Insights subscriptionID in the placeholder :
  3. After updating the correct subscriptionID, click on connect.
  4. You will get a list of databases. Select your ApplicationInsights name from the list and save the changes.
  5. Your dashboard should have data now. Feel free to edit the queries to suit your needs.

Conclusion

The dual-write out of the box capabilities combined with AppInsights and Azure Data Explorer, provide a powerful solution for your dual-write monitoring strategy. You can use the Azure Data Explorer dashboard to monitor performance, success and detailed errors for dual-written tables.
​​​​​​​
For more monitoring sample queries please visit on github https://github.com/microsoft/Dynamics-365-FastTrack-Implementation-Assets/tree/master/MonitoringAndTelemetry  

Please don’t hesitate to  share your feedback and ideas for the dashboard evolution using the post comments or by contacting us at D365AppInsights@microsoft.com.

/**
* SAMPLE CODE NOTICE
*

* THIS SAMPLE CODE IS MADE AVAILABLE AS IS.  MICROSOFT MAKES NO WARRANTIES, WHETHER EXPRESS OR IMPLIED,
* OF FITNESS FOR A PARTICULAR PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OR CONDITIONS OF MERCHANTABILITY.
* THE ENTIRE RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS SAMPLE CODE REMAINS WITH THE USER.
* NO TECHNICAL SUPPORT IS PROVIDED.  YOU MAY NOT DISTRIBUTE THIS CODE UNLESS YOU HAVE A LICENSE AGREEMENT WITH MICROSOFT THAT ALLOWS YOU TO DO SO.
*/

Comments