10 instantiations of MetricPin
Aspire.Dashboard (1)
Model\MetricPinStore.cs (1)
91
? AddPin(pins, new
MetricPin
(name, key.MeterName, key.InstrumentName))
Aspire.Dashboard.Components.Tests (7)
Pages\MetricsTests.cs (7)
399
savedPins.AddRange(Enumerable.Range(1, 49).Select(i => new
MetricPin
($"other-{i}", "test-meter", "requests")));
400
savedPins.Add(new
MetricPin
(resources[0], "test-meter", "requests"));
874
Assert.Equal([new
MetricPin
("app1", "test-meter", "requests"), new
MetricPin
("app2", "test-meter", "requests")], store.GetPins());
919
[new
MetricPin
("api", "test-meter", "requests"), new
MetricPin
("worker", "test-meter", "requests")], store.GetPins()));
1989
Assert.Equal([new
MetricPin
("TestApp", "test-meter", "test-instrument-b")], Services.GetRequiredService<MetricPinStore>().GetPins());
Aspire.Dashboard.Tests (2)
Integration\StartupTests.cs (1)
103
.Select(i => new
MetricPin
(new string('r', 62) + i.ToString("D2", CultureInfo.InvariantCulture),
Model\MetricPinStoreTests.cs (1)
197
private static MetricPin Pin(string resourceName, OtlpInstrumentKey key) =>
new
(resourceName, key.MeterName, key.InstrumentName);
17 references to MetricPin
Aspire.Dashboard (10)
Model\MetricPinStore.cs (9)
16
/// An instrument is pinned for a resource (see <see cref="
MetricPin
"/>). Pinning applies to the resources of the current
32
private readonly LocalStorageSetting<List<
MetricPin
>> _setting;
55
public IReadOnlyList<
MetricPin
> GetPins() => _setting.Read(pins => pins.ToArray());
107
private static bool AddPin(List<
MetricPin
> pins,
MetricPin
pin)
119
private static List<
MetricPin
> NormalizePins(List<
MetricPin
>? stored)
121
var pins = new List<
MetricPin
>();
122
foreach (
var
pin in stored ?? [])
Serialization\DashboardJsonSerializerContext.cs (1)
43
[JsonSerializable(typeof(List<
MetricPin
>))]
Aspire.Dashboard.Components.Tests (3)
Pages\MetricsTests.cs (3)
390
var savedPins = new List<
MetricPin
>();
411
var stored = await storage.GetAsync<List<
MetricPin
>>(storageKey);
419
Assert.Equal(savedPins.Take(49), (await storage.GetAsync<List<
MetricPin
>>(storageKey)).Value);
Aspire.Dashboard.Tests (4)
Model\MetricPinStoreTests.cs (4)
38
Assert.True((await _browser.Storage.GetUnprotectedAsync<List<
MetricPin
>>(s_storageKey)).InvalidValue);
176
await _browser.Storage.SetUnprotectedAsync<List<
MetricPin
>>(s_storageKey, [Pin("api", s_heap)]);
191
await _browser.Storage.SetAsync<List<
MetricPin
>>(s_storageKey, [Pin("", s_heap), Pin("api", s_cpu)]);
197
private static
MetricPin
Pin(string resourceName, OtlpInstrumentKey key) => new(resourceName, key.MeterName, key.InstrumentName);