feat: hooking observability.

This commit is contained in:
redglow
2026-07-25 22:26:07 +02:00
parent bc7297c6bc
commit dad5027e0e
9 changed files with 93 additions and 1 deletions
+8 -1
View File
@@ -1,3 +1,5 @@
using System;
using System.Diagnostics;
using Godot;
using GodotHostTest.AetherBind;
using GodotHostTest.Game.Target;
@@ -19,8 +21,13 @@ public partial class LevelServiceSource : ServiceSource
[WithProvider]
private void OnScopeCreated(IValueSetter<ITargetCollector> targetCollector,
IValueSetter<ITargetSpawner> targetSpawner)
IValueSetter<ITargetSpawner> targetSpawner, ActivitySource activitySource, IValueSetter<Activity> activity)
{
// ReSharper disable once ExplicitCallerInfoArgument - the caller name is not significant in this case
var activityValue = activitySource.StartActivity("Level") ??
throw new InvalidOperationException(
"No listeners for the activity - is OpenTelemetry running?");
activity.Set(activityValue);
targetCollector.Set(_targetSpawner);
targetSpawner.Set(_targetSpawner);
}
+3
View File
@@ -1,3 +1,4 @@
using System.Diagnostics;
using GodotHostTest.AetherBind;
using GodotHostTest.Interfaces;
using OwofGames.GodotLume;
@@ -12,6 +13,8 @@ public static class LevelServices
// current level / level data management
.AddSingleton<ICurrentLevel, CurrentLevel>()
.AddInstance<ILevelDataProvider, LevelsData>(levelsData)
// value provider for activity
.AddValueProvider<Activity, LevelScope>()
// value providers to send data into level scope
.AddValueProvider<ILevel, RootScope, LevelScope>()
// value provider for level scope setup