Skip to content

docs: add C# MONITOR command support - #294

Open
Aryex wants to merge 2 commits into
mainfrom
alexl/agent/csharp-monitor-command
Open

docs: add C# MONITOR command support#294
Aryex wants to merge 2 commits into
mainfrom
alexl/agent/csharp-monitor-command

Conversation

@Aryex

@Aryex Aryex commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add C# MONITOR command documentation to the existing monitor-command how-to page and mark the command as available in the progress tracker.

⚠️ Attention: This PR was generated automatically. Verify that all relevant pages have been updated.

Source Commits

  • 6c4e778MONITOR command support (#456)

Changes

  • Updated available-commands.json: changed C# status for MONITOR from not_available to available, added doc page href
  • Added C# <TabItem> to both Callback mode and Queue mode example sections with notes explaining that C# uses IAsyncEnumerable<MonitorMessage> instead of callbacks/queues
  • Added "C# Configuration" section documenting the MonitorConfig fluent API (WithTls, WithAuth, WithDatabase)
  • Added "C# Type Mapping" section documenting MonitorMessage property types
  • Updated introductory text to include C# in the list of supported clients

Context

C# #456 implements MonitorClient with a CreateClient(MonitorConfig) factory and GetMessagesAsync() returning IAsyncEnumerable<MonitorMessage>. Unlike the Python/Node/Java/Go clients which use callback or queue modes, the C# client uses idiomatic await foreach with native CancellationToken support. MonitorConfig provides a fluent builder API with secure credential handling (IDisposable with password array clearing). Standalone mode only, consistent with all other GLIDE clients.

cc @currantw


This PR was generated by the automated documentation pipeline.

@Aryex Aryex added AI Generated documentation Improvements or additions to documentation csharp labels Jul 26, 2026
Signed-off-by: kiro-agent <kiro-agent@users.noreply.github.com>
@Aryex
Aryex force-pushed the alexl/agent/csharp-monitor-command branch from 8814031 to b4fba3e Compare July 26, 2026 21:28
@Aryex
Aryex requested review from affonsov and jeremyprime July 27, 2026 14:53
@Aryex
Aryex marked this pull request as ready for review July 27, 2026 14:53
@jeremyprime
jeremyprime requested review from currantw and removed request for jeremyprime July 27, 2026 15:36

@currantw currantw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed to 7ae2a77.
I will implement and push these changes.

Comment on lines 22 to 25
There are two modes for consuming monitor messages:

* **Callback mode** — provide a callback function at creation time; it is invoked for every incoming message.
* **Queue mode** — omit the callback; messages are queued internally and retrieved by calling `getMonitorMessage` / `tryGetMonitorMessage`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this also need to be updated to account for C# client.

Comment on lines +117 to +120
<TabItem label="C#">
:::note
The C# client uses `IAsyncEnumerable<MonitorMessage>` instead of callbacks. Messages are consumed via `await foreach` with native cancellation support.
:::

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we update the comments above, I don't think this comment will be necessary.

Comment on lines +122 to +137
```csharp
using Valkey.Glide;

// Create a MonitorConfig (implements IDisposable for secure credential handling)
using var config = new MonitorConfig("localhost", 6379);

// Create the monitor client
await using var monitor = await MonitorClient.CreateClient(config);

// Consume messages as an async stream with cancellation support
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
await foreach (MonitorMessage msg in monitor.GetMessagesAsync(cts.Token))
{
Console.WriteLine($"{msg.Timestamp:O} [{msg.Database}] {msg.ClientAddress} {msg.Command} {string.Join(" ", msg.Args)}");
}
```

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix the C# examples validation.

Comment on lines 261 to 271
@@ -209,3 +269,15 @@
| `clientAddr` | string | Address of the client that issued the command |
| `command` | string | Command name |
| `args` | list/array | Command arguments |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be generalized to apply to all clients.

Comment on lines +273 to +283
## C# Type Mapping

In the C# client, `MonitorMessage` is a strongly-typed class:

| Property | Type |
| --- | --- |
| `Timestamp` | `DateTimeOffset` |
| `Database` | `ushort` |
| `ClientAddress` | `string` |
| `Command` | `string` |
| `Args` | `IReadOnlyList<string>` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This C#-only block should not be necessary.

Comment on lines +247 to +259
## C# Configuration

The C# client uses the `MonitorConfig` fluent API for connection configuration:

```csharp
using var config = new MonitorConfig("localhost", 6379)
.WithTls() // Enable TLS
.WithAuth("password") // Password-only auth
.WithAuth("user", "password") // Username + password auth
.WithDatabase(2); // Select database
```

Note: `MonitorConfig` implements `IDisposable` — it clears the password array on dispose for secure credential handling.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C#-only section does not seem necessary.

@affonsov affonsov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should wait for the feature be released on Csharp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated csharp documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants