diff --git a/Telemetry.Harness.Plugin/Probe.cs b/Telemetry.Harness.Plugin/Probe.cs new file mode 100644 index 0000000..47d780b --- /dev/null +++ b/Telemetry.Harness.Plugin/Probe.cs @@ -0,0 +1,51 @@ +using System.Globalization; +using Telemetry; + +namespace Telemetry.Harness.Plugin; + +public static class Probe +{ + public static string AssemblyName => typeof(Probe).Assembly.GetName().Name ?? "unknown"; + + public static string PluginName => PluginIdentity.Name; + + public static string SessionId => TelemetrySession.Id; + + public static string ReserveBudget(string fingerprint) => + TelemetryBudget.TryReserve(fingerprint).ToString(); + + public static string PrepareReport() + { + try + { + throw new InvalidOperationException("検証台からの報告です。"); + } + catch (Exception exception) + { + return TelemetryReporter.Prepare(exception, TelemetrySpool.Default).Decision.ToString(); + } + } + + public static string BuildEnvelope() + { + try + { + throw new InvalidOperationException("検証台からの報告です。"); + } + catch (Exception exception) + { + var captured = ExceptionCapture.Capture(exception, PluginIdentity.Assembly); + var envelope = SentryEnvelope.Build( + Guid.NewGuid().ToString("N"), + captured, + "error", + DateTimeOffset.UtcNow); + + return System.Text.Encoding.UTF8.GetString(envelope); + } + } + + public static string Describe() => string.Create( + CultureInfo.InvariantCulture, + $"{AssemblyName} plugin={PluginName} session={SessionId}"); +} diff --git a/Telemetry.Harness.PluginA/Telemetry.Harness.PluginA.csproj b/Telemetry.Harness.PluginA/Telemetry.Harness.PluginA.csproj new file mode 100644 index 0000000..bf4847c --- /dev/null +++ b/Telemetry.Harness.PluginA/Telemetry.Harness.PluginA.csproj @@ -0,0 +1,24 @@ + + + + + + net10.0-windows10.0.19041.0 + true + enable + enable + false + + + + + + + + + $(YMM4DirPath)YukkuriMovieMaker.Plugin.dll + false + + + + diff --git a/Telemetry.Harness.PluginB/Telemetry.Harness.PluginB.csproj b/Telemetry.Harness.PluginB/Telemetry.Harness.PluginB.csproj new file mode 100644 index 0000000..bf4847c --- /dev/null +++ b/Telemetry.Harness.PluginB/Telemetry.Harness.PluginB.csproj @@ -0,0 +1,24 @@ + + + + + + net10.0-windows10.0.19041.0 + true + enable + enable + false + + + + + + + + + $(YMM4DirPath)YukkuriMovieMaker.Plugin.dll + false + + + +