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
4 changes: 2 additions & 2 deletions src/Seq.Api/Client/SeqApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public sealed class SeqApiClient : IDisposable
// Future versions of Seq may not completely support vN-1 features, however
// providing this as an Accept header will ensure what compatibility is available
// can be utilized.
const string SeqApiVersionedMediaType = "application/vnd.datalust.seq.v13+json";
const string SeqApiVersionedMediaType = "application/vnd.datalust.seq.v14+json";
const string ApiKeyHeaderName = "X-Seq-ApiKey";
const string CsrfTokenHeaderName = "X-Seq-CsrfToken";

Expand Down Expand Up @@ -531,7 +531,7 @@ static string EnsureAbsoluteWebSocketUri(string target, Uri apiBaseAddress)
absoluteUnknownScheme.Scheme = absoluteUnknownScheme.Scheme.Equals("http", StringComparison.OrdinalIgnoreCase) ||
absoluteUnknownScheme.Scheme.Equals("ws", StringComparison.OrdinalIgnoreCase) ?
"ws" : "wss";

return absoluteUnknownScheme.ToString();
}

Expand Down
18 changes: 14 additions & 4 deletions src/Seq.Api/Model/Dashboarding/ChartQueryPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,20 @@ public class ChartQueryPart
/// </summary>
public string Id { get; set; }

/// <summary>
/// The source of the data displayed by the chart.
/// </summary>
public DataSource DataSource { get; set; } = DataSource.Stream;

/// <summary>
/// Lateral joins applied to the data source.
/// </summary>
public List<CrossJoinLateralPart> Joins { get; set; } = [];

/// <summary>
/// Individual measurements included in the query. These are effectively projected columns.
/// </summary>
public List<ColumnPart> Measurements { get; set; } = new List<ColumnPart>();
public List<ColumnPart> Measurements { get; set; } = [];

/// <summary>
/// An optional filtering <c>where</c> clause limiting the data that contributes to the chart.
Expand All @@ -46,12 +56,12 @@ public class ChartQueryPart
/// <summary>
/// A series of expressions used to group data returned by the query.
/// </summary>
public List<string> GroupBy { get; set; } = new List<string>();
public List<string> GroupBy { get; set; } = [];

/// <summary>
/// How measurements included in the chart will be displayed.
/// </summary>
public MeasurementDisplayStylePart DisplayStyle { get; set; } = new MeasurementDisplayStylePart();
public MeasurementDisplayStylePart DisplayStyle { get; set; } = new();

/// <summary>
/// A filter that limits which groups will be displayed on the chart. Not supported by all chart types.
Expand All @@ -61,7 +71,7 @@ public class ChartQueryPart
/// <summary>
/// An ordering applied to the results of the query; not supported by all chart types.
/// </summary>
public List<string> OrderBy { get; set; } = new List<string>();
public List<string> OrderBy { get; set; } = [];

/// <summary>
/// The row limit used for the query. By default, a server-determined limit will be applied.
Expand Down
45 changes: 45 additions & 0 deletions src/Seq.Api/Model/Diagnostics/ColumnStore/ColumnStatisticsPart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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.
namespace Seq.Api.Model.Diagnostics.ColumnStore;

/// <summary>
/// Describes a particular (column name, encoding) pair. Storage for each column is broken down by encoding because
/// the summary information available for each encoding differs.
/// </summary>
public class ColumnStatisticsPart
{
/// <summary>
/// The name of the column. For most user-provided data, such as metrics or labels, the column name will
/// correspond to the metric or label name. Complex objects are decomposed into individual columns per sub-property.
/// Note that these names approximate the Seq query language syntax for referring to the column, but this is
/// inexact.
/// </summary>
public string Name { get; set; }

/// <summary>
/// A textual description of the native encoding scheme used for the column data.
/// </summary>
public string Encoding { get; set; }

/// <summary>
/// The number of rows in which the column has a defined value.
/// </summary>
public long Count { get; set; }

/// <summary>
/// The full on-disk size of the encoded column data, excluding framing details such as CRC blocks, padding, and
/// file layout overhead (these are usually trivial).
/// </summary>
public long SizeBytes { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// 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 System.Collections.Generic;

namespace Seq.Api.Model.Diagnostics.ColumnStore;

/// <summary>
/// Provides information about the internal column store that drives Seq's metrics features.
/// </summary>
public class ColumnStoreStatisticsPart
{
/// <summary>
/// The columns stored in the column store.
/// </summary>
public List<ColumnStatisticsPart> Columns { get; set; } = new();
}
6 changes: 6 additions & 0 deletions src/Seq.Api/Model/Events/EventEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,11 @@ public class EventEntity : Entity
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public TimeSpan? Elapsed { get; set; }

/// <summary>
/// If the event is a metric, the definitions of its metric samples.
/// </summary>
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
public List<EventPropertyPart> Definitions { get; set; }
}
}
6 changes: 3 additions & 3 deletions src/Seq.Api/Model/Inputs/ApiKeyEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ApiKeyEntity : Entity
/// <summary>
/// Settings that control how events are ingested through the API key.
/// </summary>
public InputSettingsPart InputSettings { get; set; } = new InputSettingsPart();
public InputSettingsPart InputSettings { get; set; } = new();

/// <summary>
/// If <c>true</c>, the key is the built-in (tokenless) API key representing unauthenticated HTTP ingestion.
Expand All @@ -63,12 +63,12 @@ public class ApiKeyEntity : Entity
/// The <see cref="Permission"/>s assigned to the API key. Note that, if the API key is owned by an individual user, permissions
/// not held by the user will be ignored by the server.
/// </summary>
public HashSet<Permission> AssignedPermissions { get; set; } = new HashSet<Permission>();
public HashSet<Permission> AssignedPermissions { get; set; } = [];

/// <summary>
/// Information about the ingestion activity using this API key.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public InputMetricsPart InputMetrics { get; set; } = new InputMetricsPart();
public InputMetricsPart InputMetrics { get; set; } = new();
}
}
4 changes: 2 additions & 2 deletions src/Seq.Api/Model/Inputs/InputSettingsPart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public class InputSettingsPart
/// Properties that will be automatically added to all events ingested using the key. These will override any properties with
/// the same names already present on the event.
/// </summary>
public List<EventPropertyPart> AppliedProperties { get; set; } = new List<EventPropertyPart>();
public List<EventPropertyPart> AppliedProperties { get; set; } = [];

/// <summary>
/// A filter that selects events to ingest. If <c>null</c>, all events received using the key will be ingested.
/// </summary>
public DescriptiveFilterPart Filter { get; set; } = new DescriptiveFilterPart();
public DescriptiveFilterPart Filter { get; set; } = new();

/// <summary>
/// A minimum level at which events received using the key will be ingested. The level hierarchy understood by Seq is fuzzy
Expand Down
23 changes: 23 additions & 0 deletions src/Seq.Api/Model/Metrics/DimensionFilterOperator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#nullable enable
namespace Seq.Api.Model.Metrics;

/// <summary>
/// A simplified representation of the expression encoded in a <see cref="DimensionFilterPart"/>.
/// </summary>
public enum DimensionFilterOperator
{
/// <summary>
/// The filter includes samples with <see cref="DimensionFilterPart.Value"/> for the dimension.
/// </summary>
Include,

/// <summary>
/// The filter excludes samples with <see cref="DimensionFilterPart.Value"/> for the dimension.
/// </summary>
Exclude,

/// <summary>
/// The filter includes samples with any value for the dimension.
/// </summary>
Has,
}
24 changes: 24 additions & 0 deletions src/Seq.Api/Model/Metrics/DimensionFilterPart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#nullable enable
namespace Seq.Api.Model.Metrics;

/// <summary>
/// A filter (requirement) applied to a metric dimension.
/// </summary>
public class DimensionFilterPart
{
/// <summary>
/// The dimension. See <see cref="MetricDimensionPart.Accessor"/>.
/// </summary>
public required string Accessor { get; set; }

/// <summary>
/// How the filter applies to the dimension.
/// </summary>
public DimensionFilterOperator Operator { get; set; }

/// <summary>
/// When <see cref="Operator"/> is <see cref="DimensionFilterOperator.Include"/> or
/// <see cref="DimensionFilterOperator.Exclude"/>, the value included or excluded by the filter. Ignored otherwise.
/// </summary>
public object? Value { get; set; }
}
32 changes: 32 additions & 0 deletions src/Seq.Api/Model/Metrics/MetricAggregationPreference.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace Seq.Api.Model.Metrics;

