Documentation ¶
Index ¶
- Constants
- func FlushRules(metricsDiscoveryConfig config.MetricsDiscoveryConfig, mapper meta.RESTMapper) error
- func GetLabelMatchersFromDiscoveryRule(rule config.DiscoveryRule) []string
- func GetMetricMatchesFromDiscoveryRule(rule config.DiscoveryRule) (metricMatches string, err error)
- func GetSeriesNameFromSeriesQuery(seriesQuery string) (seriesName string)
- func ParsingExternalRules(mc config.MetricsDiscoveryConfig, mapper meta.RESTMapper) (err error)
- func ParsingResourceRules(mc config.MetricsDiscoveryConfig, mapper meta.RESTMapper) (err error)
- func ParsingRules(mc config.MetricsDiscoveryConfig, mapper meta.RESTMapper) (err error)
- func SetExtensionLabels(extensionLabels string)
- type MetricRule
- func GetMetricRulesFromDiscoveryRule(cfg []config.DiscoveryRule, mapper meta.RESTMapper) ([]MetricRule, error)
- func GetMetricRulesFromResourceRules(cfg config.ResourceRules, mapper meta.RESTMapper) (metricRules []MetricRule, err error)
- func MatchMetricRule(mrs []MetricRule, metricName string) *MetricRule
- type MetricRules
- type PrometheusAdapterConfigChangedPredicate
- type PrometheusAdapterConfigFetcher
- type QueryTemplateArgs
Constants ¶
const ( WorkloadCpuUsageExpression = "WorkloadCpuUsageExpression" WorkloadMemUsageExpression = "WorkloadMemUsageExpression" NodeCpuUsageExpression = "NodeCpuUsageExpression" NodeMemUsageExpression = "NodeMemUsageExpression" ContainerCpuUsageExpression = "ContainerCpuUsageExpression" ContainerMemUsageExpression = "ContainerMemUsageExpression" PodCpuUsageExpression = "PodCpuUsageExpression" PodMemUsageExpression = "PodMemUsageExpression" )
MetricMatches for Prometheus-adapter-config
Variables ¶
This section is empty.
Functions ¶
func FlushRules ¶
func FlushRules(metricsDiscoveryConfig config.MetricsDiscoveryConfig, mapper meta.RESTMapper) error
func GetLabelMatchersFromDiscoveryRule ¶
func GetLabelMatchersFromDiscoveryRule(rule config.DiscoveryRule) []string
get labelMatchers from DiscoveryRule
func GetMetricMatchesFromDiscoveryRule ¶
func GetMetricMatchesFromDiscoveryRule(rule config.DiscoveryRule) (metricMatches string, err error)
get MetricMatches from DiscoveryRule
func GetSeriesNameFromSeriesQuery ¶
get SeriesName from SeriesQuery
func ParsingExternalRules ¶
func ParsingExternalRules(mc config.MetricsDiscoveryConfig, mapper meta.RESTMapper) (err error)
ParsingExternalRules from config.MetricsDiscoveryConfig
func ParsingResourceRules ¶
func ParsingResourceRules(mc config.MetricsDiscoveryConfig, mapper meta.RESTMapper) (err error)
ParsingResourceRules from config.MetricsDiscoveryConfig
func ParsingRules ¶
func ParsingRules(mc config.MetricsDiscoveryConfig, mapper meta.RESTMapper) (err error)
ParsingRules from config.MetricsDiscoveryConfig
func SetExtensionLabels ¶
func SetExtensionLabels(extensionLabels string)
SetExtensionLabels from opts.DataSourcePromConfig.AdapterExtensionLabels
Types ¶
type MetricRule ¶
type MetricRule struct { MetricMatches string SeriesName string ResConverter naming.ResourceConverter Template *template.Template Namespaced bool LabelMatchers []string }
func GetMetricRulesFromDiscoveryRule ¶
func GetMetricRulesFromDiscoveryRule(cfg []config.DiscoveryRule, mapper meta.RESTMapper) ([]MetricRule, error)
GetMetricRuleFromRules produces a MetricNamer for each rule in the given config.
func GetMetricRulesFromResourceRules ¶
func GetMetricRulesFromResourceRules(cfg config.ResourceRules, mapper meta.RESTMapper) (metricRules []MetricRule, err error)
GetMetricRuleResourceFromRules produces a MetricNamer for each rule in the given config.
func MatchMetricRule ¶
func MatchMetricRule(mrs []MetricRule, metricName string) *MetricRule
get MetricRule for metricName
func (*MetricRule) QueryForSeries ¶
func (mr *MetricRule) QueryForSeries(namespace string, nameReg string, exprs []string) (expressionQuery string, err error)
get MetrycsQuery by naming.MetricsQuery.BuildExternal from prometheus-adapter
type MetricRules ¶
type MetricRules struct { MetricRulesResource []MetricRule MetricRulesCustomer []MetricRule MetricRulesExternal []MetricRule ExtensionLabels []string }
func GetMetricRules ¶
func GetMetricRules() *MetricRules
get MetricRules from config.MetricsDiscoveryConfig
type PrometheusAdapterConfigChangedPredicate ¶
type PrometheusAdapterConfigChangedPredicate struct { predicate.Funcs Name string Namespace string }
func (*PrometheusAdapterConfigChangedPredicate) Update ¶
func (paCm *PrometheusAdapterConfigChangedPredicate) Update(e event.UpdateEvent) bool
Update fetched metricRule if configmap is updated
type PrometheusAdapterConfigFetcher ¶
type PrometheusAdapterConfigFetcher struct { client.Client Scheme *runtime.Scheme RestMapper meta.RESTMapper Recorder record.EventRecorder AdapterConfigMapNS string AdapterConfigMapName string AdapterConfigMapKey string AdapterConfig string }
func (*PrometheusAdapterConfigFetcher) Reload ¶
func (pc *PrometheusAdapterConfigFetcher) Reload()
if set promAdapterConfig, daemon reload by config fsnotify
func (*PrometheusAdapterConfigFetcher) SetupWithManager ¶
func (pc *PrometheusAdapterConfigFetcher) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager creates a controller and register to controller manager.