add aspire for otel

This commit is contained in:
Matt Parker
2025-09-29 19:07:38 +10:00
parent b7029e7dce
commit e0ddcc55f2
16 changed files with 358 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
using Ardalis.GuardClauses;
using System.Diagnostics;
using Ardalis.GuardClauses;
using Microsoft.VisualStudio.SolutionPersistence.Model;
using Microsoft.VisualStudio.SolutionPersistence.Serializer;
@@ -9,6 +10,7 @@ public static class IntermediateMapper
internal static async Task<IntermediateSolutionModel> GetIntermediateModel(string solutionFilePath,
CancellationToken cancellationToken = default)
{
using var _ = SharpIdeOtel.Source.StartActivity();
var serializer = SolutionSerializers.GetSerializerByMoniker(solutionFilePath);
Guard.Against.Null(serializer, nameof(serializer));
var vsSolution = await serializer.OpenAsync(solutionFilePath, cancellationToken);

View File

@@ -6,6 +6,7 @@ public static class VsPersistenceMapper
{
public static async Task<SharpIdeSolutionModel> GetSolutionModel(string solutionFilePath, CancellationToken cancellationToken = default)
{
using var _ = SharpIdeOtel.Source.StartActivity();
var timer = Stopwatch.StartNew();
// This intermediate model is pretty much useless, but I have left it around as we grab the project nodes with it, which we might use later.
var intermediateModel = await IntermediateMapper.GetIntermediateModel(solutionFilePath, cancellationToken);

View File

@@ -0,0 +1,10 @@
using System.Diagnostics;
using System.Diagnostics.Metrics;
namespace SharpIDE.Application;
public static class SharpIdeOtel
{
public static readonly ActivitySource Source = new("SharpIde");
public static readonly Meter Meter = new("SharpIde");
}

View File

@@ -9,6 +9,8 @@ public partial class IdeDiagnosticsPanel : Control
{
_graphEdit = GetNode<GraphEdit>("%GraphEdit");
//_graphEdit.ConnectionRequest += GraphEditOnConnectionRequest;
//var graphNode = GetNode<Node>("%GraphNode");
}
// private void GraphEditOnConnectionRequest(StringName fromNode, long fromPort, StringName toNode, long toPort)

View File

@@ -1,5 +1,6 @@
using Godot;
using Microsoft.Build.Locator;
using Microsoft.Extensions.Hosting;
using SharpIDE.Application.Features.Analysis;
using SharpIDE.Application.Features.SolutionDiscovery;
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
@@ -30,6 +31,7 @@ public partial class IdeRoot : Control
public override void _Ready()
{
MSBuildLocator.RegisterDefaults();
GodotServiceDefaults.AddServiceDefaults();
_openSlnButton = GetNode<Button>("%OpenSlnButton");
_buildSlnButton = GetNode<Button>("%BuildSlnButton");

View File

@@ -6,6 +6,7 @@
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\tools\AspNetCoreServiceDefaults\AspNetCoreServiceDefaults.csproj" PrivateAssets="all" />
<ProjectReference Include="..\SharpIDE.Application\SharpIDE.Application.csproj" />
</ItemGroup>
<ItemGroup>