Class that handles sending metrics data to CloudWatch This class is responsible for emitting all the stored metrics to AWS CloudWatch. Metrics are published asynchronously using a thread. The thread waits on a condition variable and is signaled (by AWSCloudWatchMetricManager) whenever new metrics are available. More...
#include <metric_publisher.hpp>
Public Member Functions | |
MetricPublisher (const std::string &metrics_namespace, const Aws::Client::ClientConfiguration &client_config) | |
MetricPublisher (const std::string &metrics_namespace, std::shared_ptr< Utils::CloudWatchMetricsFacade > cloudwatch_metrics_facade) | |
Aws::DataFlow::UploadStatus | publishData (MetricDatumCollection &data) override |
bool | shutdown () override |
bool | start () override |
~MetricPublisher () override=default | |
Tears down the MetricPublisher object. More... | |
Public Member Functions inherited from Publisher< MetricDatumCollection > | |
virtual void | addPublisherStateListener (const std::function< void(const PublisherState &)> &listener) |
Aws::DataFlow::UploadStatus | attemptPublish (MetricDatumCollection &data) override |
bool | canPublish () |
std::chrono::milliseconds | getLastPublishDuration () |
int | getPublishAttempts () |
PublisherState | getPublisherState () |
int | getPublishSuccesses () |
float | getPublishSuccessPercentage () |
Publisher () | |
bool | shutdown () override |
~Publisher () override=default | |
Public Member Functions inherited from Aws::DataFlow::IPublisher< T > | |
virtual UploadStatus | attemptPublish (T &batch_data)=0 |
Public Member Functions inherited from Service | |
ServiceState | getState () |
virtual std::string | getStatusString () |
Service () | |
virtual | ~Service ()=default |
Private Attributes | |
Aws::SDKOptions | aws_sdk_options_ |
Aws::Client::ClientConfiguration | client_config_ |
std::shared_ptr< Aws::CloudWatchMetrics::Utils::CloudWatchMetricsFacade > | cloudwatch_metrics_facade_ |
std::string | metrics_namespace_ |
std::recursive_mutex | mtx_ |
Additional Inherited Members | |
Protected Member Functions inherited from Service | |
void | setState (ServiceState new_state) |
Class that handles sending metrics data to CloudWatch This class is responsible for emitting all the stored metrics to AWS CloudWatch. Metrics are published asynchronously using a thread. The thread waits on a condition variable and is signaled (by AWSCloudWatchMetricManager) whenever new metrics are available.
Definition at line 39 of file metric_publisher.hpp.
Aws::CloudWatchMetrics::MetricPublisher::MetricPublisher | ( | const std::string & | metrics_namespace, |
const Aws::Client::ClientConfiguration & | client_config | ||
) |
Definition at line 34 of file metric_publisher.cpp.
Aws::CloudWatchMetrics::MetricPublisher::MetricPublisher | ( | const std::string & | metrics_namespace, |
std::shared_ptr< Utils::CloudWatchMetricsFacade > | cloudwatch_metrics_facade | ||
) |
|
overridedefault |
Tears down the MetricPublisher object.
|
overridevirtual |
Attempt to publish the input data.
data | input to publish to CloudWatch |
Implements Publisher< MetricDatumCollection >.
Definition at line 61 of file metric_publisher.cpp.
|
overridevirtual |
Reimplemented from Service.
Definition at line 57 of file metric_publisher.cpp.
|
overridevirtual |
Create the cloudwatch facade
Reimplemented from Service.
Definition at line 49 of file metric_publisher.cpp.
|
private |
Definition at line 71 of file metric_publisher.hpp.
|
private |
Definition at line 70 of file metric_publisher.hpp.
|
private |
Definition at line 68 of file metric_publisher.hpp.
|
private |
Definition at line 72 of file metric_publisher.hpp.
|
mutableprivate |
Definition at line 73 of file metric_publisher.hpp.