feat: metrics test.

This commit is contained in:
redglow
2026-07-29 11:40:39 +02:00
parent 5c4519ed26
commit d268fff7b4
5 changed files with 64 additions and 2 deletions
+7 -1
View File
@@ -1,10 +1,12 @@
using Godot;
using GodotHostTest.AetherBind;
using GodotHostTest.Game.Level;
using GodotHostTest.Game.Metrics;
using GodotHostTest.Game.Score;
using GodotHostTest.Game.Target;
using GodotHostTest.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using OwofGames.GodotHost;
using OwofGames.GodotHost.Observability;
using OwofGames.GodotLume;
@@ -23,12 +25,16 @@ public partial class GameServiceSource : RootServiceSource
// current level / level data management
.AddInstance<ILevelDataProvider, LevelsData>(_levelsData)
.AddSingleton<ICurrentLevel, CurrentLevel>()
// metrics
.AddSingleton<IHostLifetime, MetricsHandler>()
// level scope services
.AddLevelServices();
}
protected override void ConfigureServices(IServiceCollection serviceCollection)
{
serviceCollection.AddObservability(builder => builder.AddGrpcExporter("http://localhost:4317"));
serviceCollection.AddObservability(builder => builder
.AddGrpcExporter("http://localhost:4317")
.AddMeterName(MetricsHandler.MeterName));
}
}