|
12 | 12 |
|
13 | 13 | #include <model/CAnomalyDetector.h> |
14 | 14 | #include <model/CAnomalyDetectorModelConfig.h> |
15 | | -#include <model/CBucketQueue.h> |
16 | 15 | #include <model/CHierarchicalResults.h> |
17 | 16 | #include <model/CHierarchicalResultsAggregator.h> |
18 | 17 | #include <model/CHierarchicalResultsNormalizer.h> |
19 | 18 | #include <model/CInterimBucketCorrector.h> |
20 | 19 | #include <model/CResourceMonitor.h> |
21 | | -#include <model/CResultsQueue.h> |
22 | 20 | #include <model/CSearchKey.h> |
23 | 21 |
|
24 | 22 | #include <api/CDataProcessor.h> |
@@ -117,26 +115,20 @@ class API_EXPORT CAnomalyJob : public CDataProcessor { |
117 | 115 | std::pair<model::CSearchKey::TStrCRefKeyCRefPr, TAnomalyDetectorPtr>; |
118 | 116 | using TKeyCRefAnomalyDetectorPtrPrVec = std::vector<TKeyCRefAnomalyDetectorPtrPr>; |
119 | 117 | using TModelPlotDataVec = model::CAnomalyDetector::TModelPlotDataVec; |
120 | | - using TModelPlotDataVecCItr = TModelPlotDataVec::const_iterator; |
121 | | - using TModelPlotDataVecQueue = model::CBucketQueue<TModelPlotDataVec>; |
122 | 118 |
|
123 | 119 | struct API_EXPORT SRestoredStateDetail { |
124 | 120 | ERestoreStateStatus s_RestoredStateStatus; |
125 | 121 | boost::optional<std::string> s_Extra; |
126 | 122 | }; |
127 | 123 |
|
128 | 124 | struct SBackgroundPersistArgs { |
129 | | - SBackgroundPersistArgs(const model::CResultsQueue& resultsQueue, |
130 | | - const TModelPlotDataVecQueue& modelPlotQueue, |
131 | | - core_t::TTime time, |
| 125 | + SBackgroundPersistArgs(core_t::TTime time, |
132 | 126 | const model::CResourceMonitor::SResults& modelSizeStats, |
133 | 127 | const model::CInterimBucketCorrector& interimBucketCorrector, |
134 | 128 | const model::CHierarchicalResultsAggregator& aggregator, |
135 | 129 | core_t::TTime latestRecordTime, |
136 | 130 | core_t::TTime lastResultsTime); |
137 | 131 |
|
138 | | - model::CResultsQueue s_ResultsQueue; |
139 | | - TModelPlotDataVecQueue s_ModelPlotQueue; |
140 | 132 | core_t::TTime s_Time; |
141 | 133 | model::CResourceMonitor::SResults s_ModelSizeStats; |
142 | 134 | model::CInterimBucketCorrector s_InterimBucketCorrector; |
@@ -224,14 +216,11 @@ class API_EXPORT CAnomalyJob : public CDataProcessor { |
224 | 216 | void outputInterimResults(core_t::TTime bucketStartTime); |
225 | 217 |
|
226 | 218 | //! Helper function for outputResults. |
227 | | - //! \p processingTimer is the processing time can be written to the bucket |
228 | | - //! \p sumPastProcessingTime is the total time previously spent processing |
229 | | - //! but resulted in no bucket being outputted. |
| 219 | + //! \p processingTime is the processing time of the bucket |
230 | 220 | void writeOutResults(bool interim, |
231 | 221 | model::CHierarchicalResults& results, |
232 | 222 | core_t::TTime bucketTime, |
233 | | - uint64_t processingTime, |
234 | | - uint64_t sumPastProcessingTime); |
| 223 | + uint64_t processingTime); |
235 | 224 |
|
236 | 225 | //! Reset buckets in the range specified by the control message. |
237 | 226 | void resetBuckets(const std::string& controlMessage); |
@@ -259,8 +248,6 @@ class API_EXPORT CAnomalyJob : public CDataProcessor { |
259 | 248 |
|
260 | 249 | //! Persist the detectors to a stream. |
261 | 250 | bool persistState(const std::string& descriptionPrefix, |
262 | | - const model::CResultsQueue& resultsQueue, |
263 | | - const TModelPlotDataVecQueue& modelPlotQueue, |
264 | 251 | core_t::TTime time, |
265 | 252 | const TKeyCRefAnomalyDetectorPtrPrVec& detectors, |
266 | 253 | const model::CResourceMonitor::SResults& modelSizeStats, |
@@ -296,16 +283,9 @@ class API_EXPORT CAnomalyJob : public CDataProcessor { |
296 | 283 | //! \param[in] endTime The end of the time interval to skip sampling. |
297 | 284 | void skipSampling(core_t::TTime endTime); |
298 | 285 |
|
299 | | - //! Outputs queued results and resets the queue to the given \p startTime |
300 | | - void flushAndResetResultsQueue(core_t::TTime startTime); |
301 | | - |
302 | 286 | //! Roll time forward to \p time |
303 | 287 | void timeNow(core_t::TTime time); |
304 | 288 |
|
305 | | - //! Get the bucketLength, or half the bucketLength if |
306 | | - //! out-of-phase buckets are active |
307 | | - core_t::TTime effectiveBucketLength() const; |
308 | | - |
309 | 289 | //! Update configuration |
310 | 290 | void updateConfig(const std::string& config); |
311 | 291 |
|
@@ -333,15 +313,12 @@ class API_EXPORT CAnomalyJob : public CDataProcessor { |
333 | 313 | //! specified time range. |
334 | 314 | void generateModelPlot(core_t::TTime startTime, |
335 | 315 | core_t::TTime endTime, |
336 | | - const model::CAnomalyDetector& detector); |
| 316 | + const model::CAnomalyDetector& detector, |
| 317 | + TModelPlotDataVec& modelPlotData); |
337 | 318 |
|
338 | 319 | //! Write the pre-generated model plot to the output stream of the user's |
339 | 320 | //! choosing: either file or streamed to the API |
340 | | - void writeOutModelPlot(core_t::TTime resultsTime); |
341 | | - |
342 | | - //! Write the pre-generated model plot to the output stream of the user's |
343 | | - //! choosing: either file or streamed to the API |
344 | | - void writeOutModelPlot(core_t::TTime, CModelPlotDataJsonWriter& writer); |
| 321 | + void writeOutModelPlot(const TModelPlotDataVec& modelPlotData); |
345 | 322 |
|
346 | 323 | //! Persist one detector to a stream. |
347 | 324 | //! This method is static so that there is no danger of it accessing |
@@ -477,15 +454,6 @@ class API_EXPORT CAnomalyJob : public CDataProcessor { |
477 | 454 | //! The hierarchical results normalizer. |
478 | 455 | model::CHierarchicalResultsNormalizer m_Normalizer; |
479 | 456 |
|
480 | | - //! Store the last N half-buckets' results in order |
481 | | - //! to choose the best result |
482 | | - model::CResultsQueue m_ResultsQueue; |
483 | | - |
484 | | - //! Also store the model plot for the buckets for each |
485 | | - //! result time - these will be output when the corresponding |
486 | | - //! result is output |
487 | | - TModelPlotDataVecQueue m_ModelPlotQueue; |
488 | | - |
489 | 457 | friend class ::CBackgroundPersisterTest; |
490 | 458 | friend class ::CAnomalyJobTest; |
491 | 459 | }; |
|
0 commit comments