Ping
Endpoint health probes — single-shot and streaming.
Namespace: Goodmem.Client.Api · Class: PingApi
Reach this surface as client.Ping on a GoodmemClient. Every network method is asynchronous — it returns a Task<T> (or an IAsyncEnumerable<T> for pagination and streaming) and accepts a CancellationToken; the Async suffix marks the standard .NET Task-based async pattern.
Methods
| Method | Summary |
|---|---|
OnceAsync | Run a single ping probe. |
StreamAsync | Stream ping probe results. |
OnceAsync
Runs a single ping probe and returns the probe result.
Declaration
public Task<PingResult> OnceAsync(PingOnceRequest request, CancellationToken ct = default)
HTTP — POST /v1/ping:once
Parameters
| Type | Name | Description |
|---|---|---|
PingOnceRequest | request | The request payload; the linked model lists every field and its JSON wire name. |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<PingResult> — an awaitable that resolves to PingResult.
Exceptions
| Type | Condition |
|---|---|
ArgumentNullException | request is null. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409). |
Example
var result = await client.Ping.OnceAsync(
new PingOnceRequest { TargetId = "your-embedder-id" }
);
Console.WriteLine($"{result.RttMs}ms ok={result.Ok}");StreamAsync
Opens a streaming ping session and returns per-probe results plus a terminal summary.
Declaration
public IAsyncEnumerable<PingEvent> StreamAsync(PingStreamRequest request, CancellationToken ct = default)
HTTP — POST /v1/ping:stream
Parameters
| Type | Name | Description |
|---|---|---|
PingStreamRequest | request | The request payload; the linked model lists every field and its JSON wire name. |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
IAsyncEnumerable<PingEvent> — an async stream; await foreach yields each PingEvent across pages / events.
Exceptions
| Type | Condition |
|---|---|
ArgumentNullException | request is null. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409). |
Example
await foreach (
var ev in client.Ping.StreamAsync(
new PingStreamRequest { TargetId = "your-embedder-id", Count = 2 }
)
)
{
if (ev.Result is { } result)
Console.WriteLine($"{result.Seq}: {result.RttMs}ms");
}Data Models
Types in the Goodmem.Client.Models namespace. Each row lists the C# property, its type, the JSON wire name, and a description.
PingOnceRequest
Request payload for a single ping probe
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
TargetId | string | targetId | Target resource ID (UUID) |
TargetTypeHint | PingTargetType | targetTypeHint | Optional hint for the target resource type (optional) |
PayloadType | PingPayloadType | payloadType | Desired payload type (defaults to provider-specific value) (optional) |
Payload | string | payload | Explicit UTF-8 payload to send with the probe (mutually exclusive with payloadSizeBytes) (optional) |
PayloadSizeBytes | int | payloadSizeBytes | Synthetic payload size in bytes (mutually exclusive with payload) (optional) |
TimeoutMs | int | timeoutMs | Per-probe timeout in milliseconds (0 uses server default) (optional) |
PingTargetType
Target types for ping operations
String enum: "TARGET_TYPE_UNSPECIFIED" · "EMBEDDER" · "RERANKER" · "LLM"
PingPayloadType
Payload types supported by ping operations
String enum: "PAYLOAD_TYPE_UNSPECIFIED" · "TEXT" · "JSON" · "BINARY"
PingResult
Result from an individual ping probe
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Endpoint | PingEndpointInfo | endpoint | Resolved endpoint metadata for the target |
Seq | int | seq | Sequential probe number (1-based) |
BytesSent | int | bytesSent | Payload bytes transmitted |
BytesReceived | int | bytesReceived | Payload bytes received |
Ok | bool | ok | True when the provider responded successfully within the timeout |
HttpStatus | int | httpStatus | Provider HTTP status code or equivalent transport status |
ErrorMessage | string | errorMessage | Human-readable error message when ok=false (optional) |
RttMs | double | rttMs | Observed round-trip latency in milliseconds |
Timing | PingTiming | timing | Raw timing data recorded on the server |
Metadata | IReadOnlyDictionary<string, string> | metadata | Additional provider metadata (request IDs, throttling signals, etc.) (optional) |
PingEndpointInfo
Resolved endpoint metadata for ping responses
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
TargetType | PingTargetType | targetType | Resolved resource type |
TargetId | string | targetId | Target resource ID (UUID) |
ResolvedEndpoint | string | resolvedEndpoint | Fully resolved endpoint URL used for the probe |
Provider | string | provider | Provider name backing the resource |
ModelIdentifier | string | modelIdentifier | Provider-specific model identifier |
PingTiming
Timing information captured during a ping probe
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
ClientSendTimeUnixNanos | long | clientSendTimeUnixNanos | Client send time (Unix epoch nanoseconds) |
ServerReceivedTimeUnixNanos | long | serverReceivedTimeUnixNanos | Server received time (Unix epoch nanoseconds) |
ServerSendTimeUnixNanos | long | serverSendTimeUnixNanos | Server send time (Unix epoch nanoseconds) |
ClientReceiveTimeUnixNanos | long | clientReceiveTimeUnixNanos | Client receive time (Unix epoch nanoseconds) |
PingStreamRequest
Request payload for a streaming ping session
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
TargetId | string | targetId | Target resource ID (UUID) |
TargetTypeHint | PingTargetType | targetTypeHint | Optional hint for the target resource type (optional) |
Count | int | count | Number of probes to run (0 uses server default) (optional) |
IntervalMs | int | intervalMs | Delay between probes in milliseconds (0 uses server default) (optional) |
TimeoutMs | int | timeoutMs | Per-probe timeout in milliseconds (0 uses server default) (optional) |
PayloadType | PingPayloadType | payloadType | Desired payload type (defaults to provider-specific value) (optional) |
Payload | string | payload | Explicit UTF-8 payload to send with each probe (mutually exclusive with payloadSizeBytes) (optional) |
PayloadSizeBytes | int | payloadSizeBytes | Synthetic payload size in bytes (mutually exclusive with payload) (optional) |
MaxInFlight | int | maxInFlight | Maximum concurrent probes (defaults to 1) (optional) |
Jitter | bool | jitter | Add jitter to probe scheduling (optional) |
Labels | IReadOnlyDictionary<string, string> | labels | Optional labels to attach to the ping session (optional) |
PingEvent
Streaming event from a ping session
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Result | PingResult | result | Probe result event (optional) |
Summary | PingSummary | summary | Summary emitted at session completion (optional) |
Notice | PingNotice | notice | Non-fatal notice emitted during session (optional) |
PingSummary
Summary emitted at the end of a ping session
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Endpoint | PingEndpointInfo | endpoint | Endpoint metadata copied from the final probe |
Requests | int | requests | Total number of probes scheduled |
Responses | int | responses | Number of responses received (including timeouts/errors) |
Ok | int | ok | Count of probes that succeeded |
Timeouts | int | timeouts | Count of probes that exceeded the timeout |
Errors | int | errors | Count of probes that failed for other reasons |
RttMinMs | double | rttMinMs | Minimum observed round-trip latency (ms) |
RttAvgMs | double | rttAvgMs | Average observed round-trip latency (ms) |
RttP50Ms | double | rttP50Ms | Median (p50) round-trip latency (ms) |
RttP90Ms | double | rttP90Ms | 90th percentile round-trip latency (ms) |
RttP99Ms | double | rttP99Ms | 99th percentile round-trip latency (ms) |
RttMaxMs | double | rttMaxMs | Maximum observed round-trip latency (ms) |
RequestsPerSecond | double | requestsPerSecond | Effective request throughput across the session |
BytesPerSecond | double | bytesPerSecond | Aggregate bytes per second (send + receive) |
AppliedLimits | IReadOnlyDictionary<string, string> | appliedLimits | Resource limits applied by the server (optional) |
PingNotice
Non-fatal notice emitted during a ping session
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Code | string | code | Machine-readable notice identifier |
Message | string | message | Human-readable notice message |
Details | IReadOnlyDictionary<string, string> | details | Additional contextual details (optional) |