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 @@ -42,7 +42,7 @@ public class SeqApiClient : IDisposable
// Future versions of Seq may not completely support v1 features, however
// providing this as an Accept header will ensure what compatibility is available
// can be utilized.
const string SeqApiV7MediaType = "application/vnd.datalust.seq.v7+json";
const string SeqApiV8MediaType = "application/vnd.datalust.seq.v8+json";

readonly CookieContainer _cookies = new CookieContainer();
readonly JsonSerializer _serializer = JsonSerializer.Create(
Expand Down Expand Up @@ -89,7 +89,7 @@ public SeqApiClient(string serverUrl, string apiKey = null, Action<HttpClientHan
baseAddress += "/";

HttpClient = new HttpClient(handler) { BaseAddress = new Uri(baseAddress) };
HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(SeqApiV7MediaType));
HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(SeqApiV8MediaType));

if (_apiKey != null)
HttpClient.DefaultRequestHeaders.Add("X-Seq-ApiKey", _apiKey);
Expand Down
41 changes: 35 additions & 6 deletions src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Seq.Api.Model.Apps;
using Seq.Api.Model.Inputs;
using Seq.Api.Model.Signals;
using Seq.Api.ResourceGroups;

Expand All @@ -38,7 +39,11 @@ public AppInstanceEntity()
InvocationOverridableSettings = new List<string>();
InvocationOverridableSettingDefinitions = new List<AppSettingPart>();
EventsPerSuppressionWindow = 1;
Metrics = new AppInstanceMetricsPart();
ProcessMetrics = new AppInstanceProcessMetricsPart();
InputSettings = new InputSettingsPart();
InputMetrics = new InputMetricsPart();
DiagnosticInputMetrics = new InputMetricsPart();
OutputMetrics = new AppInstanceOutputMetricsPart();
}

/// <summary>
Expand Down Expand Up @@ -90,7 +95,7 @@ public AppInstanceEntity()
/// The signal expression describing which events will be sent to the app; if <c>null</c>,
/// all events will reach the app.
/// </summary>
public SignalExpressionPart InputSignalExpression { get; set; }
public SignalExpressionPart StreamedSignalExpression { get; set; }

/// <summary>
/// If a value is specified, events will be buffered to disk and sorted by timestamp-order
Expand All @@ -113,22 +118,46 @@ public AppInstanceEntity()
public int EventsPerSuppressionWindow { get; set; }

/// <summary>
/// Metrics describing the state and activity of the app.
/// Settings that control how events are ingested through the app.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public AppInstanceMetricsPart Metrics { get; set; }
public InputSettingsPart InputSettings { get; set; }

/// <summary>
/// Metrics describing the state and activity of the app process.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public AppInstanceProcessMetricsPart ProcessMetrics { get; set; }

/// <summary>
/// Information about ingestion activity through this app.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public InputMetricsPart InputMetrics { get; set; }

/// <summary>
/// Information about the app's diagnostic input.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public InputMetricsPart DiagnosticInputMetrics { get; set; }

/// <summary>
/// Information about events output through the app.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public AppInstanceOutputMetricsPart OutputMetrics { get; set; }

/// <summary>
/// Obsolete.
/// </summary>
[Obsolete("Use !AcceptStreamedEvents instead. This field will be removed in Seq 6.0.")]
[Obsolete("Use !AcceptStreamedEvents instead.")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool? IsManualInputOnly { get; set; }

/// <summary>
/// Obsolete.
/// </summary>
[Obsolete("Use !AcceptDirectInvocation instead. This field will be removed in Seq 6.0.")]
[Obsolete("Use !AcceptDirectInvocation instead.")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool? DisallowManualInput { get; set; }
}
Expand Down
15 changes: 15 additions & 0 deletions src/Seq.Api/Model/AppInstances/AppInstanceOutputMetricsPart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace Seq.Api.Model.AppInstances
{
/// <summary>
/// Describes the events reaching being output from Seq through the app.
/// </summary>
public class AppInstanceOutputMetricsPart
{
/// <summary>
/// The number of events per minute sent from Seq to the app. Includes streamed events (if enabled),
/// manual invocations, and alert notifications. There may be some delay between dispatching an event, and
/// it being processed by the app.
/// </summary>
public int DispatchedEventsPerMinute { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,14 @@
namespace Seq.Api.Model.AppInstances
{
/// <summary>
/// Metrics describing an <see cref="AppInstanceEntity"/>.
/// Metrics describing the running server-side process for an <see cref="AppInstanceEntity"/>.
/// </summary>
public class AppInstanceMetricsPart
public class AppInstanceProcessMetricsPart
{
/// <summary>
/// The number of events that reached the app in the past minute.
/// </summary>
public int ReceivedEventsPerMinute { get; set; }

/// <summary>
/// The number of diagnostic events raised by the app in the past minute.
/// </summary>
/// <remarks>This does not include the events received by an input app.</remarks>
public int EmittedEventsPerMinute { get; set; }

/// <summary>
/// The size, in bytes, of the app process working set.
/// </summary>
public long ProcessWorkingSetBytes { get; set; }
public long WorkingSetBytes { get; set; }

/// <summary>
/// If the app process is running, <c>true</c>; otherwise, <c>false</c>.
Expand Down
39 changes: 39 additions & 0 deletions src/Seq.Api/Model/Diagnostics/MeasurementTimeseriesPart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// 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;

namespace Seq.Api.Model.Diagnostics
{
/// <summary>
/// A histogram presenting a measurement taken at equal intervals.
/// </summary>
public class MeasurementTimeseriesPart
{
/// <summary>
/// The point in time from which measurement begins.
/// </summary>
public DateTime MeasuredFrom { get; set; }

/// <summary>
/// The interval at which the measurement is taken.
/// </summary>
public ulong MeasurementIntervalMilliseconds { get; set; }

/// <summary>
/// The measurements at each interval, beginning with <see cref="MeasuredFrom"/>.
/// </summary>
public long[] Measurements { get; set; }
}
}
41 changes: 5 additions & 36 deletions src/Seq.Api/Model/Diagnostics/ServerMetricsEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class ServerMetricsEntity : Entity
/// </summary>
public ServerMetricsEntity()
{
RunningTasks = new List<RunningTaskPart>();
}

/// <summary>
Expand All @@ -40,16 +39,6 @@ public ServerMetricsEntity()
/// </summary>
public int EventStoreEventsCached { get; set; }

/// <summary>
/// The oldest on-disk extent currently stored.
/// </summary>
public DateTime? EventStoreFirstExtentRangeStartUtc { get; set; }

/// <summary>
/// The most recent on-disk extent currently stored.
/// </summary>
public DateTime? EventStoreLastExtentRangeEndUtc { get; set; }

/// <summary>
/// Bytes of free space remaining on the disk used for event storage.
/// </summary>
Expand All @@ -58,27 +47,27 @@ public ServerMetricsEntity()
/// <summary>
/// The number of events that arrived at the ingestion endpoint in the past minute.
/// </summary>
public int EndpointArrivalsPerMinute { get; set; }
public int InputArrivedEventsPerMinute { get; set; }

/// <summary>
/// The number of events ingested in the past minute.
/// </summary>
public int EndpointInfluxPerMinute { get; set; }
public int InputIngestedEventsPerMinute { get; set; }

/// <summary>
/// The number of bytes of raw JSON event data ingested in the past minute (approximate).
/// </summary>
public long EndpointIngestedBytesPerMinute { get; set; }
public long InputIngestedBytesPerMinute { get; set; }

/// <summary>
/// The number of invalid event payloads seen in the past minute.
/// </summary>
public int EndpointInvalidPayloadsPerMinute { get; set; }
public int InvalidPayloadsPerMinute { get; set; }

/// <summary>
/// The number of unauthorized event payloads seen in the past minute.
/// </summary>
public int EndpointUnauthorizedPayloadsPerMinute { get; set; }
public int HttpUnauthorizedPayloadsPerMinute { get; set; }

/// <summary>
/// The length of time for which the Seq server process has been running.
Expand All @@ -95,26 +84,11 @@ public ServerMetricsEntity()
/// </summary>
public int ProcessThreads { get; set; }

/// <summary>
/// The number of thread pool user threads available.
/// </summary>
public int ProcessThreadPoolUserThreadsAvailable { get; set; }

/// <summary>
/// The number of async I/O thread pool threads available.
/// </summary>
public int ProcessThreadPoolIocpThreadsAvailable { get; set; }

/// <summary>
/// The proportion of system physical memory that is currently allocated.
/// </summary>
public double SystemMemoryUtilization { get; set; }

/// <summary>
/// Tasks running in the Seq server.
/// </summary>
public List<RunningTaskPart> RunningTasks { get; set; }

/// <summary>
/// The number of SQL-style queries executed in the past minute.
/// </summary>
Expand All @@ -129,10 +103,5 @@ public ServerMetricsEntity()
/// The number of cached SQL query time slices invalidated in the past minute.
/// </summary>
public int QueryCacheInvalidationsPerMinute { get; set; }

/// <summary>
/// The number of active sessions reading from or writing to Seq's internal metadata store.
/// </summary>
public int DocumentStoreActiveSessions { get; set; }
}
}
12 changes: 12 additions & 0 deletions src/Seq.Api/Model/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Seq.Api.Model
{
/// <summary>
Expand Down Expand Up @@ -41,5 +46,12 @@ protected Entity()
/// was instantiated locally and not received from the API.
/// </summary>
public LinkCollection Links { get; set; }

/// <summary>
/// Facilitates backwards compatibility in the Seq server. Should not be used by consumers/clients.
/// </summary>
[JsonExtensionData, JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
[Obsolete("Facilitates backwards compatibility in the Seq server. Should not be used by consumers/clients.")]
public Dictionary<string, JToken> ExtensionData { get; set; }
}
}
37 changes: 8 additions & 29 deletions src/Seq.Api/Model/Inputs/ApiKeyEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

using System.Collections.Generic;
using Newtonsoft.Json;
using Seq.Api.Model.LogEvents;
using Seq.Api.Model.Security;
using Seq.Api.Model.Signals;

namespace Seq.Api.Model.Inputs
{
Expand All @@ -33,10 +31,10 @@ public class ApiKeyEntity : Entity
public string Title { get; set; }

/// <summary>
/// The API key token. API keys generated for versions of Seq prior to 5.0 will expose this value. From 5.0 onwards,
/// <see cref="Token"/> can be specified explicitly when creating an API key, but is not readable once the API key is created.
/// Leaving the token blank will cause the server to generate a cryptographically random API key token. After creation, the first
/// few characters of the token will be readable from <see cref="TokenPrefix"/>, but because only a cryptographically-secure
/// The API key token. <see cref="Token"/> can be specified explicitly when creating an API key, but is not
/// readable once the API key is created. Leaving the token blank will cause the server to generate a
/// cryptographically random API key token. After creation, the first few (additional, redundant) characters
/// of the token will be readable from <see cref="TokenPrefix"/>, but because only a cryptographically-secure
/// hash of the token is stored internally, the token itself cannot be retrieved.
/// </summary>
public string Token { get; set; }
Expand All @@ -47,31 +45,12 @@ public class ApiKeyEntity : Entity
public string TokenPrefix { get; set; }

/// <summary>
/// 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.
/// Settings that control how events are ingested through the API key.
/// </summary>
public List<InputAppliedPropertyPart> AppliedProperties { get; set; } = new List<InputAppliedPropertyPart>();
public InputSettingsPart InputSettings { get; set; } = new InputSettingsPart();

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

/// <summary>
/// A minimum level at which events received using the key will be ingested. The level hierarchy understood by Seq is fuzzy
/// enough to handle most common leveling schemes. This value will be provided to callers so that they can dynamically
/// filter events client-side, if supported.
/// </summary>
public LogEventLevel? MinimumLevel { get; set; }

/// <summary>
/// If <c>true</c>, timestamps already present on the events will be ignored, and server timestamps used instead. This is not
/// recommended for most use cases.
/// </summary>
public bool UseServerTimestamps { get; set; }

/// <summary>
/// If <c>true</c>, the key is the built-in (tokenless) API key.
/// If <c>true</c>, the key is the built-in (tokenless) API key representing unauthenticated HTTP ingestion.
/// </summary>
public bool IsDefault { get; set; }

Expand All @@ -90,6 +69,6 @@ public class ApiKeyEntity : Entity
/// Information about the ingestion activity using this API key.
/// </summary>
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public ApiKeyMetricsPart Metrics { get; set; } = new ApiKeyMetricsPart();
public InputMetricsPart InputMetrics { get; set; } = new InputMetricsPart();
}
}
Loading