GetTelemetry()
This operation returns the client telemetry manager for collecting and reporting client-side metrics.
func (c *Client) GetTelemetry() *ClientTelemetryManager
RETURN TYPE:
ClientTelemetryManager
RETURNS:
The telemetry manager associated with this client, or nil if telemetry is not enabled.
METHODS:
-
GetClientID (string) -
Returns the unique client ID (UUID) assigned to this client; it stays stable for the lifetime of the client across gRPC reconnects.
-
GetConfigHash (string) -
Returns the hash of the telemetry configuration currently in effect.
-
GetMetricsSnapshots ([]MetricsSnapshot*) -
Returns all historical metrics snapshots collected by the manager.
-
GetLatestSnapshot (*MetricsSnapshot) -
Returns the most recent metrics snapshot, or nil when none exists.
-
GetRecentErrors ([]ErrorInfo*) -
Returns the most recent errors collected for debugging, up to the requested count.
-
IsReady (bool) -
Reports whether the client has completed its initial telemetry setup.
-
IsSupported (bool) -
Reports whether the connected Milvus server supports client-side telemetry, based on the latest heartbeat outcome.
-
LastHeartbeatError (error) -
Returns the most recent heartbeat failure, or nil when the last heartbeat succeeded.
ERROR HANDLING:
-
error
Validation, request construction, or the RPC fails. Check the returned error for failure details.
Example
Demonstrates GetTelemetry() usage.
import (
"context"
"fmt"
"log"
"github.com/milvus-io/milvus/client/v3/milvusclient"
)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
milvusAddr := "YOUR_CLUSTER_ENDPOINT"
cli, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: milvusAddr,
})
if err != nil {
log.Fatal("failed to connect to milvus server: ", err.Error())
}
defer cli.Close(ctx)
telemetry := cli.GetTelemetry()
if telemetry != nil {
fmt.Println("Telemetry client ID:", telemetry.GetClientID())
}