From e8db31970bb9e69d799e3a9f1890557804722a8e Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 18 May 2021 15:16:25 -0700 Subject: [PATCH] Statistics as BinaryData property and parameter renames (#21164) --- .../api/Azure.Monitor.Query.netstandard2.0.cs | 18 +++++----- .../src/Generated/Models/LogsQueryResult.cs | 6 ++-- .../src/Generated/Models/Metric.cs | 20 +++++------ .../src/Generated/Models/MetricQueryResult.cs | 8 ++--- .../Azure.Monitor.Query/src/MetricsClient.cs | 36 +++++++++---------- .../src/Models/LogsQueryResult.cs | 8 +++-- .../Azure.Monitor.Query/src/Models/Metric.cs | 5 +++ .../src/Models/MetricQueryResult.cs | 4 +++ .../tests/LogsQueryClientClientLiveTests.cs | 10 +++--- .../tests/MetricsQueryClientLiveTests.cs | 18 +++++----- .../tests/MetricsTestData.cs | 2 +- 11 files changed, 72 insertions(+), 63 deletions(-) diff --git a/sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs b/sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs index 09cd56e04b3fa..4b547442ee034 100644 --- a/sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs +++ b/sdk/monitor/Azure.Monitor.Query/api/Azure.Monitor.Query.netstandard2.0.cs @@ -36,12 +36,12 @@ public partial class MetricsClient protected MetricsClient() { } public MetricsClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } public MetricsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Monitor.Query.MetricsClientOptions options) { } - public virtual Azure.Response> GetMetricNamespaces(string resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> GetMetricNamespacesAsync(string resource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response> GetMetrics(string resource, string metricsNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task>> GetMetricsAsync(string resource, string metricsNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Query(string resource, System.Collections.Generic.IEnumerable metrics, Azure.Monitor.Query.MetricsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> QueryAsync(string resource, System.Collections.Generic.IEnumerable metrics, Azure.Monitor.Query.MetricsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> GetMetricNamespaces(string resourceId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> GetMetricNamespacesAsync(string resourceId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response> GetMetrics(string resourceId, string metricsNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task>> GetMetricsAsync(string resourceId, string metricsNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Query(string resourceId, System.Collections.Generic.IEnumerable metrics, Azure.Monitor.Query.MetricsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> QueryAsync(string resourceId, System.Collections.Generic.IEnumerable metrics, Azure.Monitor.Query.MetricsQueryOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class MetricsClientOptions : Azure.Core.ClientOptions { @@ -75,7 +75,7 @@ public partial class LogsQueryResult { internal LogsQueryResult() { } public Azure.Monitor.Query.Models.LogsQueryResultTable PrimaryTable { get { throw null; } } - public System.Text.Json.JsonElement Statistics { get { throw null; } } + public System.BinaryData Statistics { get { throw null; } } public System.Collections.Generic.IReadOnlyList Tables { get { throw null; } } } public partial class LogsQueryResultColumn @@ -125,7 +125,7 @@ public partial class Metric internal Metric() { } public string Id { get { throw null; } } public string Name { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Timeseries { get { throw null; } } + public System.Collections.Generic.IReadOnlyList TimeSeries { get { throw null; } } public string Type { get { throw null; } } public Azure.Monitor.Query.Models.MetricUnit Unit { get { throw null; } } } @@ -173,7 +173,7 @@ internal MetricQueryResult() { } public System.TimeSpan? Interval { get { throw null; } } public System.Collections.Generic.IReadOnlyList Metrics { get { throw null; } } public string Namespace { get { throw null; } } - public string Resourceregion { get { throw null; } } + public string ResourceRegion { get { throw null; } } public Azure.Core.DateTimeRange TimeSpan { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.cs index c3131c58b9bab..71cd394105025 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/LogsQueryResult.cs @@ -22,12 +22,12 @@ internal LogsQueryResult() /// Initializes a new instance of LogsQueryResult. /// The list of tables, columns and rows. - /// Any object. + /// Any object. /// . - internal LogsQueryResult(IReadOnlyList tables, JsonElement statistics, ErrorDetails error) + internal LogsQueryResult(IReadOnlyList tables, JsonElement Statistics, ErrorDetails error) { Tables = tables; - Statistics = statistics; + _statistics = Statistics; Error = error; } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.cs index 288d3c55f0417..c44295676a2ec 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/Metric.cs @@ -19,9 +19,9 @@ public partial class Metric /// the resource type of the metric resource. /// the name and the display name of the metric, i.e. it is localizable string. /// the unit of the metric. - /// the time series returned when a data query is performed. - /// , , , or is null. - internal Metric(string id, string type, LocalizableString localizedName, MetricUnit unit, IEnumerable timeseries) + /// the time series returned when a data query is performed. + /// , , , or is null. + internal Metric(string id, string type, LocalizableString localizedName, MetricUnit unit, IEnumerable timeSeries) { if (id == null) { @@ -35,16 +35,16 @@ internal Metric(string id, string type, LocalizableString localizedName, MetricU { throw new ArgumentNullException(nameof(localizedName)); } - if (timeseries == null) + if (timeSeries == null) { - throw new ArgumentNullException(nameof(timeseries)); + throw new ArgumentNullException(nameof(timeSeries)); } Id = id; Type = type; LocalizedName = localizedName; Unit = unit; - Timeseries = timeseries.ToList(); + TimeSeries = timeSeries.ToList(); } /// Initializes a new instance of Metric. @@ -52,14 +52,14 @@ internal Metric(string id, string type, LocalizableString localizedName, MetricU /// the resource type of the metric resource. /// the name and the display name of the metric, i.e. it is localizable string. /// the unit of the metric. - /// the time series returned when a data query is performed. - internal Metric(string id, string type, LocalizableString localizedName, MetricUnit unit, IReadOnlyList timeseries) + /// the time series returned when a data query is performed. + internal Metric(string id, string type, LocalizableString localizedName, MetricUnit unit, IReadOnlyList timeSeries) { Id = id; Type = type; LocalizedName = localizedName; Unit = unit; - Timeseries = timeseries; + TimeSeries = timeSeries; } /// the metric Id. @@ -68,7 +68,5 @@ internal Metric(string id, string type, LocalizableString localizedName, MetricU public string Type { get; } /// the unit of the metric. public MetricUnit Unit { get; } - /// the time series returned when a data query is performed. - public IReadOnlyList Timeseries { get; } } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricQueryResult.cs index 4450617d403c2..2161a32b327ab 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Generated/Models/MetricQueryResult.cs @@ -38,15 +38,15 @@ internal MetricQueryResult(string Timespan, IEnumerable metrics) /// The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This may be adjusted in the future and returned back from what was originally requested. /// The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back from what was originally requested. This is not present if a metadata request was made. /// The namespace of the metrics been queried. - /// The region of the resource been queried for metrics. + /// The region of the resource been queried for metrics. /// the value of the collection. - internal MetricQueryResult(int? cost, string Timespan, TimeSpan? interval, string @namespace, string resourceregion, IReadOnlyList metrics) + internal MetricQueryResult(int? cost, string Timespan, TimeSpan? interval, string @namespace, string resourceRegion, IReadOnlyList metrics) { Cost = cost; _timespan = Timespan; Interval = interval; Namespace = @namespace; - Resourceregion = resourceregion; + ResourceRegion = resourceRegion; Metrics = metrics; } @@ -56,7 +56,5 @@ internal MetricQueryResult(int? cost, string Timespan, TimeSpan? interval, strin public TimeSpan? Interval { get; } /// The namespace of the metrics been queried. public string Namespace { get; } - /// The region of the resource been queried for metrics. - public string Resourceregion { get; } } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/MetricsClient.cs b/sdk/monitor/Azure.Monitor.Query/src/MetricsClient.cs index 9c1b882386d7f..8c5e1b3dc1dad 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/MetricsClient.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/MetricsClient.cs @@ -60,19 +60,19 @@ protected MetricsClient() /// /// Queries metrics for a resource. /// - /// The resource name. + /// The resource name. /// For example: /subscriptions/[subscription_id]/resourceGroups/[resource_group_name]/providers/Microsoft.OperationalInsights/workspaces/[workspace_name]. /// The list of metrics to query. /// The additional request options. /// The to use. /// The instance containing the query results. - public virtual Response Query(string resource, IEnumerable metrics, MetricsQueryOptions options = null, CancellationToken cancellationToken = default) + public virtual Response Query(string resourceId, IEnumerable metrics, MetricsQueryOptions options = null, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(MetricsClient)}.{nameof(Query)}"); scope.Start(); try { - return _metricsRestClient.List(resource, + return _metricsRestClient.List(resourceId, timespan: options?.TimeSpan?.ToString(), interval: options?.Interval, filter: options?.Filter, @@ -93,19 +93,19 @@ public virtual Response Query(string resource, IEnumerable /// Queries metrics for a resource. /// - /// The resource name. + /// The resource name. /// For example: /subscriptions/[subscription_id]/resourceGroups/[resource_group_name]/providers/Microsoft.OperationalInsights/workspaces/[workspace_name]. /// The list of metrics to query. /// The additional request options. /// The to use. /// The instance with query results. - public virtual async Task> QueryAsync(string resource, IEnumerable metrics, MetricsQueryOptions options = null, CancellationToken cancellationToken = default) + public virtual async Task> QueryAsync(string resourceId, IEnumerable metrics, MetricsQueryOptions options = null, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(MetricsClient)}.{nameof(Query)}"); scope.Start(); try { - return await _metricsRestClient.ListAsync(resource, + return await _metricsRestClient.ListAsync(resourceId, timespan: options?.TimeSpan?.ToString(), interval: options?.Interval, filter: options?.Filter, @@ -126,19 +126,19 @@ public virtual async Task> QueryAsync(string resourc /// /// Gets metric definitions for a particular resource and metric namespace. /// - /// The resource name. + /// The resource name. /// For example: /subscriptions/[subscription_id]/resourceGroups/[resource_group_name]/providers/Microsoft.OperationalInsights/workspaces/[workspace_name]. /// The metric namespace. /// For example: Microsoft.OperationalInsights/workspaces. /// The to use. /// A list of metric definitions. - public virtual Response> GetMetrics(string resource, string metricsNamespace, CancellationToken cancellationToken = default) + public virtual Response> GetMetrics(string resourceId, string metricsNamespace, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(MetricsClient)}.{nameof(GetMetrics)}"); scope.Start(); try { - var response = _metricDefinitionsClient.List(resource, metricsNamespace, cancellationToken); + var response = _metricDefinitionsClient.List(resourceId, metricsNamespace, cancellationToken); return Response.FromValue(response.Value.Value, response.GetRawResponse()); } @@ -152,19 +152,19 @@ public virtual Response> GetMetrics(string resou /// /// Gets metric definitions for a particular resource and metric namespace. /// - /// The resource name. + /// The resource name. /// For example: /subscriptions/[subscription_id]/resourceGroups/[resource_group_name]/providers/Microsoft.OperationalInsights/workspaces/[workspace_name]. /// The metric namespace. /// For example: Microsoft.OperationalInsights/workspaces. /// The to use. /// A list of metric definitions. - public virtual async Task>> GetMetricsAsync(string resource, string metricsNamespace, CancellationToken cancellationToken = default) + public virtual async Task>> GetMetricsAsync(string resourceId, string metricsNamespace, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(MetricsClient)}.{nameof(GetMetrics)}"); scope.Start(); try { - var response = await _metricDefinitionsClient.ListAsync(resource, metricsNamespace, cancellationToken).ConfigureAwait(false); + var response = await _metricDefinitionsClient.ListAsync(resourceId, metricsNamespace, cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value.Value, response.GetRawResponse()); } @@ -178,17 +178,17 @@ public virtual async Task>> GetMetricsA /// /// Gets metric namespaces for a particular resource. /// - /// The resource name. + /// The resource name. /// For example: /subscriptions/[subscription_id]/resourceGroups/[resource_group_name]/providers/Microsoft.OperationalInsights/workspaces/[workspace_name]. /// The to use. /// A list of metric namespaces. - public virtual Response> GetMetricNamespaces(string resource, CancellationToken cancellationToken = default) + public virtual Response> GetMetricNamespaces(string resourceId, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(MetricsClient)}.{nameof(GetMetricNamespaces)}"); scope.Start(); try { - var response = _namespacesRestClient.List(resource, cancellationToken: cancellationToken); + var response = _namespacesRestClient.List(resourceId, cancellationToken: cancellationToken); return Response.FromValue(response.Value.Value, response.GetRawResponse()); } @@ -202,16 +202,16 @@ public virtual Response> GetMetricNamespaces(stri /// /// Gets metric namespaces for a particular resource. /// - /// The resource name. + /// The resource name. /// The to use. /// A list of metric namespaces. - public virtual async Task>> GetMetricNamespacesAsync(string resource, CancellationToken cancellationToken = default) + public virtual async Task>> GetMetricNamespacesAsync(string resourceId, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(MetricsClient)}.{nameof(GetMetricNamespaces)}"); scope.Start(); try { - var response = await _namespacesRestClient.ListAsync(resource, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _namespacesRestClient.ListAsync(resourceId, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value.Value, response.GetRawResponse()); } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResult.cs index a605bd1450cdb..e68f19550358a 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/LogsQueryResult.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Linq; using System.Text.Json; using Azure.Core; @@ -10,18 +11,19 @@ namespace Azure.Monitor.Query.Models [CodeGenModel("QueryResults")] public partial class LogsQueryResult { + [CodeGenMember("Statistics")] + private readonly JsonElement _statistics; + // TODO: Handle not found /// /// Returns the primary result of the query. /// public LogsQueryResultTable PrimaryTable => Tables.Single(t => t.Name == "PrimaryResult"); -#pragma warning disable AZC0014 /// /// Returns the query statistics if the is set to true. /// - public JsonElement Statistics { get; } -#pragma warning restore AZC0014 + public BinaryData Statistics => _statistics.ValueKind == JsonValueKind.Undefined ? null : new BinaryData(_statistics.ToString()); internal ErrorDetails Error { get; } } diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/Metric.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/Metric.cs index 2c438c96ed8c3..e6641e903bbf7 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/Metric.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/Metric.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Collections.Generic; using Azure.Core; namespace Azure.Monitor.Query.Models @@ -12,5 +13,9 @@ public partial class Metric /// The name of the metric. public string Name => LocalizedName.Value; + + /// the time series returned when a data query is performed. + [CodeGenMember("Timeseries")] + public IReadOnlyList TimeSeries { get; } } } \ No newline at end of file diff --git a/sdk/monitor/Azure.Monitor.Query/src/Models/MetricQueryResult.cs b/sdk/monitor/Azure.Monitor.Query/src/Models/MetricQueryResult.cs index 40664e396aaa1..1eeecdf159517 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/Models/MetricQueryResult.cs +++ b/sdk/monitor/Azure.Monitor.Query/src/Models/MetricQueryResult.cs @@ -21,5 +21,9 @@ public partial class MetricQueryResult /// This may be adjusted in the future and returned back from what was originally requested. /// public DateTimeRange TimeSpan => DateTimeRange.Parse(_timespan); + + /// The region of the resource been queried for metrics. + [CodeGenMember("Resourceregion")] + public string ResourceRegion { get; } } } \ No newline at end of file diff --git a/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientClientLiveTests.cs b/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientClientLiveTests.cs index 70025c490d536..4d189af6e01f3 100644 --- a/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientClientLiveTests.cs +++ b/sdk/monitor/Azure.Monitor.Query/tests/LogsQueryClientClientLiveTests.cs @@ -451,11 +451,12 @@ public async Task CanQueryWithStatistics(bool include) if (include) { - Assert.Greater(response.Value.Statistics.GetProperty("query").GetProperty("executionTime").GetDouble(), 0); + using JsonDocument document = JsonDocument.Parse(response.Value.Statistics); + Assert.Greater(document.RootElement.GetProperty("query").GetProperty("executionTime").GetDouble(), 0); } else { - Assert.AreEqual(JsonValueKind.Undefined, response.Value.Statistics.ValueKind); + Assert.AreEqual(default, response.Value.Statistics); } } @@ -476,11 +477,12 @@ public async Task CanQueryWithStatisticsBatch(bool include) if (include) { - Assert.Greater(result.Statistics.GetProperty("query").GetProperty("executionTime").GetDouble(), 0); + using JsonDocument document = JsonDocument.Parse(result.Statistics); + Assert.Greater(document.RootElement.GetProperty("query").GetProperty("executionTime").GetDouble(), 0); } else { - Assert.AreEqual(JsonValueKind.Undefined, result.Statistics.ValueKind); + Assert.AreEqual(default, result.Statistics); } } diff --git a/sdk/monitor/Azure.Monitor.Query/tests/MetricsQueryClientLiveTests.cs b/sdk/monitor/Azure.Monitor.Query/tests/MetricsQueryClientLiveTests.cs index 343430dc05b93..c00426d5c7d52 100644 --- a/sdk/monitor/Azure.Monitor.Query/tests/MetricsQueryClientLiveTests.cs +++ b/sdk/monitor/Azure.Monitor.Query/tests/MetricsQueryClientLiveTests.cs @@ -60,7 +60,7 @@ public async Task CanQueryMetrics() TimeSpan = new DateTimeRange(_testData.StartTime, duration) }); - var timeSeriesData = results.Value.Metrics[0].Timeseries[0].Data; + var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; Assert.AreEqual(duration.Minutes, timeSeriesData.Count); // Average is queried by default Assert.True(timeSeriesData.All(d=> d.Average != null)); @@ -89,7 +89,7 @@ public async Task CanQueryMetricsAllAggregations() } }); - var timeSeriesData = results.Value.Metrics[0].Timeseries[0].Data; + var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; Assert.AreEqual(_testData.Duration.Minutes, timeSeriesData.Count); // Average is queried by default Assert.True(timeSeriesData.All(d=> @@ -114,7 +114,7 @@ public async Task CanQueryMetricsStartEnd() TimeSpan = new DateTimeRange(_testData.StartTime, _testData.EndTime), }); - var timeSeriesData = results.Value.Metrics[0].Timeseries[0].Data; + var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; Assert.AreEqual(_testData.Duration.Minutes, timeSeriesData.Count); Assert.True(timeSeriesData.All(d=> d.TimeStamp >= _testData.StartTime && d.TimeStamp <= _testData.EndTime)); @@ -134,7 +134,7 @@ public async Task CanQueryMetricsStartDuration() TimeSpan = new DateTimeRange(_testData.StartTime, _testData.Duration) }); - var timeSeriesData = results.Value.Metrics[0].Timeseries[0].Data; + var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; Assert.AreEqual(_testData.Duration.Minutes, timeSeriesData.Count); Assert.True(timeSeriesData.All(d=> d.TimeStamp >= _testData.StartTime && d.TimeStamp <= _testData.EndTime)); @@ -154,7 +154,7 @@ public async Task CanQueryMetricsDurationEnd() TimeSpan = new DateTimeRange(_testData.Duration, _testData.EndTime) }); - var timeSeriesData = results.Value.Metrics[0].Timeseries[0].Data; + var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; Assert.AreEqual(_testData.Duration.Minutes, timeSeriesData.Count); Assert.True(timeSeriesData.All(d=> d.TimeStamp >= _testData.StartTime && d.TimeStamp <= _testData.EndTime)); @@ -173,7 +173,7 @@ public async Task CanQueryMetricsNoTimespan() MetricNamespace = _testData.MetricNamespace }); - var timeSeriesData = results.Value.Metrics[0].Timeseries[0].Data; + var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; Assert.Greater(timeSeriesData.Count, 0); } @@ -192,7 +192,7 @@ public async Task CanQueryMetricsStartEndInterval() Interval = TimeSpan.FromMinutes(5) }); - var timeSeriesData = results.Value.Metrics[0].Timeseries[0].Data; + var timeSeriesData = results.Value.Metrics[0].TimeSeries[0].Data; Assert.AreEqual(_testData.Duration.Minutes / 5, timeSeriesData.Count); Assert.True(timeSeriesData.All(d=> d.TimeStamp >= _testData.StartTime && d.TimeStamp <= _testData.EndTime)); @@ -217,7 +217,7 @@ public async Task CanQueryMetricsFilter() } }); - var timeSeries = results.Value.Metrics[0].Timeseries[0]; + var timeSeries = results.Value.Metrics[0].TimeSeries[0]; Assert.AreEqual(_testData.Name1, timeSeries.Metadata["name"]); } @@ -241,7 +241,7 @@ public async Task CanQueryMetricsFilterTop() } }); - Assert.AreEqual(1, results.Value.Metrics[0].Timeseries.Count); + Assert.AreEqual(1, results.Value.Metrics[0].TimeSeries.Count); } [RecordedTest] diff --git a/sdk/monitor/Azure.Monitor.Query/tests/MetricsTestData.cs b/sdk/monitor/Azure.Monitor.Query/tests/MetricsTestData.cs index b398119e0cfd7..ffe277b25f19d 100644 --- a/sdk/monitor/Azure.Monitor.Query/tests/MetricsTestData.cs +++ b/sdk/monitor/Azure.Monitor.Query/tests/MetricsTestData.cs @@ -95,7 +95,7 @@ private async Task MetricsPropagated(MetricsClient metricClient) } }); - var timeSeries = metrics.Value.Metrics[0].Timeseries.FirstOrDefault(); + var timeSeries = metrics.Value.Metrics[0].TimeSeries.FirstOrDefault(); if (timeSeries == null) { return false;