Skip to content

Commit

Permalink
Merge pull request #104 from datalust/dev
Browse files Browse the repository at this point in the history
2021.3 Errata
  • Loading branch information
nblumhardt authored Oct 25, 2021
2 parents 00836cf + 3e59dab commit 06892fa
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
13 changes: 13 additions & 0 deletions src/Seq.Api/Model/Alerting/AlertActivityPart.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;

// ReSharper disable UnusedAutoPropertyAccessor.Global

namespace Seq.Api.Model.Alerting
Expand Down Expand Up @@ -39,9 +40,21 @@ public class AlertActivityPart
/// </summary>
public List<AlertOccurrencePart> RecentOccurrences { get; set; } = new List<AlertOccurrencePart>();

/// <summary>
/// Minimal metrics for the most recent occurrences of the alert that triggered notifications.
/// The metrics in this list are a superset of <see cref="RecentOccurrences"/>.
/// </summary>
public List<AlertOccurrenceRangePart> RecentOccurrenceRanges { get; set; } =
new List<AlertOccurrenceRangePart>();

/// <summary>
/// The number of times this alert has been triggered since its creation.
/// </summary>
public int TotalOccurrences { get; set; }

/// <summary>
/// The detection time of the most recent occurrence not included in <see cref="RecentOccurrences"/>.
/// </summary>
public DateTime? LastEarlierOccurrence { get; set; }
}
}
16 changes: 16 additions & 0 deletions src/Seq.Api/Model/Alerting/AlertOccurrenceRangePart.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Seq.Api.Model.LogEvents;
using Seq.Api.Model.Shared;

namespace Seq.Api.Model.Alerting
{
/// <summary>
/// An occurrence metric of an alert that triggered notifications.
/// </summary>
public class AlertOccurrenceRangePart
{
/// <summary>
/// The time grouping that triggered the alert.
/// </summary>
public DateTimeRange DetectedOverRange { get; set; }
}
}
7 changes: 1 addition & 6 deletions src/Seq.Api/Model/Apps/AppPackagePart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ public class AppPackagePart
/// Package authorship information.
/// </summary>
public string Authors { get; set; }

/// <summary>
/// URL of an icon for the app package.
/// </summary>
public string IconUrl { get; set; }


/// <summary>
/// URL of the package license.
/// </summary>
Expand Down
15 changes: 12 additions & 3 deletions src/Seq.Api/ResourceGroups/AlertsResourceGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Threading.Tasks;
using Seq.Api.Model;
using Seq.Api.Model.Alerting;
using Seq.Api.Model.Signals;
using Seq.Api.Model.Users;

namespace Seq.Api.ResourceGroups
Expand Down Expand Up @@ -55,17 +56,25 @@ public async Task<AlertEntity> FindAsync(string id, CancellationToken cancellati
public async Task<List<AlertEntity>> ListAsync(string ownerId = null, bool shared = false, CancellationToken cancellationToken = default)
{
var parameters = new Dictionary<string, object> { { "ownerId", ownerId }, { "shared", shared } };
return await GroupListAsync<AlertEntity>("Items", parameters, cancellationToken: cancellationToken).ConfigureAwait(false);
return await GroupListAsync<AlertEntity>("Items", parameters, cancellationToken).ConfigureAwait(false);
}

/// <summary>
/// Construct a alert with server defaults pre-initialized.
/// </summary>
/// <param name="cancellationToken"><see cref="CancellationToken"/> allowing the operation to be canceled.</param>
/// <param name="signal">The source of events that will contribute to the alert.</param>
/// <param name="query">An SQL query that will supply default clauses to the new alert.</param>
/// <returns>The unsaved alert.</returns>
public async Task<AlertEntity> TemplateAsync(CancellationToken cancellationToken = default)
public async Task<AlertEntity> TemplateAsync(SignalExpressionPart signal = null, string query = null, CancellationToken cancellationToken = default)
{
return await GroupGetAsync<AlertEntity>("Template", cancellationToken: cancellationToken).ConfigureAwait(false);
var parameters = new Dictionary<string, object>
{
["signal"] = signal?.ToString(),
["q"] = query
};

return await GroupGetAsync<AlertEntity>("Template", parameters, cancellationToken).ConfigureAwait(false);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion 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>2021.3.0</VersionPrefix>
<VersionPrefix>2021.3.1</VersionPrefix>
<Authors>Datalust;Contributors</Authors>
<TargetFramework>netstandard2.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down

0 comments on commit 06892fa

Please sign in to comment.