metric_publisher.hpp
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>
20 
23 
24 #include <memory>
25 #include <thread>
26 
28 
29 namespace Aws {
30 namespace CloudWatchMetrics {
31 
39 class MetricPublisher : public Publisher<MetricDatumCollection>
40 {
41 public:
42 
43  MetricPublisher(const std::string & metrics_namespace, const Aws::Client::ClientConfiguration & client_config);
44  MetricPublisher(const std::string & metrics_namespace, std::shared_ptr<Utils::CloudWatchMetricsFacade> cloudwatch_metrics_facade);
45 
49  ~MetricPublisher() override = default;
50 
51  bool shutdown() override;
57  bool start() override;
65 
66 private:
67 
68  std::shared_ptr<Aws::CloudWatchMetrics::Utils::CloudWatchMetricsFacade> cloudwatch_metrics_facade_;
69 
70  Aws::Client::ClientConfiguration client_config_;
71  Aws::SDKOptions aws_sdk_options_;
72  std::string metrics_namespace_;
73  mutable std::recursive_mutex mtx_;
74 };
75 
76 } // namespace CloudWatchMetrics
77 } // namespace Aws
std::list< Aws::CloudWatch::Model::MetricDatum > MetricDatumCollection
Definition: definitions.h:23
std::shared_ptr< Aws::CloudWatchMetrics::Utils::CloudWatchMetricsFacade > cloudwatch_metrics_facade_
~MetricPublisher() override=default
Tears down the MetricPublisher object.
MetricPublisher(const std::string &metrics_namespace, const Aws::Client::ClientConfiguration &client_config)
Aws::Client::ClientConfiguration client_config_
Aws::DataFlow::UploadStatus publishData(MetricDatumCollection &data) override
Class that handles sending metrics data to CloudWatch This class is responsible for emitting all the ...


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