From b2b3bb7d91d1d6c98062a0222ce38601ac77b402 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Thu, 12 Nov 2020 10:40:10 +1000 Subject: [PATCH] Updates for Seq 2020.4 --- .../Model/Diagnostics/ServerMetricsEntity.cs | 10 +++++ .../Storage/ColumnDescriptionPart.cs | 33 +++++++++++++++ .../Model/Diagnostics/Storage/ColumnType.cs | 19 +++++++++ .../Model/Diagnostics/Storage/RowsetPart.cs | 19 +++++++++ .../Storage/StorageConsumptionPart.cs | 41 +++++++++++++++++++ src/Seq.Api/Model/License/LicenseEntity.cs | 11 +++++ src/Seq.Api/Model/Shared/DateTimeRange.cs | 31 ++++++++++++++ .../DiagnosticsResourceGroup.cs | 33 ++++++++++++++- src/Seq.Api/Seq.Api.csproj | 4 +- 9 files changed, 198 insertions(+), 3 deletions(-) create mode 100644 src/Seq.Api/Model/Diagnostics/Storage/ColumnDescriptionPart.cs create mode 100644 src/Seq.Api/Model/Diagnostics/Storage/ColumnType.cs create mode 100644 src/Seq.Api/Model/Diagnostics/Storage/RowsetPart.cs create mode 100644 src/Seq.Api/Model/Diagnostics/Storage/StorageConsumptionPart.cs create mode 100644 src/Seq.Api/Model/Shared/DateTimeRange.cs diff --git a/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs b/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs index bca4e1c..6bb1079 100644 --- a/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs +++ b/src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs @@ -28,6 +28,16 @@ public class ServerMetricsEntity : Entity public ServerMetricsEntity() { } + + /// + /// The start time in UTC of the events in the memory cache. + /// + public DateTime? EventStoreCacheStart { get; set; } + + /// + /// The end time in UTC of the events in the memory cache. + /// + public DateTime? EventStoreCacheEnd { get; set; } /// /// The number of days of events able to fit in the memory cache. diff --git a/src/Seq.Api/Model/Diagnostics/Storage/ColumnDescriptionPart.cs b/src/Seq.Api/Model/Diagnostics/Storage/ColumnDescriptionPart.cs new file mode 100644 index 0000000..9393642 --- /dev/null +++ b/src/Seq.Api/Model/Diagnostics/Storage/ColumnDescriptionPart.cs @@ -0,0 +1,33 @@ +using System; + +namespace Seq.Api.Model.Diagnostics.Storage +{ + /// + /// A description of a column in a rowset. + /// + public readonly struct ColumnDescriptionPart + { + /// + /// A label for the column. + /// + public string Label { get; } + + /// + /// Additional metadata describing the role of the column; this is separate from, + /// but related to, the runtime type of the column values. + /// + public ColumnType Type { get; } + + /// + /// Construct a . + /// + /// A label for the column. + /// Additional metadata describing the role of the column; this is separate from, + /// but related to, the runtime type of the column values. + public ColumnDescriptionPart(string label, ColumnType type) + { + Label = label ?? throw new ArgumentNullException(nameof(label)); + Type = type; + } + } +} \ No newline at end of file diff --git a/src/Seq.Api/Model/Diagnostics/Storage/ColumnType.cs b/src/Seq.Api/Model/Diagnostics/Storage/ColumnType.cs new file mode 100644 index 0000000..7de3e51 --- /dev/null +++ b/src/Seq.Api/Model/Diagnostics/Storage/ColumnType.cs @@ -0,0 +1,19 @@ +namespace Seq.Api.Model.Diagnostics.Storage +{ + /// + /// Additional metadata describing the role of a column; this is separate from, + /// but related to, the runtime type of the column values. + /// + public enum ColumnType + { + /// + /// The column contains general data. + /// + General, + + /// + /// The column contains timestamps that may be used to create a timeseries. + /// + Timestamp, + } +} \ No newline at end of file diff --git a/src/Seq.Api/Model/Diagnostics/Storage/RowsetPart.cs b/src/Seq.Api/Model/Diagnostics/Storage/RowsetPart.cs new file mode 100644 index 0000000..7632648 --- /dev/null +++ b/src/Seq.Api/Model/Diagnostics/Storage/RowsetPart.cs @@ -0,0 +1,19 @@ +namespace Seq.Api.Model.Diagnostics.Storage +{ + /// + /// Values in rows and columns. + /// + public class RowsetPart + { + /// + /// The columns of the rowset. + /// + public ColumnDescriptionPart[] Columns { get; set; } + + /// + /// An array of rows, where each row is an array of values + /// corresponding to the columns of the rowset. + /// + public object[][] Rows { get; set; } + } +} \ No newline at end of file diff --git a/src/Seq.Api/Model/Diagnostics/Storage/StorageConsumptionPart.cs b/src/Seq.Api/Model/Diagnostics/Storage/StorageConsumptionPart.cs new file mode 100644 index 0000000..4cbed6b --- /dev/null +++ b/src/Seq.Api/Model/Diagnostics/Storage/StorageConsumptionPart.cs @@ -0,0 +1,41 @@ +// Copyright © Datalust and contributors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using Seq.Api.Model.Shared; + +namespace Seq.Api.Model.Diagnostics.Storage +{ + /// + /// Describes storage space consumed by the event store, for a range + /// of event timestamps. + /// + public class StorageConsumptionPart + { + /// + /// The range of timestamps covered by the result. + /// + public DateTimeRange Range { get; set; } + + /// + /// The duration of the timestamp interval covered by each result. + /// + public uint IntervalMinutes { get; set; } + + /// + /// A potentially-sparse rowset describing the storage space consumed + /// for a range of timestamp intervals. + /// + public RowsetPart Results { get; set; } + } +} diff --git a/src/Seq.Api/Model/License/LicenseEntity.cs b/src/Seq.Api/Model/License/LicenseEntity.cs index ea7aa61..0bdb65e 100644 --- a/src/Seq.Api/Model/License/LicenseEntity.cs +++ b/src/Seq.Api/Model/License/LicenseEntity.cs @@ -36,6 +36,11 @@ public class LicenseEntity : Entity /// public bool IsSingleUser { get; set; } + /// + /// If the license is a subscription, the subscription id. + /// + public string SubscriptionId { get; set; } + /// /// Information about the status of the license. /// @@ -56,5 +61,11 @@ public class LicenseEntity : Entity /// the license has no user limit. /// public int? LicensedUsers { get; set; } + + /// + /// If the license is for a subscription, automatically check datalust.co and + /// update the license when the subscription is renewed or tier changed. + /// + public bool AutomaticallyRefresh { get; set; } } } diff --git a/src/Seq.Api/Model/Shared/DateTimeRange.cs b/src/Seq.Api/Model/Shared/DateTimeRange.cs new file mode 100644 index 0000000..8790bdc --- /dev/null +++ b/src/Seq.Api/Model/Shared/DateTimeRange.cs @@ -0,0 +1,31 @@ +using System; + +namespace Seq.Api.Model.Shared +{ + /// + /// A range represented by a start and end . + /// + public readonly struct DateTimeRange + { + /// + /// The (inclusive) start of the range. + /// + public DateTime Start { get; } + + /// + /// The (exclusive) end of the range. + /// + public DateTime End { get; } + + /// + /// Construct a . + /// + /// The (inclusive) start of the range. + /// The (exclusive) end of the range. + public DateTimeRange(DateTime start, DateTime end) + { + Start = start; + End = end; + } + } +} \ No newline at end of file diff --git a/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs b/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs index a386bc0..644242c 100644 --- a/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs +++ b/src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Seq.Api.Model.Diagnostics; +using Seq.Api.Model.Diagnostics.Storage; using Seq.Api.Model.Inputs; +// ReSharper disable UnusedMember.Global + namespace Seq.Api.ResourceGroups { /// @@ -65,11 +69,38 @@ public async Task GetIngestionLogAsync(CancellationToken cancellationTok /// /// A allowing the operation to be canceled. /// The measurement to get. - /// + /// A timeseries showing the measurement over time. public async Task GetMeasurementTimeseriesAsync(string measurement, CancellationToken cancellationToken = default) { var parameters = new Dictionary{ ["measurement"] = measurement }; return await GroupGetAsync("Metric", parameters, cancellationToken); } + + /// + /// Report on storage space consumed by the event store across a range of timestamps. The returned range may be + /// extended to account for the resolution of the underlying data. + /// + /// The (inclusive) start of the range to report on. If omitted, the results will report from the + /// earliest stored data. The range start must land on a five-minute boundary. + /// The (exclusive) end of the range to report on. If omitted, the results will report from the + /// earliest stored data. The range must be a multiple of the interval size, or a whole number of days if + /// no interval is specified. + /// The bucket size to use. Must be a multiple of 5 minutes. Defaults to 1440 (one day). + /// A allowing the operation to be canceled. + /// Storage consumption information. + public async Task GetStorageConsumptionAsync( + DateTime? rangeStart, + DateTime? rangeEnd, + int? intervalMinutes, + CancellationToken cancellationToken = default) + { + var parameters = new Dictionary + { + ["rangeStart"] = rangeStart, + ["rangeEnd"] = rangeEnd, + ["intervalMinutes"] = intervalMinutes + }; + return await GroupGetAsync("Storage", parameters, cancellationToken); + } } } diff --git a/src/Seq.Api/Seq.Api.csproj b/src/Seq.Api/Seq.Api.csproj index 0de28ea..b20e2a9 100644 --- a/src/Seq.Api/Seq.Api.csproj +++ b/src/Seq.Api/Seq.Api.csproj @@ -1,7 +1,7 @@ Client library for the Seq HTTP API. - 2020.1.1 + 2020.4.0 Datalust;Contributors netstandard2.0 true @@ -14,7 +14,7 @@ 8 - +