You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having issues generating SQL traces in my .NET Framework application....
I created a POC console app to use the OpenTelemtry SqlClient Instrumentation in net472 using SQL Instrumentation 1.0.0-rc9.7 and was unable to generate any SQL traces. I tried again using .NET Core and the same console app generates a SQL trace. I also tested using net481. Any ideas?
using System;
using System.Data.SqlClient;
using OpenTelemetry.Trace;
using OpenTelemetry;
namespace ConsoleApp1
{
internal class Program
{
static void Main(string[] args)
{
using (var tracerProvider = Sdk.CreateTracerProviderBuilder()
.AddSqlClientInstrumentation()
.AddConsoleExporter()
.AddOtlpExporter(o =>
{
o.Endpoint = new Uri("http://localhost:4318/v1/traces");
o.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.HttpProtobuf;
o.ExportProcessorType = ExportProcessorType.Batch;
})
.Build());
using (SqlConnection con = new SqlConnection("data source=(localdb)\\mssqllocaldb;Initial Catalog=Test;Integrated Security=True;"))
{
con.Open();
SqlCommand cmd = new SqlCommand("Select * From dbo.Test", con);
var rdr = cmd.ExecuteReader();
rdr.Close();
}
}
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Having issues generating SQL traces in my .NET Framework application....
I created a POC console app to use the OpenTelemtry SqlClient Instrumentation in net472 using SQL Instrumentation 1.0.0-rc9.7 and was unable to generate any SQL traces. I tried again using .NET Core and the same console app generates a SQL trace. I also tested using net481. Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions