MCPcopy Index your code
hub / github.com/netdata/netdata / resolveAutogenRoute

Method resolveAutogenRoute

src/go/plugin/framework/chartengine/autogen.go:68–124  ·  view source on GitHub ↗
(
	reader metrix.Reader,
	metricName string,
	labels metrix.LabelView,
	meta metrix.SeriesMeta,
)

Source from the content-addressed store, hash-verified

66}
67
68func (e *Engine) resolveAutogenRoute(
69 reader metrix.Reader,
70 metricName string,
71 labels metrix.LabelView,
72 meta metrix.SeriesMeta,
73) ([]routeBinding, bool, error) {
74 if e == nil {
75 return nil, false, fmt.Errorf("chartengine: nil engine")
76 }
77 policy := e.state.cfg.autogen
78 if !policy.Enabled {
79 return nil, false, nil
80 }
81
82 route, ok, err := buildAutogenRoute(metricName, labels, meta, policy, e.state.cfg.autogenTypeID)
83 if err != nil {
84 return nil, false, err
85 }
86 if !ok {
87 return nil, false, nil
88 }
89 if metricMeta, ok := autogenMetricMeta(reader, metricName, meta); ok {
90 route = applyAutogenMetricMeta(route, metricMeta, meta)
91 }
92 route.priority = effectiveChartPriority(route.priority)
93 title := route.title
94 if title == "" {
95 title = getAutogenChartTitle(route.chartName)
96 }
97 return []routeBinding{
98 {
99 ChartTemplateID: autogenTemplatePrefix + route.chartID,
100 ChartID: route.chartID,
101 DimensionIndex: 0,
102 DimensionName: route.dimensionName,
103 DimensionKeyLabel: route.dimensionKeyLabel,
104 Algorithm: route.algorithm,
105 Hidden: false,
106 Multiplier: 1,
107 Divisor: 1,
108 Float: route.float,
109 Static: route.staticDimension,
110 Inferred: false,
111 Autogen: true,
112 Meta: program.ChartMeta{
113 Title: title,
114 Family: route.family,
115 Context: getAutogenChartContext(route.contextName),
116 Units: route.units,
117 Algorithm: route.algorithm,
118 Type: route.chartType,
119 Priority: route.priority,
120 },
121 Lifecycle: autogenLifecyclePolicy(policy),
122 },
123 }, true, nil
124}
125

Callers 1

scanPlanSeriesMethod · 0.95

Calls 8

buildAutogenRouteFunction · 0.85
autogenMetricMetaFunction · 0.85
applyAutogenMetricMetaFunction · 0.85
effectiveChartPriorityFunction · 0.85
getAutogenChartTitleFunction · 0.85
getAutogenChartContextFunction · 0.85
autogenLifecyclePolicyFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected