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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you want to *write events* to Seq, use one of the logging framework clients,
Install from NuGet:

```powershell
Install-Package Seq.Api
dotnet add package Seq.Api
```

Create a `SeqConnection` with your server URL:
Expand Down
6 changes: 2 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
version: '{build}'
skip_tags: true
image: Visual Studio 2017
configuration: Release
install:
image: Visual Studio 2019
build_script:
- ps: ./Build.ps1
test: off
Expand All @@ -11,7 +9,7 @@ artifacts:
deploy:
- provider: NuGet
api_key:
secure: jFkBflAkupwH+6ebPfcScQzBwCJGArjzcE6716DMgVG5SSktBSXIgAtPE2URki8r
secure: sMicBLl7Z83H/mhX10DL7Yqwa80ZHUbb9fRHKmxd5m2MN2DWAE1kbYH/GPQPFajZ
skip_symbols: true
on:
branch: /^(master|dev)$/
Expand Down
2 changes: 1 addition & 1 deletion example/SignalCopy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ static async Task Run(string src, string srcKey, string dst, string dstKey)

target.Title = signal.Title;
target.Filters = signal.Filters;
target.TaggedProperties = signal.TaggedProperties;
target.Columns = signal.Columns;
target.Description = signal.Description + " (copy)";

await (target.Id != null ? dstConnection.Signals.UpdateAsync(target) : dstConnection.Signals.AddAsync(target));
Expand Down
27 changes: 21 additions & 6 deletions src/Seq.Api/Client/SeqApiClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand All @@ -14,6 +14,7 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Net;
using System.Net.Http;
Expand Down Expand Up @@ -41,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 All @@ -56,7 +57,20 @@ public class SeqApiClient : IDisposable
/// <param name="serverUrl">The base URL of the Seq server.</param>
/// <param name="apiKey">An API key to use when making requests to the server, if required.</param>
/// <param name="useDefaultCredentials">Whether default credentials will be sent with HTTP requests; the default is <c>true</c>.</param>
public SeqApiClient(string serverUrl, string apiKey = null, bool useDefaultCredentials = true)
[Obsolete("Prefer `SeqApiClient(serverUrl, apiKey, handler => handler.UseDefaultCredentials = true)` instead."), EditorBrowsable(EditorBrowsableState.Never)]
public SeqApiClient(string serverUrl, string apiKey, bool useDefaultCredentials)
: this(serverUrl, apiKey, handler => handler.UseDefaultCredentials = useDefaultCredentials)
{
}

/// <summary>
/// Construct a <see cref="SeqApiClient"/>.
/// </summary>
/// <param name="serverUrl">The base URL of the Seq server.</param>
/// <param name="apiKey">An API key to use when making requests to the server, if required.</param>
/// <param name="configureHttpClientHandler">An optional callback to configure the <see cref="HttpClientHandler"/> used when making HTTP requests
/// to the Seq API.</param>
public SeqApiClient(string serverUrl, string apiKey = null, Action<HttpClientHandler> configureHttpClientHandler = null)
{
ServerUrl = serverUrl ?? throw new ArgumentNullException(nameof(serverUrl));

Expand All @@ -65,16 +79,17 @@ public SeqApiClient(string serverUrl, string apiKey = null, bool useDefaultCrede

var handler = new HttpClientHandler
{
CookieContainer = _cookies,
UseDefaultCredentials = useDefaultCredentials
CookieContainer = _cookies
};

configureHttpClientHandler?.Invoke(handler);

var baseAddress = serverUrl;
if (!baseAddress.EndsWith("/"))
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
2 changes: 1 addition & 1 deletion src/Seq.Api/Client/SeqApiException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand Down
43 changes: 36 additions & 7 deletions src/Seq.Api/Model/AppInstances/AppInstanceEntity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand All @@ -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
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand All @@ -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
2 changes: 1 addition & 1 deletion src/Seq.Api/Model/Apps/AppEntity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Seq.Api/Model/Apps/AppPackagePart.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Seq.Api/Model/Apps/AppSettingPart.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Seq.Api/Model/Backups/BackupEntity.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand Down
6 changes: 3 additions & 3 deletions src/Seq.Api/Model/Data/QueryExecutionStatisticsPart.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand All @@ -23,12 +23,12 @@ public class QueryExecutionStatisticsPart
/// The number of events inspected in the course of computing the query result. This will
/// not include events that could be skipped based on index information or text pre-filtering.
/// </summary>
public long ScannedEventCount { get; set; }
public ulong ScannedEventCount { get; set; }

/// <summary>
/// The number of events that contributed to the query result.
/// </summary>
public long MatchingEventCount { get; set; }
public ulong MatchingEventCount { get; set; }

/// <summary>
/// Whether the query needed to search disk-backed storage.
Expand Down
2 changes: 1 addition & 1 deletion src/Seq.Api/Model/Data/QueryResultPart.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Seq.Api/Model/Data/TimeSlicePart.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
Expand Down
2 changes: 1 addition & 1 deletion src/Seq.Api/Model/Data/TimeseriesPart.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2014-2019 Datalust and contributors.
// 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.
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; }
}
}
Loading