mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
got tracing and loggin working in opentelemetry
This commit is contained in:
@@ -10,13 +10,14 @@ global using LocalModels;
|
||||
global using Management.Planner;
|
||||
global using Management.Web.Shared.Components;
|
||||
global using Management.Web.Shared;
|
||||
global using Management.Web.Shared.Components.Forms;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using dotenv.net;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using OpenTelemetry.Logs;
|
||||
using OpenTelemetry.Metrics;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
DotEnv.Load();
|
||||
|
||||
@@ -32,6 +33,42 @@ if (canvas_url == null)
|
||||
Environment.SetEnvironmentVariable("CANVAS_URL", "https://snow.instructure.com");
|
||||
}
|
||||
|
||||
const string serviceName = "canvas-management";
|
||||
|
||||
// builder.Logging.AddOpenTelemetry(options =>
|
||||
// {
|
||||
// options
|
||||
// .SetResourceBuilder(
|
||||
// ResourceBuilder
|
||||
// .CreateDefault()
|
||||
// .AddService(serviceName)
|
||||
// )
|
||||
// .AddOtlpExporter(o =>
|
||||
// {
|
||||
// o.Endpoint = new Uri("http://localhost:4317/");
|
||||
// })
|
||||
// .AddConsoleExporter();
|
||||
// });
|
||||
|
||||
builder.Services.AddOpenTelemetry()
|
||||
.ConfigureResource(resource => resource.AddService(serviceName))
|
||||
.WithTracing(tracing => tracing
|
||||
.AddSource(DiagnosticsConfig.SourceName)
|
||||
.AddOtlpExporter(o =>
|
||||
{
|
||||
o.Endpoint = new Uri("http://localhost:4317/");
|
||||
})
|
||||
.AddAspNetCoreInstrumentation()
|
||||
.AddConsoleExporter()
|
||||
);
|
||||
// .WithMetrics(metrics => metrics
|
||||
// .AddOtlpExporter(o => {
|
||||
// o.Endpoint = new Uri("http://localhost:4317/");
|
||||
// })
|
||||
// .AddAspNetCoreInstrumentation()
|
||||
// .AddConsoleExporter()
|
||||
// );
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
@@ -59,7 +96,7 @@ builder.Services.AddScoped<DragContainer>();
|
||||
|
||||
builder.Services.AddSignalR(e =>
|
||||
{
|
||||
e.MaximumReceiveMessageSize = 102400000;
|
||||
e.MaximumReceiveMessageSize = 102400000;
|
||||
});
|
||||
|
||||
|
||||
@@ -90,7 +127,7 @@ var addresses = app.Services.GetService<IServer>()?.Features.Get<IServerAddresse
|
||||
|
||||
foreach (var address in addresses)
|
||||
{
|
||||
Console.WriteLine("Running at: " + address);
|
||||
Console.WriteLine("Running at: " + address);
|
||||
}
|
||||
|
||||
app.WaitForShutdown();
|
||||
app.WaitForShutdown();
|
||||
|
||||
Reference in New Issue
Block a user