This Orchard CMS module enables easy integration of Azure Application Insights telemetry into Orchard.
C#
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Drivers Adapting to TelemetryModules not being able to be instantiated twice … Sep 20, 2015
Events Shortening comment line Oct 8, 2015
Exceptions Exceptions coming from the request pipeline now are let to bubble up,… Jan 13, 2015
Extensions Adding ability to track when background tasks start and end, some cor… Jul 15, 2016
Filters More "default" renames Aug 27, 2015
Handlers Usings clean-up Dec 26, 2014
Models Adding new setting and upgrading AI NuGet packages Feb 6, 2017
Properties Initial commit with module skeleton Oct 19, 2014
Services Fixing sweep Feb 7, 2017
TelemetryInitializers Adding ability to track when background tasks start and end, some cor… Jul 15, 2016
TelemetryProcessors Fixing that after Live Metrics Stream started working standard reques… Jul 2, 2016
Views Better UI hint for BackgroundTaskTrackingIsEnabled Feb 7, 2017
.gitattributes Adding gitattributes and updating Licence Nov 23, 2015
.gitignore Adding gitignore for the git mirror Mar 3, 2015
.hgignore Initial commit with module skeleton Oct 19, 2014
Constants.cs Adding ability to track when background tasks start and end, some cor… Jul 15, 2016
Licence.md Adding gitattributes and updating Licence Nov 23, 2015
Lombiq.Hosting.Azure.ApplicationInsights.csproj Adding new setting and upgrading AI NuGet packages Feb 6, 2017
Module.txt Adding ability to track when background tasks start and end, some cor… Jul 15, 2016
Placement.info Implementing that app settings can be used for telemetry configuratio… Oct 22, 2014
Readme.md Updating readme Apr 11, 2016
Web.config Adding new setting and upgrading AI NuGet packages Feb 6, 2017
packages.config Adding new setting and upgrading AI NuGet packages Feb 6, 2017

Readme.md

Hosting - Azure Application Insights Readme

This Orchard CMS module enables easy integration of Azure Application Insights telemetry into Orchard. Just install the module, configure the instrumentation key from the admin and collected data will start appearing in Application Insights. The module is tenant-aware, so in a multi-tenant setup you can configure different instrumentation keys to collect request tracking and client-side tracking data on different tenants. This is also available on all sites of DotNest, the Orchard CMS as a Service.

Warning: this module is only compatible with the Orchard 1.9+.

Note that the module depends on the Helpful Libraries module so you should have that installed as well.

Hosting - Azure Application Insights is part of the Hosting Suite, which is a complete Orchard DevOps technology suite for building and maintaining scalable Orchard applications.

The module was created by Lombiq, one of the core developers of Orchard itself.

Configuration

You can configure the module, including setting the AI instrumentation key from the admin site, for each tenant. You can also set an application-wide instrumentation key to be used by all tenants (if the module is enabled) in the static configuration (i.e. Web.config, Azure Portal) with the key shown in the Constants class.

To collect detailed dependency data and server resource information you'll need to install the AI Status Monitor (for VMs and local development) or the Application Insights site extension for Azure Web Apps. Be aware that both tools will add DLLs to the app and create an ApplicationInsights.config file, but neither are needed. To fix this remove the config file and re-deploy (or locally: delete Orchard.Web/bin and App_Data/Dependencies and re-build) the app.

Using the AI site extension is currently not supported, the extension needs to be modified.

Extending the module with custom telemetry data

You can send custom events (i.e. totally new events like a user action happening) through a TelemetryClient object (you can see examples for this in the official AI documentation). You can create such an object for the current configuration (i.e. what is also used to send request telemetry) through ITelemetryClientFactory.CreateTelemetryClientFromCurrentConfiguration().

You can also hook into the default behaviour of the module and e.g. extend what is send during request tracking by implementing the module's event handlers, see the Events folder/namespace. Particularly you can implement IRequestTrackingEventHandler to add custom data to the request telemetry e.g. by adding custom properties to the Properties dictionary. Furthermore you can implement ITelemetryConfigurationEventHandler to alter the configuration used by any telemetry-sending operation like adding your own ITelemetryInitializers to the TelemetryInitializers collection.

Note on assembly binding errors when using dynamic compilation

Note that when you modify this one or a dependent project in the Orchard solution and then refresh a page without doing a manual rebuild (i.e. letting Orchard's dynamic compilation do the job) you can get the following error:

Could not load file or assembly 'Microsoft.Diagnostics.Tracing.EventSource, Version=1.1.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

This is because on the fly assembly redirection (see below) doesn't work for some reason in such cases. To solve the issue simply restart the website (from IIS or by restarting IIS Express) after doing a manual build.

Updating AI libraries

When assembly binding redirects are changed make sure to also edit AssemblyRedirectSetupShellEventHandler that mimicks such redirects instead of relying on the Web.config.

Note that since there is a 260 characters limit on paths on Windows, all unused library folders and files should be removed and folders shortened.

After updating you can check for breaking changes between the old and new assembly versions with BitDiffer.

The module's source is available in two public source repositories, automatically mirrored in both directions with Git-hg Mirror:

Bug reports, feature requests and comments are warmly welcome, please do so via GitHub. Feel free to send pull requests too, no matter which source repository you choose for this purpose.

This project is developed by Lombiq Technologies Ltd. Commercial-grade support is available through Lombiq.