Skip to content

Instantly share code, notes, and snippets.

@Geertvdc
Last active January 31, 2019 07:40
Show Gist options
  • Save Geertvdc/12d112232ea37baee569a6ef679ca138 to your computer and use it in GitHub Desktop.
Save Geertvdc/12d112232ea37baee569a6ef679ca138 to your computer and use it in GitHub Desktop.
App insights telemetry
var telemetry = new DependencyTelemetry
{
Type = "type",
Name = nameof(CalculationCycle)
};
telemetry.Start();
telemetry.Context.Operation.Id = telemetry.Id;
telemetry.Context.Operation.ParentId = telemetry.Id;
try
{
//do stuff that takes long time
telemetry.Success = true;
}
finally
{
telemetry.Stop();
TelemetryClient c = new TelemetryClient();
c.Track(telemetry);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment