57 references to InstrumentViewModel
Aspire.Dashboard (42)
Components\Controls\Chart\ChartBase.cs (36)
87InstrumentViewModel.AddDataUpdateSubscription(OnInstrumentDataUpdate); 93InstrumentViewModel.Instrument is null || 94InstrumentViewModel.MatchedDimensions is null || 111var dimensionAttributes = InstrumentViewModel.MatchedDimensions.Select(d => d.Attributes).ToList(); 116if (_renderedInstrument is null || _renderedInstrument != InstrumentViewModel.Instrument.GetKey() || 117_renderedInstrumentUnit != InstrumentViewModel.Instrument.Unit || 118_renderedInstrumentType != InstrumentViewModel.Instrument.Type || 119_renderedInstrumentIsMonotonic != InstrumentViewModel.Instrument.IsMonotonic || 121_renderedTheme != InstrumentViewModel.Theme || 122_renderedShowCount != InstrumentViewModel.ShowCount || 123_renderedShowRunningTotal != InstrumentViewModel.ShowRunningTotal) 126_renderedInstrument = InstrumentViewModel.Instrument.GetKey(); 127_renderedInstrumentUnit = InstrumentViewModel.Instrument.Unit; 128_renderedInstrumentType = InstrumentViewModel.Instrument.Type; 129_renderedInstrumentIsMonotonic = InstrumentViewModel.Instrument.IsMonotonic; 131_renderedTheme = InstrumentViewModel.Theme; 132_renderedShowCount = InstrumentViewModel.ShowCount; 133_renderedShowRunningTotal = InstrumentViewModel.ShowRunningTotal; 186return $"<b>{HttpUtility.HtmlEncode(InstrumentViewModel.Instrument?.Name)}</b><br />{HttpUtility.HtmlEncode(name)}: {FormatHelpers.FormatNumberWithOptionalDecimalPlaces(yValue, maxDecimalPlaces: 6, CultureInfo.CurrentCulture)}<br />Time: {FormatHelpers.FormatTime(TimeProvider, xValue)}"; 195Debug.Assert(InstrumentViewModel.MatchedDimensions != null); 196Debug.Assert(InstrumentViewModel.Instrument != null); 198var unit = !InstrumentViewModel.ShowCount 199? GetDisplayedUnit(InstrumentViewModel.Instrument) 202var showChangePerInterval = ChartDataCalculator.IsMonotonicCounter(InstrumentViewModel.Instrument) && !InstrumentViewModel.ShowRunningTotal; 212if (InstrumentViewModel.Instrument?.Type != OtlpInstrumentType.Histogram || InstrumentViewModel.ShowCount) 214data = calculator.CalculateChartValues(InstrumentViewModel.MatchedDimensions, _currentDataStartTime, TimeProvider.ToLocalDateTimeOffset, unit); 224var increases = calculator.CalculateCounterIncreaseValues(InstrumentViewModel.MatchedDimensions, _currentDataStartTime, InstrumentViewModel.Instrument!.AggregationTemporality); 233data = calculator.CalculateHistogramValues(InstrumentViewModel.MatchedDimensions, _currentDataStartTime, TimeProvider.ToLocalDateTimeOffset, unit); 236var instrumentChanged = InstrumentViewModel.HasIncompatibleHistogramBounds != data.HasIncompatibleHistogramBounds || 237_renderedHasOverflow != InstrumentViewModel.HasOverflow; 238InstrumentViewModel.HasIncompatibleHistogramBounds = data.HasIncompatibleHistogramBounds; 239_renderedHasOverflow = InstrumentViewModel.HasOverflow; 356InstrumentViewModel.RemoveDataUpdateSubscription(OnInstrumentDataUpdate);
Components\Controls\Chart\MetricTable.razor.cs (5)
50if (!Equals(_instrument?.Name, InstrumentViewModel.Instrument?.Name) || _showCount != InstrumentViewModel.ShowCount) 57_instrument = InstrumentViewModel.Instrument; 58_showCount = InstrumentViewModel.ShowCount; 105Instrument = InstrumentViewModel.Instrument!
Components\Controls\Chart\PlotlyChart.razor.cs (1)
47if (InstrumentViewModel?.Instrument is { } instrument)
Aspire.Dashboard.Components.Tests (15)
Controls\PlotlyChartTests.cs (6)
59builder.Add(p => p.InstrumentViewModel, model); 95builder.Add(p => p.InstrumentViewModel, model); 152builder.Add(p => p.InstrumentViewModel, model); 210builder.Add(p => p.InstrumentViewModel, model); 269builder.Add(p => p.InstrumentViewModel, model); 319builder.Add(p => p.InstrumentViewModel, model);
Pages\MetricsTests.cs (9)
138? cut.FindComponent<PlotlyChart>().Instance.InstrumentViewModel 139: cut.FindComponent<MetricTable>().Instance.InstrumentViewModel; 152Assert.True(cut.FindComponent<PlotlyChart>().Instance.InstrumentViewModel.ShowCount); 160Assert.True(cut.FindComponent<MetricTable>().Instance.InstrumentViewModel.ShowCount); 266var instrumentViewModel = table.Instance.InstrumentViewModel; 631var dimensions = chart.Instance.InstrumentViewModel.MatchedDimensions!; 686Assert.Equal(!showOption, cut.FindComponent<MetricTable>().Instance.InstrumentViewModel.ShowRunningTotal); 744Assert.Equal("instrument-2", updatedTable.Instance.InstrumentViewModel.Instrument?.Name); 745Assert.NotEmpty(updatedTable.Instance.InstrumentViewModel.MatchedDimensions!);