Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3b7d061
Initial Alert CLI implementation
amannix-ro Jul 13, 2026
5e1d571
update CLI args for alert creation
amannix-ro Jul 14, 2026
1d1be45
move aliased column parser into a dedicated utility
amannix-ro Jul 14, 2026
ff0573b
use preview container on Linux for now
amannix-ro Jul 14, 2026
a32b028
simplify alias expression parser and container tag passing
amannix-ro Jul 14, 2026
9339d5a
add alert enable/disable commands
amannix-ro Jul 14, 2026
77633b4
cleanup and refactoring based on review
KodrAus Jul 15, 2026
7322d34
Simulate the roasting process with correlated metrics, traces, and logs
amannix-ro Jul 21, 2026
35d6b33
update sample driver tests
KodrAus Jul 22, 2026
344545f
add a few more alerts to the sample
KodrAus Jul 22, 2026
619eb20
don't select sample data by default
KodrAus Jul 22, 2026
733fc61
update sample templates
KodrAus Jul 22, 2026
388257a
trigger roasting maintenance a few hours into ingest, rather than 30mins
KodrAus Jul 22, 2026
d232db1
reformat roastery
KodrAus Jul 22, 2026
b33a4cb
tweak maintenance schedule a bit more
KodrAus Jul 22, 2026
da67b39
use log scale for http histogram
KodrAus Jul 23, 2026
e03fcc0
further truncate the truncated message
KodrAus Jul 23, 2026
0a3e624
Merge pull request #478 from amannix-ro/feat/new-roastery-metrics
KodrAus Jul 23, 2026
ad19b36
document default notification level
KodrAus Jul 24, 2026
db11f48
Merge branch 'dev' of https://github.com/datalust/seqcli into feat/al…
KodrAus Jul 24, 2026
d68bfdb
use 2026.1 release container
KodrAus Jul 24, 2026
1b5f47f
Merge pull request #475 from amannix-ro/feat/alert-cli
KodrAus Jul 24, 2026
b089923
Reliably disable ANSI escaping in command output when output is redir…
Jul 28, 2026
573ba67
Be explicit about whether JSON output is supported or not
Jul 28, 2026
dcc11bf
Tiny comment tweak
Jul 28, 2026
4162fdd
Merge pull request #480 from nblumhardt-ro/ansi-escapes
nblumhardt Jul 29, 2026
df5dd40
Remove use of Serilog.Sinks.Console theming to improve consistency; a…
Jul 29, 2026
1e43ae1
Separate tracing functions from output template factories
Jul 29, 2026
af979bf
Match the original Flare theme; drop properties from plain-text outpu…
nblumhardt Jul 29, 2026
085be91
Update tests
nblumhardt Jul 29, 2026
896d42b
JSON output is now free of added whitespace
nblumhardt Jul 29, 2026
7b1947e
Push towards consistent line endings on Windows
nblumhardt Jul 29, 2026
144cc5b
Fix more line endings
nblumhardt Jul 30, 2026
ff88ab3
Remove obsolete test
nblumhardt Jul 30, 2026
8d5a9e8
Merge pull request #481 from nblumhardt-ro/template-theme
nblumhardt Jul 30, 2026
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
SEQ_DOCKER_TAG: 2026.1
shell: pwsh
run: |
./build/Build.Linux.ps1
./build/Build.Linux.ps1 -SeqDockerTag $env:SEQ_DOCKER_TAG
144 changes: 144 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ seqcli help apikey

Available commands:

