refactor: moving telemetry wip
This commit is contained in:
@@ -7,12 +7,12 @@ public class HostExtensionsTests
|
||||
{
|
||||
var builder = WebApplication.CreateBuilder();
|
||||
|
||||
builder.AddTelemetry(static () => new StevesBotWebhookInstrumentation());
|
||||
builder.AddTelemetry(static () => new TestInstrumentation());
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.Services
|
||||
.GetService<StevesBotWebhookInstrumentation>()
|
||||
.GetService<TestInstrumentation>()
|
||||
.Should()
|
||||
.BeNull();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class HostExtensionsTests
|
||||
|
||||
builder.Configuration.AddJsonStream(new MemoryStream(Encoding.UTF8.GetBytes(json)));
|
||||
|
||||
builder.AddTelemetry(static () => new StevesBotWebhookInstrumentation());
|
||||
builder.AddTelemetry(static () => new TestInstrumentation());
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@@ -62,4 +62,16 @@ public class HostExtensionsTests
|
||||
.Should()
|
||||
.NotBeNull();
|
||||
}
|
||||
|
||||
private class TestInstrumentation : IInstrumentation
|
||||
{
|
||||
public string SourceName { get; } = "TestSource";
|
||||
public string SourceVersion { get; } = "1.0.0";
|
||||
public ActivitySource Source { get; } = new ActivitySource("TestSource", "1.0.0");
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Source.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace StevesBot.Library.Tests.Unit;
|
||||
namespace StevesBot.Webhook.Tests.Unit;
|
||||
|
||||
public sealed class StevesBotWebhookInstrumentationTests : IDisposable
|
||||
{
|
||||
@@ -1,4 +1,5 @@
|
||||
global using System.Collections.Concurrent;
|
||||
global using System.Diagnostics;
|
||||
global using System.Net;
|
||||
global using System.Text;
|
||||
|
||||
@@ -13,6 +14,7 @@ global using RichardSzalay.MockHttp;
|
||||
|
||||
global using StevesBot.Library.Discord.Rest;
|
||||
global using StevesBot.Library.Discord.Rest.Requests;
|
||||
global using StevesBot.Webhook.Telemetry;
|
||||
global using StevesBot.Webhook.YouTube;
|
||||
global using StevesBot.Webhook.YouTube.Data;
|
||||
global using StevesBot.Webhook.YouTube.Handlers;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace StevesBot.Library.Tests.Unit;
|
||||
namespace StevesBot.Worker.Tests.Unit;
|
||||
|
||||
public sealed class StevesBotWorkerInstrumentationTests : IDisposable
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
global using System.Net;
|
||||
global using System.Diagnostics;
|
||||
global using System.Net.WebSockets;
|
||||
global using System.Text;
|
||||
global using System.Text.Json;
|
||||
@@ -14,9 +14,6 @@ global using Microsoft.Extensions.Logging;
|
||||
|
||||
global using Moq;
|
||||
|
||||
global using RichardSzalay.MockHttp;
|
||||
|
||||
global using StevesBot.Library.Discord;
|
||||
global using StevesBot.Library.Discord.Common;
|
||||
global using StevesBot.Library.Discord.Rest;
|
||||
global using StevesBot.Library.Discord.Rest.Requests;
|
||||
@@ -24,6 +21,7 @@ global using StevesBot.Worker.Discord;
|
||||
global using StevesBot.Worker.Discord.Gateway;
|
||||
global using StevesBot.Worker.Discord.Gateway.Events;
|
||||
global using StevesBot.Worker.Discord.Gateway.Events.Data;
|
||||
global using StevesBot.Worker.Telemetry;
|
||||
global using StevesBot.Worker.Tests.Integration.Infrastructure;
|
||||
global using StevesBot.Worker.Threading;
|
||||
global using StevesBot.Worker.WebSockets;
|
||||
Reference in New Issue
Block a user