Notes on my part of the EWCW Cloud talk

Maybe you listened in to the Cloud talk on Monday of the Episerver World Community Week and wondered what I was talking about?

Note that the page on World now has a video recording of the session.

CD with the EpiCloud PowerShell Module

The DXP Deployment API documentation section on World is easy to follow so be sure to read up and start using it.

A KQL example

Run in Application Insights Logs section.

// Total requests to app per day
let start=startofday(datetime("2020-09-01"));
let end=endofday(datetime("2020-09-23"));
let timeGrain=1d;
| where timestamp > start and timestamp < end and client_Type != "Browser"
| summarize count_=sum(itemCount) by bin(timestamp, timeGrain)
| render timechart

Trace with custom properties

This is a nice blog post on how to do custom tracing with Application Insights. Doing custom events is very similar.

W3C Trace Context for Telemetry Correlation

W3C Trace Context offers correlation between layers and applications with Application Insights and also between other APM services such as Elastic APM or New Relic.

The specification:

Application Insights is transitioning to W3C Trace Context and this will likely be more straight-forward later but for a typical Epi DXP app currently:

Install System.Diagnostics.DiagnosticSource 4.7 or later, and Microsoft.ApplicationInsights 2.8 or later.

Then set on app startup:

Activity.ForceDefaultIdFormat = true;
Activity.DefaultIdFormat = ActivityIdFormat.W3C;

You can then check Activity.Current to see the ID of the ongoing request that your telemetry gets automatically.

If you don't see IDs in the remote app you might need to add the headers to the outbound call yourself, check this source code of the System.Net.Http.DiagnosticsHandler to see how it could be done.

Published and tagged with these categories: Episerver, ASP.NET, Development