(api *netdataapi.API, env EmitEnv, actions normalizedActions)
| 151 | } |
| 152 | |
| 153 | func emitCreatePhase(api *netdataapi.API, env EmitEnv, actions normalizedActions) { |
| 154 | createdChartIDs := make([]string, 0, len(actions.createCharts)) |
| 155 | for chartID := range actions.createCharts { |
| 156 | createdChartIDs = append(createdChartIDs, chartID) |
| 157 | } |
| 158 | sort.Strings(createdChartIDs) |
| 159 | for _, chartID := range createdChartIDs { |
| 160 | createChart := actions.createCharts[chartID] |
| 161 | emitChart(api, env, createChart.ChartID, createChart.Meta, false) |
| 162 | emitChartLabels(api, env, createChart.Labels) |
| 163 | api.CLABELCOMMIT() |
| 164 | dims := actions.createDimsByID[chartID] |
| 165 | for _, dim := range dims { |
| 166 | emitDimension(api, dimensionEmission{ |
| 167 | Name: dim.Name, |
| 168 | Hidden: dim.Hidden, |
| 169 | Float: dim.Float, |
| 170 | Algorithm: string(dim.Algorithm), |
| 171 | Multiplier: dim.Multiplier, |
| 172 | Divisor: dim.Divisor, |
| 173 | }) |
| 174 | } |
| 175 | // Mark dimensions as emitted alongside explicit chart-create path. |
| 176 | delete(actions.createDimsByID, chartID) |
| 177 | } |
| 178 | |
| 179 | remainingChartIDs := make([]string, 0, len(actions.createDimsByID)) |
| 180 | for chartID := range actions.createDimsByID { |
| 181 | remainingChartIDs = append(remainingChartIDs, chartID) |
| 182 | } |
| 183 | sort.Strings(remainingChartIDs) |
| 184 | for _, chartID := range remainingChartIDs { |
| 185 | dims := actions.createDimsByID[chartID] |
| 186 | if len(dims) == 0 { |
| 187 | continue |
| 188 | } |
| 189 | emitChart(api, env, chartID, dims[0].ChartMeta, false) |
| 190 | // Dimension-only chart creation path still needs chart labels and commit. |
| 191 | emitChartLabels(api, env, nil) |
| 192 | api.CLABELCOMMIT() |
| 193 | for _, dim := range dims { |
| 194 | emitDimension(api, dimensionEmission{ |
| 195 | Name: dim.Name, |
| 196 | Hidden: dim.Hidden, |
| 197 | Float: dim.Float, |
| 198 | Algorithm: string(dim.Algorithm), |
| 199 | Multiplier: dim.Multiplier, |
| 200 | Divisor: dim.Divisor, |
| 201 | }) |
| 202 | } |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | func emitUpdatePhase(api *netdataapi.API, env EmitEnv, updates []UpdateChartAction) { |
| 207 | for _, update := range updates { |
no test coverage detected
searching dependent graphs…