Cleaning up.

* Wiped out a ton of warnings about comments.
* Created consts for `MetricType` values.
* `externalInfoMap` can now track multiple series with the same name/namespace and different labels.
* `namespace` parameter of external metrics queries is now respected (albeit very rudimentarily)
* Metric converter values for external metrics are now converted the same way as for custom metrics (probably still some opportunity for consolidation).
* Lots of TODOs actually done.
* Deleted a lot of commented out code.
This commit is contained in:
Tony Compton 2018-07-20 15:35:24 -04:00
parent 9641e70005
commit a94494337e
18 changed files with 155 additions and 188 deletions

View file

@ -34,7 +34,10 @@ type DiscoveryRule struct {
MetricsQuery string `yaml:"metricsQuery,omitempty"`
// MetricType identifies whether the metrics derived from this rule should be classified
// as external or custom metrics.
MetricType MetricType `yaml:"metricType"`
MetricType MetricType `yaml:"metricType,omitempty"`
// ExternalMetricNamespaceLabelName identifies what Prometheus label should be examined
// to apply a namespace to metrics creates from this rule.
ExternalMetricNamespaceLabelName string `yaml:"externalMetricNamespaceLabelName,omitempty"`
}
// RegexFilter is a filter that matches positively or negatively against a regex.
@ -79,3 +82,12 @@ type NameMapping struct {
//MetricType identifies whether a given metric should be handled and interpreted as a Custom or External metric.
type MetricType string
// Operator represents a key/field's relationship to value(s).
// See labels.Requirement and fields.Requirement for more details.
type Operator string
const (
External MetricType = "External"
Custom MetricType = "Custom"
)