- The sample integration which was highlights between Application Insights and Dynamics 365 doesn’t provide a lot of value.
- Nearly all the .NET examples rely on an external assembly reference making it’s use in plug-in impossible.
Application Insights is a pretty capable logging platform. There are plenty of built in analytics and the ability to connect to Power BI to work with the data in just about any way you want, so long as you’ve captured some useful data. In our case that is data specific to D365. There are several pre-defined types of telemetry data that can be collected but all of them allow custom properties or dimensions as they are also known to be tracked as well. So that opens up the possibility of knowing which user, entity, form, etc. was involved in a log entry. The alerting capabilities give you more than just simply being able to send an email when there is an error but to be a little smarter about it by doing things like analyzing the number of failures over a period of time and only then notifying someone if a threshold is exceeded. Data is kept for 90 days so you can look at things like performance over time. If 90 days isn’t enough there is a continuous export feature to move the data to a different data store. It’s also cheap. $2.30 per month that includes 5GB of data, which is a lot of text. Those things are just scratching the surface, there is so much more beyond what I've described.
Types of telemetry
- Dependencies – outbound calls to web services, SQL, or whatever
- Exceptions – errors
- Traces – messages typically for informational purposes
- Events – application interactions
- Metrics – numeric (single or aggregate) measurements
- Page Views – duration a user stayed on a web page
Custom DimensionsAs I mentioned, additional data can be included along with any log entry in the form of key/value pairs. The values here can be strings, booleans, dates, or numbers. So now when working with data inside the tools Application Insights provides, it can be queried or acted on just like any of the standard fields.
Custom MeasurementsMuch like custom dimensions, log entries can also include a set of measurements in the form of key/value pairs. The difference here is that the values must be numeric.
How To Start LoggingThere isn’t any magic happening, you only need 3 things to get going.
- Application Insights instance which provides an Instrumentation Key
- Url of the endpoint to log to: https://dc.services.visualstudio.com/v2/track
- Request data structure
I took what I learned and wrapped it up into a few different packages to facilitate logging:
- D365AppInsights – C# source code which can be added to a plug-in or custom workflow projects
- D365Applnsights Actions – Actions with plug-ins that which can be used from just about anywhere
- D365Applnsights Workflows – Custom steps to add logging to workflows
In the next few posts I’ll dive a little deeper into each of the items.
If you’re in a hurry to use any of this or if I get busy and can’t get to the next post soon I think I’ve down at least a fair job of documenting things on the wiki pages on the respective GitHub sites.
NuGet C# source package
Manages solutions for the prebuilt actions and workflow steps