5 instantiations of AgentTelemetryHook
Aspire.Cli.Tests (5)
Agents\AgentTelemetryHookTests.cs (5)
87
var hook = new
AgentTelemetryHook
(new TestEnvironment());
106
var hook = new
AgentTelemetryHook
(new TestEnvironment(new Dictionary<string, string?>
155
var hook = new
AgentTelemetryHook
(new TestEnvironment(new Dictionary<string, string?>
304
var hook = new
AgentTelemetryHook
(new TestEnvironment(new Dictionary<string, string?>
328
var hook = new
AgentTelemetryHook
(new TestEnvironment(new Dictionary<string, string?>
52 references to AgentTelemetryHook
aspire (9)
Agents\ClaudeCode\ClaudeCodeAgentClient.cs (3)
28
internal static string TelemetryHookMcpMatcher { get; } = $"^(?:{
AgentTelemetryHook
.McpMatcher})$";
215
var (command, args) =
AgentTelemetryHook
.GetCommand(AgentTelemetryProtocol.HookOptionName);
277
var (currentCommand, _) =
AgentTelemetryHook
.GetCommand(AgentTelemetryProtocol.HookOptionName);
Agents\Copilot\CopilotAgentClient.cs (2)
41
internal static string TelemetryHookMatcher { get; } = $"^(?:[Ss]kill|{
AgentTelemetryHook
.McpMatcher})$";
150
var (command, args) =
AgentTelemetryHook
.GetCommand(AgentTelemetryProtocol.HookOptionName);
Commands\AgentTelemetryCommand.cs (2)
36
private readonly
AgentTelemetryHook
_hook;
93
AgentTelemetryHook
hook, IEnvironment environment, ConsoleEnvironment console)
Program.cs (1)
749
builder.Services.AddSingleton<Agents.Hooks.
AgentTelemetryHook
>();
Telemetry\AgentTelemetryUploader.cs (1)
40
var (command, args) =
AgentTelemetryHook
.GetCommand(AgentTelemetryProtocol.DrainOptionName);
Aspire.Cli.Tests (43)
Agents\AgentTelemetryHookTests.cs (36)
23
Assert.Null(
AgentTelemetryHook
.Classify(payload, new TestEnvironment(),
AgentTelemetryHook
.DefaultMaxPayloadCharacters));
33
var args =
AgentTelemetryHook
.Classify($$"""{"{{nameProperty}}":"{{tool}}","{{inputProperty}}":{{input}}}""", new TestEnvironment(),
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
47
var args =
AgentTelemetryHook
.Classify(
50
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
67
var args =
AgentTelemetryHook
.Classify(
70
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
80
Assert.NotNull(
AgentTelemetryHook
.Classify(payload, new TestEnvironment(), payload.Length));
81
Assert.Null(
AgentTelemetryHook
.Classify(payload, new TestEnvironment(), payload.Length - 1));
87
var
hook = new AgentTelemetryHook(new TestEnvironment());
106
var
hook = new AgentTelemetryHook(new TestEnvironment(new Dictionary<string, string?>
123
var args =
AgentTelemetryHook
.Classify("""{"toolName":"aspire-list_resources","toolArgs":"not json"}""", new TestEnvironment(),
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
134
var args =
AgentTelemetryHook
.Classify(
136
new TestEnvironment(),
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
155
var
hook = new AgentTelemetryHook(new TestEnvironment(new Dictionary<string, string?>
226
Assert.NotNull(
AgentTelemetryHook
.Classify(
229
AgentTelemetryHook
.DefaultMaxPayloadCharacters));
243
Assert.NotNull(
AgentTelemetryHook
.Classify(
246
AgentTelemetryHook
.DefaultMaxPayloadCharacters));
261
using var stream = typeof(
AgentTelemetryHook
).Assembly.GetManifestResourceStream("track-telemetry.ps1")!;
276
[InlineData(null,
AgentTelemetryHook
.DefaultMaxPayloadCharacters)]
279
[InlineData("1048576",
AgentTelemetryHook
.MaximumPayloadCharacters)]
282
Assert.Equal(expected,
AgentTelemetryHook
.GetMaxPayloadCharacters(value));
294
var exception = Assert.Throws<ArgumentException>(() =>
AgentTelemetryHook
.GetMaxPayloadCharacters(value));
295
Assert.Contains(
AgentTelemetryHook
.PayloadLimitEnvironmentVariable, exception.Message);
304
var
hook = new AgentTelemetryHook(new TestEnvironment(new Dictionary<string, string?>
306
[
AgentTelemetryHook
.PayloadLimitEnvironmentVariable] = payload.Length.ToString(System.Globalization.CultureInfo.InvariantCulture)
328
var
hook = new AgentTelemetryHook(new TestEnvironment(new Dictionary<string, string?>
330
[
AgentTelemetryHook
.PayloadLimitEnvironmentVariable] = "0"
337
Assert.Contains(
AgentTelemetryHook
.PayloadLimitEnvironmentVariable, error.ToString());
345
var padded = payload.PadRight(
AgentTelemetryHook
.DefaultMaxPayloadCharacters + 1);
346
Assert.Null(
AgentTelemetryHook
.Classify(padded, new TestEnvironment(),
AgentTelemetryHook
.DefaultMaxPayloadCharacters));
347
Assert.NotNull(
AgentTelemetryHook
.Classify(padded, new TestEnvironment(), padded.Length));
Agents\TelemetryHookConfiguratorTests.cs (4)
39
var (command, args) =
AgentTelemetryHook
.GetCommand("--hook");
201
var (command, args) =
AgentTelemetryHook
.GetCommand("--hook");
294
var (command, args) =
AgentTelemetryHook
.GetCommand("--hook");
379
var (command, args) =
AgentTelemetryHook
.GetCommand("--hook");
Agents\TelemetryHookScriptTests.cs (2)
552
? null :
AgentTelemetryHook
.Classify(payload, nativeEnvironment,
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
Utils\CliTestHelper.cs (1)
146
services.AddSingleton<
AgentTelemetryHook
>();