Implementation:SeldonIO Seldon core Hodometer Metrics
| Knowledge Sources | |
|---|---|
| Domains | Observability, Data_Model, Usage_Telemetry |
| Last Updated | 2026-02-13 14:00 GMT |
Overview
Concrete data model structs defining the schema for all usage metrics collected and published by the Hodometer component.
Description
The UsageMetrics struct is the top-level container that embeds four metric categories: CollectorMetrics (collector version and git commit), ClusterMetrics (cluster ID, Seldon Core version, Kubernetes version), ResourceMetrics (counts of models, pipelines, experiments, servers, and server replicas), and FeatureMetrics (multi-model enabled count, overcommit count, GPU count, CPU cores, and memory). All fields carry JSON struct tags for serialization during publishing.
Usage
Use these structs when collecting, aggregating, or publishing Hodometer usage telemetry. The SeldonCoreCollector populates a UsageMetrics instance, and the JsonPublisher serializes it for transmission.
Code Reference
Source Location
- Repository: SeldonIO_Seldon_core
- File: hodometer/pkg/hodometer/metrics.go
- Lines: 1-48
Signature
type UsageMetrics struct {
CollectorMetrics
ClusterMetrics
ResourceMetrics
FeatureMetrics
}
type CollectorMetrics struct {
CollectorVersion string `json:"collector_version"`
CollectorGitCommit string `json:"collector_git_commit"`
}
type ClusterMetrics struct {
ClusterId string `json:"cluster_id"`
SeldonCoreVersion string `json:"seldon_core_version"`
KubernetesMetrics
}
type KubernetesMetrics struct {
KubernetesVersion string `json:"kubernetes_version"`
}
type ResourceMetrics struct {
ModelCount uint `json:"model_count"`
PipelineCount uint `json:"pipeline_count"`
ExperimentCount uint `json:"experiment_count"`
ServerCount uint `json:"server_count"`
ServerReplicaCount uint `json:"server_replica_count"`
}
type FeatureMetrics struct {
MultimodelEnabledCount uint `json:"multimodel_enabled_count"`
OvercommitEnabledCount uint `json:"overcommit_enabled_count"`
GpuEnabledCount uint `json:"gpu_enabled_count"`
ServerCpuCoresSum float32 `json:"server_cpu_cores_sum"`
ServerMemoryGbSum float32 `json:"server_memory_gb_sum"`
}
Import
import "github.com/seldonio/seldon-core/hodometer/pkg/hodometer"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (struct fields) | various | Yes | Populated by SeldonCoreCollector.Collect() |
Outputs
| Name | Type | Description |
|---|---|---|
| UsageMetrics | struct | Top-level metrics container with all embedded metric categories |
| JSON serialization | JSON object | Flat key-value representation via json struct tags |
Usage Examples
Inspecting Metrics
metrics := collector.Collect(ctx, hodometer.MetricsLevelFeature)
// Access cluster-level metrics
fmt.Println("Cluster ID:", metrics.ClusterId)
fmt.Println("K8s Version:", metrics.KubernetesVersion)
fmt.Println("Seldon Version:", metrics.SeldonCoreVersion)
// Access resource-level metrics
fmt.Println("Models:", metrics.ResourceMetrics.ModelCount)
fmt.Println("Pipelines:", metrics.ResourceMetrics.PipelineCount)
fmt.Println("Servers:", metrics.ResourceMetrics.ServerCount)
// Access feature-level metrics
fmt.Println("Multi-model Servers:", metrics.FeatureMetrics.MultimodelEnabledCount)
fmt.Println("Memory (GB):", metrics.FeatureMetrics.ServerMemoryGbSum)