- `alert`
- [`alert create`](#alert-create) — Create an alert.
- [`alert disable`](#alert-disable) — Disable one or more alerts.
- [`alert enable`](#alert-enable) — Enable one or more alerts.
- [`alert list`](#alert-list) — List alerts.
- [`alert remove`](#alert-remove) — Remove an alert from the server.
- [`alert update`](#alert-update) — Update an existing alert.
- `apikey`
- [`apikey create`](#apikey-create) — Create an API key for automation or ingestion.
- [`apikey list`](#apikey-list) — List available API keys.
Expand Down Expand Up @@ -221,6 +228,143 @@ Available commands:
- [`workspace remove`](#workspace-remove) — Remove a workspace from the server.
- [`workspace update`](#workspace-update) — Update an existing workspace.

### `alert create`

Create an alert.

Example:

```
seqcli alert create -t 'Too many errors' --select "count(*) as errors" --from stream --signal signal-m33302 --where "@Level = 'Error'" --window 5m --having "errors > 10" --notification-level Error --suppression-time 10m
```

| Option | Description |
| ------ | ----------- |
| `-t`, `--title=VALUE` | A title for the alert |
| `--description=VALUE` | A description for the alert |
| `--from=VALUE` | The data source the alert queries; either `stream` (the default) or `series` |
| `--signal=VALUE` | A signal expression limiting the alert's input, for example `signal-1` or `signal-1,signal-2` |
| `--lateral=VALUE` | A lateral join over a set-valued function applied to the data source, in the form `<setFunctionCall> as <alias>`, for example `unnest(http.server.request.duration.buckets) as bucket`; this argument can be used multiple times |
| `--where=VALUE` | A predicate that selects the events the alert will consider |
| `--select=VALUE` | A measurement the alert condition will test, for example `count(*) as errors`; this argument can be used multiple times |
| `--group-by=VALUE` | An expression to group measurements by, for example `ServiceName` or `ServiceName ci as service`; the `ci` modifier makes the grouping case-insensitive; this argument can be used multiple times |
| `--window=VALUE` | The measurement window over which the alert condition is evaluated, as a duration, for example `1m` or `1h` |
| `--having=VALUE` | The alert condition; a predicate over the grouped measurements, for example `errors > 10` |
| `--notification-level=VALUE` | The level of the notifications raised by the alert, for example `Warning` or `Error` |
| `--suppression-time=VALUE` | A duration for which notifications are suppressed after the alert triggers, for example `10m` or `1h` |
| `--notification-app=VALUE` | The id of an app instance that will be notified when the alert triggers; this argument can be used multiple times |
| `--protected` | Specify that the alert is editable only by administrators |
| `--disabled` | Create the alert in a disabled state; disabled alerts are not processed and do not send notifications |
| `-s`, `--server=VALUE` | The URL of the Seq server; by default the `connection.serverUrl` config value will be used |
| `-a`, `--apikey=VALUE` | The API key to use when connecting to the server; by default the `connection.apiKey` config value will be used |
| `--profile=VALUE` | A connection profile to use; by default the `connection.serverUrl` and `connection.apiKey` config values will be used |
| `--json` | Print output in newline-delimited JSON (the default is plain text) |
| `--no-color` | Don't colorize text output |
| `--force-color` | Force redirected output to have ANSI color (unless `--no-color` is also specified) |
| `--storage=VALUE` | The folder where `SeqCli.json` and other data will be stored; falls back to `SEQCLI_STORAGE_PATH` from the environment, then the `seqcli forwarder` service's configured storage path (Windows only), then the current user's home directory |

### `alert disable`

Disable one or more alerts.

Example:

```
seqcli alert disable -t 'Too many errors'
```

| Option | Description |
| ------ | ----------- |
| `-t`, `--title=VALUE` | The title of the alert(s) to disable |
| `-i`, `--id=VALUE` | The id of a single alert to disable |
| `-o`, `--owner=VALUE` | The id of the user to disable alerts for; by default, shared alerts are disabled |
| `-s`, `--server=VALUE` | The URL of the Seq server; by default the `connection.serverUrl` config value will be used |
| `-a`, `--apikey=VALUE` | The API key to use when connecting to the server; by default the `connection.apiKey` config value will be used |
| `--profile=VALUE` | A connection profile to use; by default the `connection.serverUrl` and `connection.apiKey` config values will be used |
| `--storage=VALUE` | The folder where `SeqCli.json` and other data will be stored; falls back to `SEQCLI_STORAGE_PATH` from the environment, then the `seqcli forwarder` service's configured storage path (Windows only), then the current user's home directory |

### `alert enable`

Enable one or more alerts.

Example:

```
seqcli alert enable -t 'Too many errors'
```

| Option | Description |
| ------ | ----------- |
| `-t`, `--title=VALUE` | The title of the alert(s) to enable |
| `-i`, `--id=VALUE` | The id of a single alert to enable |
| `-o`, `--owner=VALUE` | The id of the user to enable alerts for; by default, shared alerts are enabled |
| `-s`, `--server=VALUE` | The URL of the Seq server; by default the `connection.serverUrl` config value will be used |
| `-a`, `--apikey=VALUE` | The API key to use when connecting to the server; by default the `connection.apiKey` config value will be used |
| `--profile=VALUE` | A connection profile to use; by default the `connection.serverUrl` and `connection.apiKey` config values will be used |
| `--storage=VALUE` | The folder where `SeqCli.json` and other data will be stored; falls back to `SEQCLI_STORAGE_PATH` from the environment, then the `seqcli forwarder` service's configured storage path (Windows only), then the current user's home directory |

### `alert list`

List alerts.

Example:

```
seqcli alert list
```

| Option | Description |
| ------ | ----------- |
| `-t`, `--title=VALUE` | The title of the alert(s) to list |
| `-i`, `--id=VALUE` | The id of a single alert to list |
| `-o`, `--owner=VALUE` | The id of the user to list alerts for; by default, shared alerts are listed |
| `--json` | Print output in newline-delimited JSON (the default is plain text) |
| `--no-color` | Don't colorize text output |
| `--force-color` | Force redirected output to have ANSI color (unless `--no-color` is also specified) |
| `--storage=VALUE` | The folder where `SeqCli.json` and other data will be stored; falls back to `SEQCLI_STORAGE_PATH` from the environment, then the `seqcli forwarder` service's configured storage path (Windows only), then the current user's home directory |
| `-s`, `--server=VALUE` | The URL of the Seq server; by default the `connection.serverUrl` config value will be used |
| `-a`, `--apikey=VALUE` | The API key to use when connecting to the server; by default the `connection.apiKey` config value will be used |
| `--profile=VALUE` | A connection profile to use; by default the `connection.serverUrl` and `connection.apiKey` config values will be used |

### `alert remove`

Remove an alert from the server.

Example:

```
seqcli alert remove -t 'Too many errors'
```

| Option | Description |
| ------ | ----------- |
| `-t`, `--title=VALUE` | The title of the alert(s) to remove |
| `-i`, `--id=VALUE` | The id of a single alert to remove |
| `-o`, `--owner=VALUE` | The id of the user to remove alerts for; by default, shared alerts are removed |
| `-s`, `--server=VALUE` | The URL of the Seq server; by default the `connection.serverUrl` config value will be used |
| `-a`, `--apikey=VALUE` | The API key to use when connecting to the server; by default the `connection.apiKey` config value will be used |
| `--profile=VALUE` | A connection profile to use; by default the `connection.serverUrl` and `connection.apiKey` config values will be used |
| `--storage=VALUE` | The folder where `SeqCli.json` and other data will be stored; falls back to `SEQCLI_STORAGE_PATH` from the environment, then the `seqcli forwarder` service's configured storage path (Windows only), then the current user's home directory |

### `alert update`

Update an existing alert.

Example:

```
seqcli alert update --json '{...}'
```

| Option | Description |
| ------ | ----------- |
| `--json=VALUE` | The updated alert in JSON format; this can be produced using `seqcli alert list --json` |
| `--json-stdin` | Read the updated alert as JSON from `STDIN` |
| `-s`, `--server=VALUE` | The URL of the Seq server; by default the `connection.serverUrl` config value will be used |
| `-a`, `--apikey=VALUE` | The API key to use when connecting to the server; by default the `connection.apiKey` config value will be used |
| `--profile=VALUE` | A connection profile to use; by default the `connection.serverUrl` and `connection.apiKey` config values will be used |
| `--storage=VALUE` | The folder where `SeqCli.json` and other data will be stored; falls back to `SEQCLI_STORAGE_PATH` from the environment, then the `seqcli forwarder` service's configured storage path (Windows only), then the current user's home directory |

### `apikey create`

Create an API key for automation or ingestion.
Expand Down
8 changes: 6 additions & 2 deletions build/Build.Linux.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
param(
[string] $SeqDockerTag = "latest"
)

Push-Location $PSScriptRoot/../

. ./build/Build.Common.ps1
Expand All @@ -23,8 +27,8 @@ function Execute-Tests
if ($LASTEXITCODE -ne 0) { exit 1 }

cd ./test/SeqCli.EndToEnd/
docker pull datalust/seq:latest
& dotnet run -f $framework -- --docker-server
docker pull datalust/seq:$SeqDockerTag
& dotnet run -f $framework -- --docker-server --docker-tag=$SeqDockerTag
if ($LASTEXITCODE -ne 0)
{
cd ../..
Expand Down
13 changes: 6 additions & 7 deletions src/Roastery/Agents/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ namespace Roastery.Agents;
abstract class Agent
{
protected delegate Task Behavior(CancellationToken cancellationToken);

readonly int _meanBehaviorIntervalMilliseconds;

protected Agent(int meanBehaviorIntervalMilliseconds)
{
_meanBehaviorIntervalMilliseconds = meanBehaviorIntervalMilliseconds;
}

public static Task Run(Agent agent, CancellationToken cancellationToken)
{
return Task.Run(() => agent.RunBehaviorsAsync(cancellationToken), cancellationToken);
Expand All @@ -32,8 +32,8 @@ async Task RunBehaviorsAsync(CancellationToken cancellationToken)
{
var behavior = Distribution.Uniform(behaviors);

await Task.Delay((int) Distribution.Uniform(0, _meanBehaviorIntervalMilliseconds), cancellationToken);
await Task.Delay((int)Distribution.Uniform(0, _meanBehaviorIntervalMilliseconds), cancellationToken);

try
{
await behavior(cancellationToken);
Expand All @@ -42,10 +42,9 @@ async Task RunBehaviorsAsync(CancellationToken cancellationToken)
{
// Exceptions are swallowed here; agents can log exceptions if they wish
}

await Task.Delay(_meanBehaviorIntervalMilliseconds / 2 +
(int) (_meanBehaviorIntervalMilliseconds * Distribution.Uniform()), cancellationToken);

await Task.Delay(_meanBehaviorIntervalMilliseconds / 2 +
(int)(_meanBehaviorIntervalMilliseconds * Distribution.Uniform()), cancellationToken);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Roastery/Agents/ArchivingBatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ArchivingBatch : Agent
readonly HttpClient _client;
readonly ILogger _logger;

public ArchivingBatch(HttpClient client, ILogger logger)
public ArchivingBatch(HttpClient client, ILogger logger)
: base(30000)
{
_client = client;
Expand All @@ -33,7 +33,7 @@ async Task DeleteAbandonedCarts(CancellationToken cancellationToken)
try
{
_logger.Information("Identifying abandoned orders");

var orders = await _client.GetAsync<List<Order>>("api/orders");
foreach (var order in orders)
{
Expand All @@ -60,7 +60,7 @@ async Task ArchiveShippedOrders(CancellationToken cancellationToken)
try
{
_logger.Information("Archiving completed orders");

var orders = await _client.GetAsync<List<Order>>("api/orders");
foreach (var order in orders)
{
Expand Down
21 changes: 14 additions & 7 deletions src/Roastery/Agents/CatalogBatch.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Roastery.Model;
using Roastery.Util;
using Roastery.Web;
using Serilog;
using Serilog.Context;
Expand All @@ -27,21 +27,28 @@ protected override IEnumerable<Behavior> GetBehaviors()
yield return CheckStock;
}

const double LowStockThresholdKilograms = 40;

async Task CheckStock(CancellationToken cancellationToken)
{
using var _ = LogContext.PushProperty("BatchId", Guid.NewGuid());
try
{
_logger.Information("Checking stock levels");


var inventory = await _httpClient.GetAsync<List<Inventory>>("api/inventory");
var stockByBlend = inventory.ToDictionary(i => i.Blend, i => i.QuantityKilograms);

foreach (var product in await _httpClient.GetAsync<List<Product>>("api/products"))
{
_logger.Information("Checking product {ProductDescription} ({ProductId})", product.FormatDescription(), product.Id);

if (Distribution.OnceIn(30))
_logger.Warning("Product {ProductId} is low on stock", product.Id);
else if (Distribution.OnceIn(70))
_logger.Information("Checking product {ProductDescription} ({ProductId})", product.FormatDescription(),
product.Id);

var stock = stockByBlend.GetValueOrDefault(product.Blend);
if (stock < product.SizeInGrams / 1000.0)
_logger.Warning("Product {ProductId} is out of stock", product.Id);
else if (stock < LowStockThresholdKilograms)
_logger.Warning("Product {ProductId} is low on stock", product.Id);
}
}
catch (Exception ex)
Expand Down
6 changes: 3 additions & 3 deletions src/Roastery/Agents/Customer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ async Task CreateOrder(CancellationToken cancellationToken)
var orderPath = $"api/orders/{order.Id}";
var addItemPath = $"{orderPath}/items";
var products = await _httpClient.GetAsync<List<Product>>("api/products");
var items = (int) Distribution.Uniform(1, 5);
var items = (int)Distribution.Uniform(1, 5);
for (var i = 0; i < items; ++i)
{
await Task.Delay((int)Distribution.Uniform(5000, 20000), cancellationToken);

var product = Distribution.Uniform(products);
await _httpClient.PostAsync<OrderItem>(addItemPath, new OrderItem(order.Id!, product.Id!));
}

if (Distribution.OnceIn(15))
return; // Abandon cart :-)

// Customer has ~90s to place order before it'll be cleaned up as abandoned; some will be too slow
await Task.Delay((int)Distribution.Uniform(10000, 70000), cancellationToken);

Expand Down
Loading