TILT–Telemetry–part 11
I want to see what is happening in my application – i.e. having the Stack Trace for any kind of errors.
I have add with
[AutoMethods(CustomTemplateFileName = "../AutoMethod.txt", MethodPrefix = "auto", template = TemplateMethod.CustomTemplateFile)] [AutoGenerateInterface] public partial class AuthUrl : IAuthUrl { [AOPMarkerMethod] private async Task<string?> privateLogin(string url, string secret) { //code
And inside the method
var act=Activity.Current; using var span = MyActivitySource.StartActivity("{{mi.NewName}}", ActivityKind.Client,act?.Context??default(ActivityContext)); { try{ //call original method } catch(Exception ex){ span?.RecordException(ex); span?.SetTag("exceptionMessage",ex.Message); span?.SetStatus(Status.Error); throw; } finally{ span?.Stop(); }
The final result is ( showing an error into the database)
Tools used
AppInsights
Powershell ( AOPMethods.ps1)
OpenTelemetry.Api
OpenTelemetry.Contrib.Instrumentation.EntityFrameworkCore
OpenTelemetry.Extensions.Hosting
Azure.Monitor.OpenTelemetry.Exporter
OpenTelemetry.Instrumentation.AspNetCore
OpenTelemetry.Instrumentation.Http
OpenTelemetry.Instrumentation.SqlClient
Visual Studio
Leave a Reply