diff --git a/.idea/.idea.godot-host-test/.idea/jsonSchemas.xml b/.idea/.idea.godot-host-test/.idea/jsonSchemas.xml
new file mode 100644
index 0000000..cf9766f
--- /dev/null
+++ b/.idea/.idea.godot-host-test/.idea/jsonSchemas.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Game/Level/LevelServiceSource.cs b/Game/Level/LevelServiceSource.cs
index 07028b2..d129417 100644
--- a/Game/Level/LevelServiceSource.cs
+++ b/Game/Level/LevelServiceSource.cs
@@ -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 targetCollector,
- IValueSetter targetSpawner)
+ IValueSetter targetSpawner, ActivitySource activitySource, IValueSetter 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);
}
diff --git a/Game/Level/LevelServices.cs b/Game/Level/LevelServices.cs
index 23747cc..e6b83b5 100644
--- a/Game/Level/LevelServices.cs
+++ b/Game/Level/LevelServices.cs
@@ -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()
.AddInstance(levelsData)
+ // value provider for activity
+ .AddValueProvider()
// value providers to send data into level scope
.AddValueProvider()
// value provider for level scope setup
diff --git a/Game/Root/GameServiceSource.cs b/Game/Root/GameServiceSource.cs
index 300003c..0a3e562 100644
--- a/Game/Root/GameServiceSource.cs
+++ b/Game/Root/GameServiceSource.cs
@@ -3,6 +3,8 @@ using GodotHostTest.Game.Level;
using GodotHostTest.Game.Score;
using GodotHostTest.Game.Target;
using GodotHostTest.Interfaces;
+using Microsoft.Extensions.DependencyInjection;
+using OwofGames.AetherBind.Observability;
using OwofGames.GodotLume;
using RootServiceSource = GodotHostTest.AetherBind.RootServiceSource;
@@ -19,4 +21,9 @@ public partial class GameServiceSource : RootServiceSource
.AddSingleton()
.AddLevelServices(_levelsData);
}
+
+ protected override void ConfigureServices(IServiceCollection serviceCollection)
+ {
+ serviceCollection.AddObservability();
+ }
}
\ No newline at end of file
diff --git a/Game/Turret/Turret.cs b/Game/Turret/Turret.cs
index a36c880..e8595d1 100644
--- a/Game/Turret/Turret.cs
+++ b/Game/Turret/Turret.cs
@@ -1,5 +1,6 @@
using Godot;
using GodotHostTest.AetherBind;
+using Microsoft.Extensions.Logging;
using OwofGames.AetherBind;
namespace GodotHostTest.Game.Turret;
@@ -7,10 +8,12 @@ namespace GodotHostTest.Game.Turret;
public partial class Turret : Sprite2D
{
[Export] private Node2D _launcher = null!;
+ [Inject] private ILogger _logger = null!;
[Export] private PackedScene _projectilePackedScene = null!;
private double _rotationDirection;
[Export] private double _rotationSpeed = 6;
+
[Inject] private ISceneInstantiator _sceneInstantiator = null!;
private void OnTimerTimeout()
@@ -18,6 +21,7 @@ public partial class Turret : Sprite2D
var projectile = _sceneInstantiator.Instantiate(_projectilePackedScene);
projectile.Rotation = _launcher.Rotation;
AddChild(projectile);
+ _logger.LogInformation("Projectile launched.");
}
public override void _Input(InputEvent @event)
diff --git a/addons/AetherBind/RootServiceSource.cs b/addons/AetherBind/RootServiceSource.cs
index f86f023..ab3dc4b 100644
--- a/addons/AetherBind/RootServiceSource.cs
+++ b/addons/AetherBind/RootServiceSource.cs
@@ -34,10 +34,19 @@ public abstract partial class RootServiceSource : ServiceSource
.SetServiceProviderFactory(new LumeServiceProviderFactory(), Configure)
.Build();
+ // host startup
+ Host.Startup();
+
// resolve nodes
ResolveInjectedNodes(Host.ServiceProvider.GetRequiredService(), null);
}
+ public override void _ExitTree()
+ {
+ // async shutdown
+ Host.Shutdown();
+ }
+
private void InnerConfigure(IServiceCollection serviceCollection)
{
serviceCollection.AddTransient();
diff --git a/appsettings.json b/appsettings.json
new file mode 100644
index 0000000..fbbf415
--- /dev/null
+++ b/appsettings.json
@@ -0,0 +1,12 @@
+{
+ "Logging": {
+ "OpenTelemetry": {
+ "LogLevel": {
+ "Default": "Trace"
+ },
+ "IncludeFormattedMessage": true,
+ "IncludeScopes": true,
+ "ParseStateValues": true
+ }
+ }
+}
\ No newline at end of file
diff --git a/godot-host-test.csproj b/godot-host-test.csproj
index f70202f..1886943 100644
--- a/godot-host-test.csproj
+++ b/godot-host-test.csproj
@@ -7,9 +7,15 @@
enable
+
+
+
+
+ ..\OwofGames.Godot\OwofGames.AetherBind.Observability\bin\Debug\net8.0\OwofGames.AetherBind.Observability.dll
+
..\OwofGames.Godot\OwofGames.GodotHost\bin\Debug\net8.0\OwofGames.GodotHost.dll
@@ -33,6 +39,7 @@
+
diff --git a/godot-host-test.sln.DotSettings.user b/godot-host-test.sln.DotSettings.user
index 41e70a1..41ccc10 100644
--- a/godot-host-test.sln.DotSettings.user
+++ b/godot-host-test.sln.DotSettings.user
@@ -1,16 +1,34 @@
+ True
True
True
True
True
True
True
+ ForceIncluded
+ ForceIncluded
+ ForceIncluded
+ ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
+ ForceIncluded
+ ForceIncluded
+ ForceIncluded
+ ForceIncluded
+ ForceIncluded
+ ForceIncluded
+ ForceIncluded
+ ForceIncluded
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
+ <AssemblyExplorer>
+ <Assembly Path="/home/redglow/sources/OwofGames.Godot/OwofGames.AetherBind.Observability/bin/Debug/net8.0/OwofGames.AetherBind.Observability.dll" />
+</AssemblyExplorer>
/usr/lib/dotnet/dotnet
/usr/lib/dotnet/sdk/10.0.109/MSBuild.dll
\ No newline at end of file