Skip to content

Commit

Permalink
Deprecate redundant metric type and undeprecate MatchPattern/Value.
Browse files Browse the repository at this point in the history
  • Loading branch information
dplepage-dd committed Jan 13, 2025
1 parent bf80e6e commit bc8ad92
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions pkg/networkdevice/profile/profiledefinition/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ type SymbolConfig struct {
ExtractValue string `yaml:"extract_value,omitempty" json:"extract_value,omitempty"`
ExtractValueCompiled *regexp.Regexp `yaml:"-" json:"-"`

// MatchPattern/MatchValue are not exposed as json (UI) since ExtractValue can be used instead
MatchPattern string `yaml:"match_pattern,omitempty" json:"-"`
MatchValue string `yaml:"match_value,omitempty" json:"-"`
MatchPattern string `yaml:"match_pattern,omitempty" json:"match_pattern,omitempty"`
MatchValue string `yaml:"match_value,omitempty" json:"match_value,omitempty"`
MatchPatternCompiled *regexp.Regexp `yaml:"-" json:"-"`

ScaleFactor float64 `yaml:"scale_factor,omitempty" json:"scale_factor,omitempty"`
Expand Down Expand Up @@ -97,12 +96,15 @@ type MetricTagConfig struct {
// Table config
Index uint `yaml:"index,omitempty" json:"index,omitempty"`

// DEPRECATED: Column field is deprecated in favour Symbol field
// DEPRECATED: Use .Symbol instead
Column SymbolConfig `yaml:"column,omitempty" json:"-"`

// Symbol config
OID string `yaml:"OID,omitempty" json:"-" jsonschema:"-"` // DEPRECATED replaced by Symbol field
// Using Symbol field below as string is deprecated
// DEPRECATED: use .Symbol instead
OID string `yaml:"OID,omitempty" json:"-" jsonschema:"-"`
// Symbol records the OID to be parsed. Note that .Symbol.Name is ignored:
// set .Tag to specify the tag name. If a serialized Symbol is a string
// instead of an object, it will be treated like {name: <value>}; this use
// pattern is deprecated
Symbol SymbolConfigCompat `yaml:"symbol,omitempty" json:"symbol,omitempty"`

IndexTransform []MetricIndexTransform `yaml:"index_transform,omitempty" json:"index_transform,omitempty"`
Expand Down Expand Up @@ -156,8 +158,9 @@ type MetricsConfig struct {
// Symbol configs
Symbol SymbolConfig `yaml:"symbol,omitempty" json:"symbol,omitempty"`

// Legacy Symbol configs syntax
OID string `yaml:"OID,omitempty" json:"OID,omitempty" jsonschema:"-"`
// DEPRECATED: Use .Symbol instead
OID string `yaml:"OID,omitempty" json:"OID,omitempty" jsonschema:"-"`
// DEPRECATED: Use .Symbol instead
Name string `yaml:"name,omitempty" json:"name,omitempty" jsonschema:"-"`

// Table configs
Expand All @@ -167,11 +170,12 @@ type MetricsConfig struct {
StaticTags []string `yaml:"static_tags,omitempty" json:"-"`
MetricTags MetricTagConfigList `yaml:"metric_tags,omitempty" json:"metric_tags,omitempty"`

ForcedType ProfileMetricType `yaml:"forced_type,omitempty" json:"forced_type,omitempty" jsonschema:"-"` // deprecated in favour of metric_type
MetricType ProfileMetricType `yaml:"metric_type,omitempty" json:"metric_type,omitempty"`
// DEPRECATED: use Symbol.MetricType instead.
ForcedType ProfileMetricType `yaml:"forced_type,omitempty" json:"forced_type,omitempty" jsonschema:"-"`
// DEPRECATED: use Symbol.MetricType instead.
MetricType ProfileMetricType `yaml:"metric_type,omitempty" json:"metric_type,omitempty" jsonschema:"-"`

// `options` is not exposed as json at the moment since we need to evaluate if we want to expose it via UI
Options MetricsConfigOption `yaml:"options,omitempty" json:"-"`
Options MetricsConfigOption `yaml:"options,omitempty" json:"options,omitempty"`
}

// Clone duplicates this MetricsConfig
Expand Down

0 comments on commit bc8ad92

Please sign in to comment.