Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

eXtreme365 - Plugin Development for Analysis


Published on

At the eXtreme365 conference in Lisbon, Portugal I did a session on plugin development with focus on adapting your code to empower the tracing and investigation features available in the Microsoft Dynamics 365 platform.

More information:

Published in: Technology
  • The "END OF GOUT" extensively goes over the nature-based solution that achieves just this. You'll be able to say goodbye to gout, and feel better than ever before, in just 7 days or less! ♣♣♣
    Are you sure you want to  Yes  No
    Your message goes here
  • Gout issues? Try this all natural remedy today.. ■■■
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

eXtreme365 - Plugin Development for Analysis

  1. 1. Guidelines and examples to plugin development for continuous tracing and advanced analysis using XrmToolBox Jonas Innofactor Sweden Rapp Plugin development for analysis
  2. 2. Jonas Rapp var jonas = (WhoAmIResponse)service.Execute(new WhoAmIRequest()); Head of Development, Innofactor SE Cinteros Developer Since 1994, Dynamics CRM since 2009 XrmToolBox contributor Since 2014 Speaker 2017: CRM Saturday, eXtreme365 MVP 2017 Twitter: @rappen Email: Blog:
  3. 3. Audience var audience = (WhoAreYouResponse)service.Execute(new WhoAreYouRequest()); Developers? C# Developers? XrmToolBox users? XrmToolBox contributors? CRM Debuggers? Plugin Trace Viewers?
  4. 4. Background Living with the platform – or – Teaching a developer to love the handcuffs of Microsoft Dynamics CRM
  5. 5. The Handcuffs of CRM From SW dev to MSDynCRM dev You are not in control Injecting our code Can’t take back control The black box is still black And it is getting darker in the cloud Have the box work for you Improve monitoring, pick up signals Hawking radiation emitted from a black hole Making the cuffs more comfortable
  6. 6. The Handcuffs of CRM Create your radiation Write logs Throw correct exceptions Relevant messages try-catch for valid call stacks Add noop triggers for logging Injectable contrast Simplify development Supporting libraries Intialization of service etc Embed logging Deployment routines Upload of webresources Deployment of plugins Export / import solutions etc.
  7. 7. Introduction Plugin investigation in Microsoft Dynamics 365
  8. 8. Plugin investigation options Debugging Plugin Profiler Plugin Registration, record context and “replay” during debugging Attach to process Onprem only Mocking context Hard code mocked events, communication with CRM limited Analyzing OOTB Logging Server Trace file Plugin Trace Log Custom Logging File Event viewer, External service Custom entity
  9. 9. Plugin investigation options Debugging Concept Try to reproduce bugs to monitor behavior Ad hoc mimicking – “watching quarks” Environment Dev/Test Access Plugin Registration Server process Analyzing Concept Look at actual recorded events Review history – “walk backwards” Environment Any Access Onprem server access Elevated user
  10. 10. Plugin Analysis – Out of the Box Server Trace file Onprem only, requires server access Hard to see the forest through the trees Plugin Trace Log Sandboxed only OOTB UX discouraging
  11. 11. Plugin Trace Log Plugin execution information Start time, Duration, Id, … Step and Context details Pipeline details Custom logging Initialize ITracingService Write logging information • Message Body • Exception Details Availability Settings – Plug-in Trace Log Exceptions • Sync plugins exceptions • Settings – System Jobs Introduced CRM 2011 – exceptions only • Plugins • Async jobs CRM 2015 U1 – Entity and UI
  12. 12. Plugin Trace Log Activation System Setting • Off • Exceptions • All Written async After execution completed Considerations Always on? • Performance impact Recurring bulk delete job! • Default is provided Detail level • Message Block max 10k
  13. 13. Demo 1 Plugin Trace Log OOTB
  14. 14. Custom Tools Making plugin investigation easier
  15. 15. Plugin Trace Log – 3rd Party Help What Plugin Trace Viewer A tool in the “industry standard” XrmToolBox Alternative UI Presenting information from the Plugin Trace Log in a more appetizing way Purpose Empower the Plugin Trace Log Filtering Grouping Quick-view Empower YOU Make it easy to find relevant information from the log
  16. 16. Plugin Trace Log – Base class What Plugin base class Implements IPlugin Encapsulates target entity, images, service, trace etc. Custom service class Implements IOrganizationService Writes log and timing to trace Purpose Make tracing seamless Code as you always code Get tracing for free Streamline development Focus on business logic, not repetitive common tasks
  17. 17. Demo 2 Simple plugin using base class First glance at the Plugin Trace Viewer Context logging plugin
  18. 18. Correlation A walk down memory lane
  19. 19. Plugin Trace Log – Correlation Id What Guid related to plugin execution Maintained through entire pipeline Stored in each trace log record Available in IExecutionContext How do events correlate? Purpose CRM Core Used to prevent infinite loops Plugin Trace Viewer Follow execution chains Trace events triggering events Our breadcrumb trail in the forest
  20. 20. Plugin Trace Viewer – Correlation Id How Identify log records with same Id Guids transposed to single letters No letter for single unique records Select all connected records Filter by correlation id(s) Purpose Our breadcrumb trail Cherry picking the trace log Connect the dots Originating from one (1) event
  21. 21. Demo 3 Correlation Id Plugins triggering plugins Exception origins
  22. 22. More analysis tools Aggregated lifetime stats Plugin Type Statistics Organization Insights
  23. 23. Plugin Type Statistics Aggregated stats about plugins Execution count Failure count Average execution time Crash count and reasons Cannot be reset In CRM Advanced Find, like any entity In Plugin Trace Viewer Show Statistics panel
  24. 24. Organization Insights Availability Preview Dashboard (being replaced) Marketplace Solution (replacing) Metrics about the instance Activity statistics Dimensions Operations (CRUD) Requests (Form, Report, Dashboard) Plugin (Executions, Failures) Entity User
  25. 25. Organization Insights – Preview Dashboard
  26. 26. Organization Insights – Activity
  27. 27. Organization Insights – Plugins
  28. 28. References
  29. 29. Code JonasPluginBase project JonasPluginBase NuGet package Samples from demo CRM Ideas Reset Plugin Type Statistics Define trace message block size Store milliseconds on traces Trace plugins not sandboxed Please vote 
  30. 30. Complete prior to the closing session to be included in the survey drawing! LG TONE PLATINUM Wireless Stereo Headset WEBSITE Jonas Rapp, Innofactor FILL OUT SURVEY THROUGH THE MOBILE APP
  31. 31. Thank you to our sponsors!