Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ public class ServerMetricsEntity : Entity
public ServerMetricsEntity()
{
}

/// <summary>
/// The start time in UTC of the events in the memory cache.
/// </summary>
public DateTime? EventStoreCacheStart { get; set; }

/// <summary>
/// The end time in UTC of the events in the memory cache.
/// </summary>
public DateTime? EventStoreCacheEnd { get; set; }

/// <summary>
/// The number of days of events able to fit in the memory cache.
Expand Down
33 changes: 33 additions & 0 deletions src/Seq.Api/Model/Diagnostics/Storage/ColumnDescriptionPart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;

namespace Seq.Api.Model.Diagnostics.Storage
{
/// <summary>
/// A description of a column in a rowset.
/// </summary>
public readonly struct ColumnDescriptionPart
{
/// <summary>
/// A label for the column.
/// </summary>
public string Label { get; }

/// <summary>
/// Additional metadata describing the role of the column; this is separate from,
/// but related to, the runtime type of the column values.
/// </summary>
public ColumnType Type { get; }

/// <summary>
/// Construct a <see cref="ColumnDescriptionPart"/>.
/// </summary>
/// <param name="label">A label for the column.</param>
/// <param name="type">Additional metadata describing the role of the column; this is separate from,
/// but related to, the runtime type of the column values.</param>
public ColumnDescriptionPart(string label, ColumnType type)
{
Label = label ?? throw new ArgumentNullException(nameof(label));
Type = type;
}
}
}
19 changes: 19 additions & 0 deletions src/Seq.Api/Model/Diagnostics/Storage/ColumnType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Seq.Api.Model.Diagnostics.Storage
{
/// <summary>
/// Additional metadata describing the role of a column; this is separate from,
/// but related to, the runtime type of the column values.
/// </summary>
public enum ColumnType
{
/// <summary>
/// The column contains general data.
/// </summary>
General,

/// <summary>
/// The column contains timestamps that may be used to create a timeseries.
/// </summary>
Timestamp,
}
}
19 changes: 19 additions & 0 deletions src/Seq.Api/Model/Diagnostics/Storage/RowsetPart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
namespace Seq.Api.Model.Diagnostics.Storage
{
/// <summary>
/// Values in rows and columns.
/// </summary>
public class RowsetPart
{
/// <summary>
/// The columns of the rowset.
/// </summary>
public ColumnDescriptionPart[] Columns { get; set; }

/// <summary>
/// An array of rows, where each row is an array of values
/// corresponding to the columns of the rowset.
/// </summary>
public object[][] Rows { get; set; }
}
}
41 changes: 41 additions & 0 deletions src/Seq.Api/Model/Diagnostics/Storage/StorageConsumptionPart.cs
Original file line number Diff line number Diff line change
@@ -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
{
/// <summary>
/// Describes storage space consumed by the event store, for a range
/// of event timestamps.
/// </summary>
public class StorageConsumptionPart
{
/// <summary>
/// The range of timestamps covered by the result.
/// </summary>
public DateTimeRange Range { get; set; }

/// <summary>
/// The duration of the timestamp interval covered by each result.
/// </summary>
public uint IntervalMinutes { get; set; }

/// <summary>
/// A potentially-sparse rowset describing the storage space consumed
/// for a range of timestamp intervals.
/// </summary>
public RowsetPart Results { get; set; }
}
}
11 changes: 11 additions & 0 deletions src/Seq.Api/Model/License/LicenseEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public class LicenseEntity : Entity
/// </summary>
public bool IsSingleUser { get; set; }

/// <summary>
/// If the license is a subscription, the subscription id.
/// </summary>
public string SubscriptionId { get; set; }

/// <summary>
/// Information about the status of the license.
/// </summary>
Expand All @@ -56,5 +61,11 @@ public class LicenseEntity : Entity
/// the license has no user limit.
/// </summary>
public int? LicensedUsers { get; set; }

/// <summary>
/// If the license is for a subscription, automatically check datalust.co and
/// update the license when the subscription is renewed or tier changed.
/// </summary>
public bool AutomaticallyRefresh { get; set; }
}
}
31 changes: 31 additions & 0 deletions src/Seq.Api/Model/Shared/DateTimeRange.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;

namespace Seq.Api.Model.Shared
{
/// <summary>
/// A range represented by a start and end <see cref="DateTime"/>.
/// </summary>
public readonly struct DateTimeRange
{
/// <summary>
/// The (inclusive) start of the range.
/// </summary>
public DateTime Start { get; }

/// <summary>
/// The (exclusive) end of the range.
/// </summary>
public DateTime End { get; }

/// <summary>
/// Construct a <see cref="DateTimeRange"/>.
/// </summary>
/// <param name="start">The (inclusive) start of the range.</param>
/// <param name="end">The (exclusive) end of the range.</param>
public DateTimeRange(DateTime start, DateTime end)
{
Start = start;
End = end;
}
}
}
33 changes: 32 additions & 1 deletion src/Seq.Api/ResourceGroups/DiagnosticsResourceGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/// <summary>
Expand Down Expand Up @@ -65,11 +69,38 @@ public async Task<string> GetIngestionLogAsync(CancellationToken cancellationTok
/// </summary>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> allowing the operation to be canceled.</param>
/// <param name="measurement">The measurement to get.</param>
/// <returns></returns>
/// <returns>A timeseries showing the measurement over time.</returns>
public async Task<MeasurementTimeseriesPart> GetMeasurementTimeseriesAsync(string measurement, CancellationToken cancellationToken = default)
{
var parameters = new Dictionary<string, object>{ ["measurement"] = measurement };
return await GroupGetAsync<MeasurementTimeseriesPart>("Metric", parameters, cancellationToken);
}

/// <summary>
/// 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.
/// </summary>
/// <param name="rangeStart">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.</param>
/// <param name="rangeEnd">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.</param>
/// <param name="intervalMinutes">The bucket size to use. Must be a multiple of 5 minutes. Defaults to 1440 (one day).</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> allowing the operation to be canceled.</param>
/// <returns>Storage consumption information.</returns>
public async Task<StorageConsumptionPart> GetStorageConsumptionAsync(
DateTime? rangeStart,
DateTime? rangeEnd,
int? intervalMinutes,
CancellationToken cancellationToken = default)
{
var parameters = new Dictionary<string, object>
{
["rangeStart"] = rangeStart,
["rangeEnd"] = rangeEnd,
["intervalMinutes"] = intervalMinutes
};
return await GroupGetAsync<StorageConsumptionPart>("Storage", parameters, cancellationToken);
}
}
}
4 changes: 2 additions & 2 deletions src/Seq.Api/Seq.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Client library for the Seq HTTP API.</Description>
<VersionPrefix>2020.1.1</VersionPrefix>
<VersionPrefix>2020.4.0</VersionPrefix>
<Authors>Datalust;Contributors</Authors>
<TargetFramework>netstandard2.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand All @@ -14,7 +14,7 @@
<LangVersion>8</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Tavis.UriTemplates" Version="1.1.1" />
<None Include="seq-api-icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>
Expand Down