metric_batcher.h
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #pragma once
17 
18 #include <aws/core/Aws.h>
19 #include <aws/monitoring/model/PutMetricDataRequest.h>
20 
23 
25 
27 
28 #include <chrono>
29 #include <list>
30 #include <memory>
31 
32 namespace Aws {
33 namespace CloudWatchMetrics {
34 
36  public DataBatcher<MetricDatum>,
37  public Aws::DataFlow::OutputStage<Aws::FileManagement::TaskPtr<MetricDatumCollection>>
38 {
39 public:
40 
49  explicit MetricBatcher(size_t max_allowable_batch_size = DataBatcher::kDefaultMaxBatchSize,
50  size_t publish_trigger_size = DataBatcher::kDefaultTriggerSize);
51 
52  MetricBatcher(const MetricBatcher & other) = delete;
53 
54  MetricBatcher & operator=(const MetricBatcher & other) = delete;
55 
59  ~MetricBatcher() override;
60 
67  bool publishBatchedData() override;
71  void emptyCollection() override;
76  bool start() override;
77 
84  virtual void setMetricFileManager(std::shared_ptr<Aws::FileManagement::FileManager<MetricDatumCollection>> file_manager);
85 
86 private:
87  std::shared_ptr<Aws::FileManagement::FileManager<MetricDatumCollection>> metric_file_manager_;
88 };
89 
90 } // namespace CloudWatchMetrics
91 } // namespace Aws
static const size_t kDefaultTriggerSize
~MetricBatcher() override
Tears down a MetricBatcher object.
static const size_t kDefaultMaxBatchSize
MetricBatcher(size_t max_allowable_batch_size=DataBatcher::kDefaultMaxBatchSize, size_t publish_trigger_size=DataBatcher::kDefaultTriggerSize)
Creates a new MetricBatcher Creates a new MetricBatcher that will group/buffer metrics. Note: metrics are only automatically published if the size is set, otherwise the publishBatchedData is necessary to push data to be published.
MetricBatcher & operator=(const MetricBatcher &other)=delete
virtual void setMetricFileManager(std::shared_ptr< Aws::FileManagement::FileManager< MetricDatumCollection >> file_manager)
std::shared_ptr< Aws::FileManagement::FileManager< MetricDatumCollection > > metric_file_manager_


cloudwatch_metrics_common
Author(s): AWS RoboMaker
autogenerated on Fri May 7 2021 02:18:25