Skip to content

Commit b2b3bb7

Browse files
committed
Updates for Seq 2020.4
1 parent 9355314 commit b2b3bb7

File tree

9 files changed

+198
-3
lines changed

9 files changed

+198
-3
lines changed

src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ public class ServerMetricsEntity : Entity
2828
public ServerMetricsEntity()
2929
{
3030
}
31+
32+
/// <summary>
33+
/// The start time in UTC of the events in the memory cache.
34+
/// </summary>
35+
public DateTime? EventStoreCacheStart { get; set; }
36+
37+
/// <summary>
38+
/// The end time in UTC of the events in the memory cache.
39+
/// </summary>
40+
public DateTime? EventStoreCacheEnd { get; set; }
3141

3242
/// <summary>
3343
/// The number of days of events able to fit in the memory cache.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
3+
namespace Seq.Api.Model.Diagnostics.Storage
4+
{
5+
/// <summary>
6+
/// A description of a column in a rowset.
7+
/// </summary>
8+
public readonly struct ColumnDescriptionPart
9+
{
10+
/// <summary>
11+
/// A label for the column.
12+
/// </summary>
13+
public string Label { get; }
14+
15+
/// <summary>
16+
/// Additional metadata describing the role of the column; this is separate from,
17+
/// but related to, the runtime type of the column values.
18+
/// </summary>
19+
public ColumnType Type { get; }
20+
21+
/// <summary>
22+
/// Construct a <see cref="ColumnDescriptionPart"/>.
23+
/// </summary>
24+
/// <param name="label">A label for the column.</param>
25+
/// <param name="type">Additional metadata describing the role of the column; this is separate from,
26+
/// but related to, the runtime type of the column values.</param>
27+
public ColumnDescriptionPart(string label, ColumnType type)
28+
{
29+
Label = label ?? throw new ArgumentNullException(nameof(label));
30+
Type = type;
31+
}
32+
}
33+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Seq.Api.Model.Diagnostics.Storage
2+
{
3+
/// <summary>
4+
/// Additional metadata describing the role of a column; this is separate from,
5+
/// but related to, the runtime type of the column values.
6+
/// </summary>
7+
public enum ColumnType
8+
{
9+
/// <summary>
10+
/// The column contains general data.
11+
/// </summary>
12+
General,
13+
14+
/// <summary>
15+
/// The column contains timestamps that may be used to create a timeseries.
16+
/// </summary>
17+
Timestamp,
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace Seq.Api.Model.Diagnostics.Storage
2+
{
3+
/// <summary>
4+
/// Values in rows and columns.
5+
/// </summary>
6+
public class RowsetPart
7+
{
8+
/// <summary>
9+
/// The columns of the rowset.
10+
/// </summary>
11+
public ColumnDescriptionPart[] Columns { get; set; }
12+
13+
/// <summary>
14+
/// An array of rows, where each row is an array of values
15+
/// corresponding to the columns of the rowset.
16+
/// </summary>
17+
public object[][] Rows { get; set; }
18+
}
19+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright © Datalust and contributors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
using Seq.Api.Model.Shared;
16+
17+
namespace Seq.Api.Model.Diagnostics.Storage
18+
{
19+
/// <summary>
20+
/// Describes storage space consumed by the event store, for a range
21+
/// of event timestamps.
22+
/// </summary>
23+
public class StorageConsumptionPart
24+
{
25+
/// <summary>
26+
/// The range of timestamps covered by the result.
27+
/// </summary>
28+
public DateTimeRange Range { get; set; }
29+
30+
/// <summary>
31+
/// The duration of the timestamp interval covered by each result.
32+
/// </summary>
33+
public uint IntervalMinutes { get; set; }
34+
35+
/// <summary>
36+
/// A potentially-sparse rowset describing the storage space consumed
37+
/// for a range of timestamp intervals.
38+
/// </summary>
39+
public RowsetPart Results { get; set; }
40+
}
41+
}

src/Seq.Api/Model/License/LicenseEntity.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ public class LicenseEntity : Entity
3636
/// </summary>
3737
public bool IsSingleUser { get; set; }
3838

39+
/// <summary>
40+
/// If the license is a subscription, the subscription id.
41+
/// </summary>
42+
public string SubscriptionId { get; set; }
43+
3944
/// <summary>
4045
/// Information about the status of the license.
4146
/// </summary>
@@ -56,5 +61,11 @@ public class LicenseEntity : Entity
5661
/// the license has no user limit.
5762
/// </summary>
5863
public int? LicensedUsers { get; set; }
64+
65+
/// <summary>
66+
/// If the license is for a subscription, automatically check datalust.co and
67+
/// update the license when the subscription is renewed or tier changed.
68+
/// </summary>
69+
public bool AutomaticallyRefresh { get; set; }
5970
}
6071
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
3+
namespace Seq.Api.Model.Shared
4+
{
5+
/// <summary>
6+
/// A range represented by a start and end <see cref="DateTime"/>.
7+
/// </summary>
8+
public readonly struct DateTimeRange
9+
{
10+
/// <summary>
11+
/// The (inclusive) start of the range.
12+
/// </summary>
13+
public DateTime Start { get; }
14+
15+
/// <summary>
16+
/// The (exclusive) end of the range.
17+
/// </summary>
18+
public DateTime End { get; }
19+
20+
/// <summary>
21+
/// Construct a <see cref="DateTimeRange"/>.
22+
/// </summary>
23+
/// <param name="start">The (inclusive) start of the range.</param>
24+
/// <param name="end">The (exclusive) end of the range.</param>
25+
public DateTimeRange(DateTime start, DateTime end)
26+
{
27+
Start = start;
28+
End = end;
29+
}
30+
}
31+
}

src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
using System;
1516
using System.Collections.Generic;
1617
using System.Threading;
1718
using System.Threading.Tasks;
1819
using Seq.Api.Model.Diagnostics;
20+
using Seq.Api.Model.Diagnostics.Storage;
1921
using Seq.Api.Model.Inputs;
2022

23+
// ReSharper disable UnusedMember.Global
24+
2125
namespace Seq.Api.ResourceGroups
2226
{
2327
/// <summary>
@@ -65,11 +69,38 @@ public async Task<string> GetIngestionLogAsync(CancellationToken cancellationTok
6569
/// </summary>
6670
/// <param name="cancellationToken">A <see cref="CancellationToken"/> allowing the operation to be canceled.</param>
6771
/// <param name="measurement">The measurement to get.</param>
68-
/// <returns></returns>
72+
/// <returns>A timeseries showing the measurement over time.</returns>
6973
public async Task<MeasurementTimeseriesPart> GetMeasurementTimeseriesAsync(string measurement, CancellationToken cancellationToken = default)
7074
{
7175
var parameters = new Dictionary<string, object>{ ["measurement"] = measurement };
7276
return await GroupGetAsync<MeasurementTimeseriesPart>("Metric", parameters, cancellationToken);
7377
}
78+
79+
/// <summary>
80+
/// Report on storage space consumed by the event store across a range of timestamps. The returned range may be
81+
/// extended to account for the resolution of the underlying data.
82+
/// </summary>
83+
/// <param name="rangeStart">The (inclusive) start of the range to report on. If omitted, the results will report from the
84+
/// earliest stored data. The range start must land on a five-minute boundary.</param>
85+
/// <param name="rangeEnd">The (exclusive) end of the range to report on. If omitted, the results will report from the
86+
/// earliest stored data. The range must be a multiple of the interval size, or a whole number of days if
87+
/// no interval is specified.</param>
88+
/// <param name="intervalMinutes">The bucket size to use. Must be a multiple of 5 minutes. Defaults to 1440 (one day).</param>
89+
/// <param name="cancellationToken">A <see cref="CancellationToken"/> allowing the operation to be canceled.</param>
90+
/// <returns>Storage consumption information.</returns>
91+
public async Task<StorageConsumptionPart> GetStorageConsumptionAsync(
92+
DateTime? rangeStart,
93+
DateTime? rangeEnd,
94+
int? intervalMinutes,
95+
CancellationToken cancellationToken = default)
96+
{
97+
var parameters = new Dictionary<string, object>
98+
{
99+
["rangeStart"] = rangeStart,
100+
["rangeEnd"] = rangeEnd,
101+
["intervalMinutes"] = intervalMinutes
102+
};
103+
return await GroupGetAsync<StorageConsumptionPart>("Storage", parameters, cancellationToken);
104+
}
74105
}
75106
}

src/Seq.Api/Seq.Api.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Description>Client library for the Seq HTTP API.</Description>
4-
<VersionPrefix>2020.1.1</VersionPrefix>
4+
<VersionPrefix>2020.4.0</VersionPrefix>
55
<Authors>Datalust;Contributors</Authors>
66
<TargetFramework>netstandard2.0</TargetFramework>
77
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -14,7 +14,7 @@
1414
<LangVersion>8</LangVersion>
1515
</PropertyGroup>
1616
<ItemGroup>
17-
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
17+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
1818
<PackageReference Include="Tavis.UriTemplates" Version="1.1.1" />
1919
<None Include="seq-api-icon.png" Pack="true" PackagePath="\"/>
2020
</ItemGroup>

0 commit comments

Comments
 (0)