/// <summary>
/// The aggregate function(s) used when aggregating a metric by time interval for display.
/// </summary>
public enum MetricAggregationPreference
{
/// <summary>
/// The <c>count()</c> aggregate function.
/// </summary>
Count,

/// <summary>
/// The <c>sum()</c> aggregate function.
/// </summary>
Sum,

/// <summary>
/// The <c>min()</c> aggregate function.
/// </summary>
Min,

/// <summary>
/// The <c>mean()</c> aggregate function.
/// </summary>
Mean,

/// <summary>
/// The <c>max()</c> aggregate function.
/// </summary>
Max
}
43 changes: 43 additions & 0 deletions src/Seq.Api/Model/Metrics/MetricDimensionPart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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 Newtonsoft.Json;

namespace Seq.Api.Model.Metrics;

/// <summary>
/// A description of a dimension (property/label, scope, or resource attribute) applied to metric samples.
/// </summary>
public class MetricDimensionPart
{
/// <summary>
/// The dimension's accessor path, including the namespace, and using indexer syntax to refer to path elements that
/// are not valid identifiers in the Seq query language. This member is guaranteed to contain a syntactically-valid
/// expression that can be used directly in queries without manipulation.
/// </summary>
public string Accessor { get; set; }

/// <summary>
/// The dimension's human-readable name, without namespace qualifiers such as <c>@Resource</c>, and potentially
/// including syntactically-invalid elements. Omitted if identical to the value of <see cref="Accessor"/>.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Name { get; set; }

/// <summary>
/// The dimension's namespace. Omitted if the namespace is the default <c>@Properties</c>.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string Namespace { get; set; }
}
75 changes: 75 additions & 0 deletions src/Seq.Api/Model/Metrics/MetricPart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// 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.

#nullable enable
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Seq.Api.Model.Metrics;

/// <summary>
/// The definition of a metric present in the server's <c>series</c> metrics store.
/// </summary>
/// <remarks>
/// Because Seq's internal metric store uses a columnar, rather than timeseries, architecture, it does not impose a
/// fixed notion of metric identity. Instead, metric identity can be flexibly defined in the context of a metrics search.
/// A <see cref="MetricPart"/> is the result of such a search, and carries the implied metric identity in its combination
/// of <see cref="Accessor"/>, <see cref="Kind"/>, <see cref="Unit"/>, and <see cref="GroupKey"/> fields.
/// </remarks>
public class MetricPart
{
/// <summary>
/// The name of the metric, as a property accessor expression, using indexer syntax to refer to path elements that
/// are not valid identifiers in the Seq query language. This member is guaranteed to contain a syntactically-valid
/// expression that can be used directly in queries without manipulation.
/// </summary>
public required string Accessor { get; set; }

/// <summary>
/// The metric's human-readable name, without namespace qualifiers such as <c>@Resource</c>, and potentially
/// including syntactically-invalid elements. Omitted if identical to the value of <see cref="Accessor"/>.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string? Name { get; set; }

/// <summary>
/// The group within which this metric appears. The indexes into the array will correspond to the indexes of
/// the list of group key expressions provided when retrieving the definition. For example, if the definitions
/// are retrieved with <c>?group=@Resource.service.name,@Scope.name</c>, then the contents of a returned group
/// key might resemble <c>["users_api", "AspNetCore.Server.Kestrel"]</c>.
/// </summary>
public List<object?> GroupKey { get; set; } = [];

/// <summary>
/// The type of data this metric records. This will typically be one of either
/// <c>Sum</c>, <c>Gauge</c>, or (exponential) <c>Histogram</c>.
/// </summary>
public required string Kind { get; set; }

/// <summary>
/// A user-facing description of the metric, if one is supplied.
/// </summary>
public string? Description { get; set; }

/// <summary>
/// The unit of measure for the metric samples, if one is supplied.
/// </summary>
public string? Unit { get; set; }

/// <summary>
/// If a filter or groupings were supplied when retrieving this metric, a <c>where</c>-clause compatible expression
/// that restricts queries for metric data to only the samples matched in the filter, or belonging to the group.
/// </summary>
public string? Condition { get; set; }
}
Loading