Documentation
¶
Overview ¶
Package spec holds structures to parse the metric specification for the GPU check.
Index ¶
- Variables
- func ExpectedMetricsForConfig(specs *Specs, config GPUConfig, options ValidationOptions) map[string]MetricSpec
- func IsModeSupportedByArchitecture(archSpec ArchitectureSpec, mode DeviceMode) bool
- func PrefixedMetricName(specs *Specs, metricName string) string
- func RequiredTagsForMetric(tagsSpec *TagsSpec, metricSpec MetricSpec) (map[string]TagSpec, map[string]TagSpec, error)
- func TagsToKeyValues(tags []string) map[string][]string
- type ArchitectureCapabilities
- type ArchitectureSpec
- type ArchitecturesSpec
- type DeviceMode
- type GPUConfig
- type MetricMetadataSpec
- type MetricObservation
- type MetricSpec
- type MetricStatus
- type MetricSupportSpec
- type MetricValidator
- type MetricValidatorRange
- type MetricsSpec
- type Specs
- type TagSpec
- type TagSummary
- type TagsSpec
- type TagsetSpec
- type UnsupportedFieldsByDeviceModeSpec
- type ValidationOptions
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
var AllDeviceModes = []DeviceMode{ DeviceModePhysical, DeviceModeMIG, DeviceModeVGPU, }
AllDeviceModes lists every device mode modeled by the GPU spec.
Functions ¶
func ExpectedMetricsForConfig ¶
func ExpectedMetricsForConfig(specs *Specs, config GPUConfig, options ValidationOptions) map[string]MetricSpec
ExpectedMetricsForConfig returns the spec metric names expected for a GPU config.
func IsModeSupportedByArchitecture ¶
func IsModeSupportedByArchitecture(archSpec ArchitectureSpec, mode DeviceMode) bool
IsModeSupportedByArchitecture returns true when the architecture supports the device mode.
func PrefixedMetricName ¶
PrefixedMetricName adds the spec metric prefix to a metric name if needed.
func RequiredTagsForMetric ¶
func RequiredTagsForMetric(tagsSpec *TagsSpec, metricSpec MetricSpec) (map[string]TagSpec, map[string]TagSpec, error)
RequiredTagsForMetric expands the required tags for a metric from tagsets and custom tags.
func TagsToKeyValues ¶
TagsToKeyValues converts Datadog-style tags to a key -> values map.
Types ¶
type ArchitectureCapabilities ¶
type ArchitectureCapabilities struct {
GPM bool `yaml:"gpm"`
UnsupportedFieldsByDeviceMode []UnsupportedFieldsByDeviceModeSpec `yaml:"unsupported_fields_by_device_mode"`
}
ArchitectureCapabilities defines capabilities and unsupported fields.
type ArchitectureSpec ¶
type ArchitectureSpec struct {
Capabilities ArchitectureCapabilities `yaml:"capabilities"`
UnsupportedDeviceModes []DeviceMode `yaml:"unsupported_device_modes"`
}
ArchitectureSpec defines architecture capabilities and unsupported device modes.
type ArchitecturesSpec ¶
type ArchitecturesSpec struct {
Architectures map[string]ArchitectureSpec `yaml:"architectures"`
}
ArchitecturesSpec is the YAML architecture capability specification.
func LoadArchitecturesSpec ¶
func LoadArchitecturesSpec() (*ArchitecturesSpec, error)
LoadArchitecturesSpec loads the canonical GPU architectures specification file.
type DeviceMode ¶
type DeviceMode string
DeviceMode identifies the GPU device operating mode in the spec.
const ( DeviceModePhysical DeviceMode = "physical" DeviceModeMIG DeviceMode = "mig" DeviceModeVGPU DeviceMode = "vgpu" )
type GPUConfig ¶
type GPUConfig struct {
Architecture string `json:"architecture"`
DeviceMode DeviceMode `json:"device_mode"`
}
GPUConfig identifies an architecture + device mode pair from the spec.
func KnownGPUConfigs ¶
KnownGPUConfigs returns all supported architecture + mode combinations.
func NewGPUConfigFromTags ¶
type MetricMetadataSpec ¶
type MetricMetadataSpec struct {
MetricType string `yaml:"metric_type,omitempty"`
Unit string `yaml:"unit,omitempty"`
Description string `yaml:"description,omitempty"`
}
MetricMetadataSpec defines metadata used to generate integrations metadata.csv rows.
func (*MetricMetadataSpec) UnmarshalYAML ¶
func (m *MetricMetadataSpec) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML validates metric metadata values while decoding.
type MetricObservation ¶
MetricObservation is the normalized observation used by shared validation.
type MetricSpec ¶
type MetricSpec struct {
Metadata *MetricMetadataSpec `yaml:"metadata,omitempty"`
Tagsets []string `yaml:"tagsets"`
CustomTags []string `yaml:"custom_tags,omitempty"`
WorkloadOnly bool `yaml:"workload_only,omitempty"`
Support MetricSupportSpec `yaml:"support"`
Validator *MetricValidator `yaml:"validator,omitempty"`
}
MetricSpec is a metric definition without the name (name is the map key).
func (MetricSpec) SupportsArchitecture ¶
func (m MetricSpec) SupportsArchitecture(arch string) bool
SupportsArchitecture returns true if the metric is supported on this architecture.
func (MetricSpec) SupportsConfig ¶
func (m MetricSpec) SupportsConfig(config GPUConfig) bool
SupportsConfig returns true if the metric is supported for the given GPU config.
func (MetricSpec) SupportsDeviceMode ¶
func (m MetricSpec) SupportsDeviceMode(mode DeviceMode) bool
SupportsDeviceMode returns true if the metric's device_modes explicitly allows the mode. device_modes values are expected to be booleans; missing means unsupported.
type MetricStatus ¶
type MetricStatus struct {
Missing int `json:"missing"`
Unknown int `json:"unknown"`
Unsupported int `json:"unsupported"`
WrongType int `json:"wrong_type"`
InvalidValue int `json:"invalid_value"`
InvalidValueSamples []string `json:"invalid_value_samples,omitempty"`
TagResults map[string]*TagSummary `json:"tag_results"`
}
func (*MetricStatus) HasFailures ¶
func (s *MetricStatus) HasFailures() bool
HasFailures returns true when the metric status contains metric-level or tag-level failures.
type MetricSupportSpec ¶
type MetricSupportSpec struct {
UnsupportedArchitectures []string `yaml:"unsupported_architectures"`
DeviceModes map[DeviceMode]bool `yaml:"device_modes"`
}
MetricSupportSpec defines where a metric is supported.
type MetricValidator ¶
type MetricValidator struct {
Range *MetricValidatorRange `yaml:"range,omitempty"`
Values []float64 `yaml:"values,omitempty"`
}
MetricValidator validates emitted metric values against the spec.
func (*MetricValidator) UnmarshalYAML ¶
func (v *MetricValidator) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML parses the supported validator shapes while keeping the internal fields private.
func (*MetricValidator) Validate ¶
func (v *MetricValidator) Validate(value float64) error
Validate checks whether the metric value matches the validator.
type MetricValidatorRange ¶
MetricValidatorRange defines an inclusive numeric range validator.
type MetricsSpec ¶
type MetricsSpec struct {
MetricPrefix string `yaml:"metric_prefix"`
Metrics map[string]MetricSpec `yaml:"metrics"`
}
MetricsSpec is the YAML metric specification.
func LoadMetricsSpec ¶
func LoadMetricsSpec() (*MetricsSpec, error)
LoadMetricsSpec loads the canonical GPU metrics specification file.
type Specs ¶
type Specs struct {
Metrics *MetricsSpec
Tags *TagsSpec
Architectures *ArchitecturesSpec
}
Specs bundles all GPU spec files used by validation and tests.
type TagSpec ¶
TagSpec defines validation metadata for a reusable tag.
func (*TagSpec) UnmarshalYAML ¶
UnmarshalYAML compiles the optional regex when the tag spec is decoded.
type TagSummary ¶
type TagsSpec ¶
type TagsSpec struct {
Tags map[string]TagSpec `yaml:"tags"`
Tagsets map[string]TagsetSpec `yaml:"tagsets"`
}
TagsSpec is the YAML tags specification.
func LoadTagsSpec ¶
LoadTagsSpec loads the canonical GPU tags specification file.
type TagsetSpec ¶
type TagsetSpec struct {
Tags []string `yaml:"tags"`
WorkloadOnly bool `yaml:"workload_only,omitempty"`
}
TagsetSpec defines a reusable tagset.
type UnsupportedFieldsByDeviceModeSpec ¶
type UnsupportedFieldsByDeviceModeSpec struct {
DeviceModes []DeviceMode `yaml:"device_modes"`
Fields []string `yaml:"fields"`
}
UnsupportedFieldsByDeviceModeSpec groups unsupported fields by device modes.
type ValidationOptions ¶
type ValidationOptions struct {
WorkloadActive bool `json:"workload_active"`
}
ValidationOptions controls which spec failures should be enforced.
type ValidationResult ¶
type ValidationResult struct {
Metrics map[string]*MetricStatus `json:"metrics"`
}
ValidationResult holds validation failures derived from spec expectations.
func ValidateEmittedMetricsAgainstSpec ¶
func ValidateEmittedMetricsAgainstSpec(specs *Specs, config GPUConfig, emittedMetrics map[string][]MetricObservation, knownTagValues map[string]string, options ValidationOptions) (ValidationResult, error)
ValidateEmittedMetricsAgainstSpec validates emitted metrics against the spec for a given GPU config.
func (*ValidationResult) HasFailures ¶
func (r *ValidationResult) HasFailures() bool
HasFailures returns true when the result contains metric-level or tag-level failures.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package main updates the billing allowlist with GPU metrics from the shared spec.
|
Package main updates the billing allowlist with GPU metrics from the shared spec. |
|
Package main updates integrations-core GPU metadata from the shared spec.
|
Package main updates integrations-core GPU metadata from the shared spec. |
|
Package main validates emitted GPU metrics against the shared spec.
|
Package main validates emitted GPU metrics against the shared spec. |