docs: add C# MONITOR command support - #294
Open
Aryex wants to merge 2 commits into
Open
Conversation
Signed-off-by: kiro-agent <kiro-agent@users.noreply.github.com>
Aryex
force-pushed
the
alexl/agent/csharp-monitor-command
branch
from
July 26, 2026 21:28
8814031 to
b4fba3e
Compare
Aryex
marked this pull request as ready for review
July 27, 2026 14:53
currantw
reviewed
Jul 28, 2026
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`. |
Collaborator
There was a problem hiding this comment.
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. | ||
| ::: |
Collaborator
There was a problem hiding this comment.
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)}"); | ||
| } | ||
| ``` |
Collaborator
There was a problem hiding this comment.
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 | | |||
Collaborator
There was a problem hiding this comment.
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>` | |
Collaborator
There was a problem hiding this comment.
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. |
Collaborator
There was a problem hiding this comment.
C#-only section does not seem necessary.
affonsov
reviewed
Jul 29, 2026
affonsov
left a comment
Collaborator
There was a problem hiding this comment.
This PR should wait for the feature be released on Csharp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add C# MONITOR command documentation to the existing monitor-command how-to page and mark the command as available in the progress tracker.
Source Commits
6c4e778—MONITORcommand support (#456)Changes
available-commands.json: changed C# status for MONITOR fromnot_availabletoavailable, added doc page href<TabItem>to both Callback mode and Queue mode example sections with notes explaining that C# usesIAsyncEnumerable<MonitorMessage>instead of callbacks/queuesMonitorConfigfluent API (WithTls,WithAuth,WithDatabase)MonitorMessageproperty typesContext
C# #456 implements
MonitorClientwith aCreateClient(MonitorConfig)factory andGetMessagesAsync()returningIAsyncEnumerable<MonitorMessage>. Unlike the Python/Node/Java/Go clients which use callback or queue modes, the C# client uses idiomaticawait foreachwith nativeCancellationTokensupport.MonitorConfigprovides a fluent builder API with secure credential handling (IDisposablewith password array clearing). Standalone mode only, consistent with all other GLIDE clients.cc @currantw
This PR was generated by the automated documentation pipeline.