5 instantiations of AgentTelemetryHook
Aspire.Cli.Tests (5)
Agents\AgentTelemetryHookTests.cs (5)
45
var hook = new
AgentTelemetryHook
(new TestEnvironment());
64
var hook = new
AgentTelemetryHook
(new TestEnvironment(new Dictionary<string, string?>
109
var hook = new
AgentTelemetryHook
(new TestEnvironment(new Dictionary<string, string?>
176
var hook = new
AgentTelemetryHook
(new TestEnvironment(new Dictionary<string, string?>
200
var hook = new
AgentTelemetryHook
(new TestEnvironment(new Dictionary<string, string?>
42 references to AgentTelemetryHook
aspire (7)
Agents\Hooks\TelemetryHookConfigurator.cs (3)
137
var (command, args) =
AgentTelemetryHook
.GetCommand(AgentTelemetryProtocol.HookOptionName);
255
var (command, args) =
AgentTelemetryHook
.GetCommand(AgentTelemetryProtocol.HookOptionName);
341
var (currentCommand, _) =
AgentTelemetryHook
.GetCommand(AgentTelemetryProtocol.HookOptionName);
Commands\AgentTelemetryCommand.cs (2)
35
private readonly
AgentTelemetryHook
_hook;
93
AgentTelemetryHook
hook, IEnvironment environment, ConsoleEnvironment console, IServiceProvider serviceProvider)
Program.cs (1)
689
builder.Services.AddSingleton<Agents.Hooks.
AgentTelemetryHook
>();
Telemetry\AgentTelemetryUploader.cs (1)
42
var (command, args) =
AgentTelemetryHook
.GetCommand(AgentTelemetryProtocol.DrainOptionName);
Aspire.Cli.Tests (35)
Agents\AgentTelemetryHookTests.cs (28)
20
Assert.Null(
AgentTelemetryHook
.Classify(payload, false,
AgentTelemetryHook
.DefaultMaxPayloadCharacters));
28
var args =
AgentTelemetryHook
.Classify($$"""{"{{nameProperty}}":"{{tool}}","{{inputProperty}}":{{input}}}""", true,
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
38
Assert.NotNull(
AgentTelemetryHook
.Classify(payload, false, payload.Length));
39
Assert.Null(
AgentTelemetryHook
.Classify(payload, false, payload.Length - 1));
45
var
hook = new AgentTelemetryHook(new TestEnvironment());
64
var
hook = new AgentTelemetryHook(new TestEnvironment(new Dictionary<string, string?>
81
var args =
AgentTelemetryHook
.Classify("""{"toolName":"aspire-list_resources","toolArgs":"not json"}""", true,
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
92
var args =
AgentTelemetryHook
.Classify(
94
true,
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
109
var
hook = new AgentTelemetryHook(new TestEnvironment(new Dictionary<string, string?>
133
using var stream = typeof(
AgentTelemetryHook
).Assembly.GetManifestResourceStream("track-telemetry.ps1")!;
148
[InlineData(null,
AgentTelemetryHook
.DefaultMaxPayloadCharacters)]
151
[InlineData("1048576",
AgentTelemetryHook
.MaximumPayloadCharacters)]
154
Assert.Equal(expected,
AgentTelemetryHook
.GetMaxPayloadCharacters(value));
166
var exception = Assert.Throws<ArgumentException>(() =>
AgentTelemetryHook
.GetMaxPayloadCharacters(value));
167
Assert.Contains(
AgentTelemetryHook
.PayloadLimitEnvironmentVariable, exception.Message);
176
var
hook = new AgentTelemetryHook(new TestEnvironment(new Dictionary<string, string?>
178
[
AgentTelemetryHook
.PayloadLimitEnvironmentVariable] = payload.Length.ToString(System.Globalization.CultureInfo.InvariantCulture)
200
var
hook = new AgentTelemetryHook(new TestEnvironment(new Dictionary<string, string?>
202
[
AgentTelemetryHook
.PayloadLimitEnvironmentVariable] = "0"
209
Assert.Contains(
AgentTelemetryHook
.PayloadLimitEnvironmentVariable, error.ToString());
217
var padded = payload.PadRight(
AgentTelemetryHook
.DefaultMaxPayloadCharacters + 1);
218
Assert.Null(
AgentTelemetryHook
.Classify(padded, false,
AgentTelemetryHook
.DefaultMaxPayloadCharacters));
219
Assert.NotNull(
AgentTelemetryHook
.Classify(padded, false, padded.Length));
Agents\TelemetryHookConfiguratorTests.cs (4)
37
var (command, args) =
AgentTelemetryHook
.GetCommand("--hook");
98
var (command, args) =
AgentTelemetryHook
.GetCommand("--hook");
173
Assert.Equal(
AgentTelemetryHook
.GetCommand("--hook").Args,
237
var (command, args) =
AgentTelemetryHook
.GetCommand("--hook");
Agents\TelemetryHookScriptTests.cs (2)
541
? null :
AgentTelemetryHook
.Classify(payload, nativeEnvironment.IsFlagEnabled("COPILOT_CLI"),
AgentTelemetryHook
.DefaultMaxPayloadCharacters);
Utils\CliTestHelper.cs (1)
140
services.AddSingleton<
AgentTelemetryHook
>();