metric_service.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>
19 
22 
26 
28 
31 
33 
34 #include <chrono>
35 #include <stdexcept>
36 #include <utility>
37 
38 namespace Aws {
39 namespace CloudWatchMetrics {
40 
46 class MetricService : public Aws::CloudWatch::CloudWatchService<Utils::MetricObject, MetricDatum>
47 {
48 public:
49 
58  std::shared_ptr<Publisher<MetricDatumCollection>> publisher,
59  std::shared_ptr<DataBatcher<MetricDatum>> batcher,
60  std::shared_ptr<Aws::FileManagement::FileUploadStreamer<MetricDatumCollection>> file_upload_streamer = nullptr)
61  : CloudWatchService(std::move(publisher), std::move(batcher)) {
62 
63  this->file_upload_streamer_ = std::move(file_upload_streamer);
64  }
65 
74  const Utils::MetricObject &input,
75  const std::chrono::milliseconds &milliseconds) override {
76 
77  return metricObjectToDatum(input, static_cast<int64_t>(milliseconds.count()));
78  }
79 
87 
88  return metricObjectToDatum(input, input.timestamp);
89  }
90 };
91 
92 } // namespace CloudWatchMetrics
93 } // namespace Aws
94 
MetricDatum convertInputToBatched(const Utils::MetricObject &input, const std::chrono::milliseconds &milliseconds) override
MetricDatum convertInputToBatched(const Utils::MetricObject &input) override
CloudWatchService(std::shared_ptr< Publisher< std::list< T >>> publisher, std::shared_ptr< DataBatcher< T >> batcher)
std::shared_ptr< FileUploadStreamer< std::list< T > > > file_upload_streamer_
Aws::CloudWatch::Model::MetricDatum MetricDatum
Definition: definitions.h:22
static MetricDatum metricObjectToDatum(const MetricObject &metrics, const int64_t timestamp)
MetricService(std::shared_ptr< Publisher< MetricDatumCollection >> publisher, std::shared_ptr< DataBatcher< MetricDatum >> batcher, std::shared_ptr< Aws::FileManagement::FileUploadStreamer< MetricDatumCollection >> file_upload_streamer=nullptr)


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