19 #include <unordered_set> 21 #include <aws/core/utils/logging/LogMacros.h> 29 namespace CloudWatchMetrics {
41 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
42 double & publish_frequency) {
48 case Aws::AwsError::AWS_ERR_NOT_FOUND:
50 AWS_LOGSTREAM_INFO(__func__,
51 "Publish frequency configuration not found, setting to default value: " 54 case Aws::AwsError::AWS_ERR_OK:
55 AWS_LOGSTREAM_INFO(__func__,
"Publish frequency is set to: " << publish_frequency);
59 AWS_LOGSTREAM_ERROR(__func__,
60 "Error " << ret <<
" retrieving publish frequency, setting to default value: " 73 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
74 std::string & metric_namespace) {
80 AWS_LOGSTREAM_INFO(__func__,
"Namespace: " << metric_namespace);
97 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
98 Aws::String & dimensions_param,
99 std::map<std::string, std::string> & metric_dims) {
105 Aws::OStringStream logging_stream;
106 logging_stream <<
"Default Metric Dimensions: { ";
108 auto dims = Aws::Utils::StringUtils::Split(dimensions_param,
';');
109 for (
auto & dim : dims) {
111 auto dim_vec = Aws::Utils::StringUtils::Split(dim,
':');
112 if (dim_vec.size() == 2) {
113 metric_dims.emplace(dim_vec[0].c_str(), dim_vec[1].c_str());
114 logging_stream << dim_vec[0] <<
": " << dim_vec[1] <<
", ";
117 __func__,
"Could not parse dimension: " 118 << dim <<
". Should be in the format <DimensionName>:<DimensionValue>");
123 logging_stream <<
" }";
124 AWS_LOGSTREAM_INFO(__func__, logging_stream.str());
134 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
135 int & storage_resolution) {
146 AWS_LOGSTREAM_WARN(__func__,
147 "Storage Resolution value of [" 148 << storage_resolution
149 <<
"] is not allowed. Falling back to default Storage Resolution: " 153 AWS_LOGSTREAM_INFO(__func__,
"Storage Resolution: " << storage_resolution);
158 "No Storage Resolution configuration found. Falling back to default Storage Resolution: " 159 << storage_resolution);
165 std::string param_key;
169 if (topics.empty()) {
177 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
186 cloudwatch_options = {
188 file_manager_strategy_options
193 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
233 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
268 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
269 const std::string & option_key,
270 const std::string & default_value,
271 std::string & option_value) {
274 case Aws::AwsError::AWS_ERR_NOT_FOUND:
275 option_value = default_value;
276 AWS_LOGSTREAM_INFO(__func__,
277 option_key <<
" parameter not found, setting to default value: " << default_value);
279 case Aws::AwsError::AWS_ERR_OK:
280 AWS_LOGSTREAM_INFO(__func__, option_key <<
" is set to: " << option_value);
283 option_value = default_value;
284 AWS_LOGSTREAM_ERROR(__func__,
285 "Error " << ret <<
" retrieving option " << option_key <<
", setting to default value: " << default_value);
290 const std::shared_ptr<Aws::Client::ParameterReaderInterface>& parameter_reader,
291 const std::string & option_key,
292 const size_t & default_value,
293 size_t & option_value) {
298 case Aws::AwsError::AWS_ERR_NOT_FOUND:
299 option_value = default_value;
300 AWS_LOGSTREAM_INFO(__func__,
301 option_key <<
" parameter not found, setting to default value: " << default_value);
303 case Aws::AwsError::AWS_ERR_OK:
304 option_value =
static_cast<size_t>(param_value);
305 AWS_LOGSTREAM_INFO(__func__, option_key <<
" is set to: " << option_value);
308 option_value = default_value;
309 AWS_LOGSTREAM_ERROR(__func__,
310 "Error " << ret <<
" retrieving option " << option_key <<
", setting to default value: " << default_value);
std::string file_extension
const std::string kNodeParamDefaultMetricDimensionsKey
void ReadCloudWatchOptions(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, Aws::CloudWatchMetrics::CloudWatchOptions &cloudwatch_options)
constexpr char kNodeParamMaximumFileSize[]
void ReadUploaderOptions(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, Aws::DataFlow::UploaderOptions &uploader_options)
size_t batch_max_queue_size
const char kNodeParamPublishFrequencyKey[]
size_t batch_trigger_publish_size
const std::string kNodeDefaulMetricsTopic
size_t file_upload_batch_size
constexpr char kNodeParamBatchTriggerPublishSize[]
constexpr char kNodeParamFileMaxQueueSize[]
void ReadOption(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, const std::string &option_key, const std::string &default_value, std::string &option_value)
void ReadMetricNamespace(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, std::string &metric_namespace)
constexpr char kNodeParamFilePrefix[]
size_t storage_limit_in_kb
constexpr char kNodeParamFileExtension[]
static constexpr UploaderOptions kDefaultUploaderOptions
size_t maximum_file_size_in_kb
size_t stream_max_queue_size
void ReadTopics(std::vector< std::string > &topics)
const std::string kNodeParamMonitorTopicsListKey("aws_monitored_metric_topics")
ROSCPP_DECL bool get(const std::string &key, std::string &s)
constexpr char kNodeParamStreamMaxQueueSize[]
const std::string kNodeDefaultMetricNamespace
constexpr int kNodeDefaultMetricDatumStorageResolution
const std::string kNodeParamMetricDatumStorageResolutionKey
const std::string kNodeParamMetricNamespaceKey
void ReadPublishFrequency(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, double &publish_frequency)
constexpr char kNodeParamBatchMaxQueueSize[]
constexpr char kNodeParamStorageDirectory[]
constexpr char kNodeParamStorageLimit[]
constexpr int kNodePublishFrequencyDefaultValue
void ReadFileManagerStrategyOptions(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, Aws::FileManagement::FileManagerStrategyOptions &file_manager_strategy_options)
std::string storage_directory
const std::set< int > kNodeParamMetricDatumStorageResolutionValidValues
void ReadStorageResolution(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, int &storage_resolution)
ROSCPP_DECL bool search(const std::string &ns, const std::string &key, std::string &result)
size_t file_max_queue_size
constexpr char kNodeParamFileUploadBatchSize[]
static const Aws::FileManagement::FileManagerStrategyOptions kDefaultMetricFileManagerStrategyOptions
void ReadMetricDimensions(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, Aws::String &dimensions_param, std::map< std::string, std::string > &metric_dims)