This commit is contained in:
redglow
2026-07-27 19:51:17 +02:00
parent dad5027e0e
commit fc1df2f740
8 changed files with 38 additions and 21 deletions
+14 -5
View File
@@ -5,6 +5,7 @@ using GodotHostTest.AetherBind;
using GodotHostTest.Game.Target;
using GodotHostTest.Interfaces;
using OwofGames.AetherBind;
using OwofGames.GodotHost.Observability;
using OwofGames.GodotLume;
using ServiceSource = GodotHostTest.AetherBind.ServiceSource;
@@ -12,6 +13,7 @@ namespace GodotHostTest.Game.Level;
public partial class LevelServiceSource : ServiceSource
{
private Activity? _activityValue;
[Export] private TargetSpawner _targetSpawner = null!;
protected override void OnScopeCreated(IProvider serviceProvider)
@@ -21,14 +23,21 @@ public partial class LevelServiceSource : ServiceSource
[WithProvider]
private void OnScopeCreated(IValueSetter<ITargetCollector> targetCollector,
IValueSetter<ITargetSpawner> targetSpawner, ActivitySource activitySource, IValueSetter<Activity> activity)
IValueSetter<ITargetSpawner> targetSpawner, IActivitySourceFactory activitySourceFactory,
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);
_activityValue = activitySourceFactory.ActivitySource.StartActivity("Level") ??
throw new InvalidOperationException(
"No listeners for the activity - is OpenTelemetry running?");
activity.Set(_activityValue);
targetCollector.Set(_targetSpawner);
targetSpawner.Set(_targetSpawner);
}
public override void _Ready()
{
// after 3 seconds, dispose the activity for simulation purposes
GetTree().CreateTimer(3).Timeout += _activityValue!.Dispose;
}
}