17 #include <aws/core/Aws.h> 18 #include <aws/core/client/ClientConfiguration.h> 19 #include <aws/core/utils/StringUtils.h> 20 #include <aws/core/utils/logging/AWSLogging.h> 21 #include <aws/core/utils/logging/LogMacros.h> 22 #include <aws/monitoring/CloudWatchClient.h> 23 #include <aws/monitoring/model/PutMetricDataRequest.h> 28 #include <ros_monitoring_msgs/MetricData.h> 29 #include <ros_monitoring_msgs/MetricDimension.h> 30 #include <ros_monitoring_msgs/MetricList.h> 31 #include <std_msgs/String.h> 49 int main(
int argc,
char * argv[])
55 std::vector<ros::Subscriber> subscriptions;
58 Aws::Utils::Logging::InitializeAWSLogging(Aws::MakeShared<Aws::Utils::Logging::AWSROSLogger>(
kNodeName.c_str()));
62 std::shared_ptr<Aws::Client::ParameterReaderInterface> parameter_reader =
63 std::make_shared<Aws::Client::Ros1NodeParameterReader>();
67 Aws::Client::ClientConfiguration client_config = client_config_provider.GetClientConfiguration();
69 Aws::SDKOptions sdk_options;
71 double publish_frequency;
73 std::string metric_namespace;
74 Aws::String dimensions_param;
75 std::map<std::string, std::string> default_metric_dims;
107 metrics_collector.
start();
114 if (!publish_when_size_reached) {
123 AWS_LOG_INFO(__func__,
"Shutting down Metrics Collector ...");
125 Aws::Utils::Logging::ShutdownAWSLogging();
void ReadCloudWatchOptions(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, Aws::CloudWatchMetrics::CloudWatchOptions &cloudwatch_options)
size_t batch_trigger_publish_size
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void Initialize(std::string metric_namespace, std::map< std::string, std::string > &default_dimensions, int storage_resolution, const ros::NodeHandle &node_handle, const Aws::Client::ClientConfiguration &config, const Aws::SDKOptions &sdk_options, const Aws::CloudWatchMetrics::CloudWatchOptions &cloudwatch_options, const std::shared_ptr< MetricServiceFactory > &metric_service_factory=std::make_shared< MetricServiceFactory >())
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
void ReadMetricNamespace(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, std::string &metric_namespace)
static constexpr UploaderOptions kDefaultUploaderOptions
constexpr int kNodeDefaultMetricDatumStorageResolution
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
void ReadPublishFrequency(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, double &publish_frequency)
Aws::DataFlow::UploaderOptions uploader_options
const std::string kNodeName
void TriggerPublish(const ros::TimerEvent &)
ROSCPP_DECL void shutdown()
bool checkIfOnline(std_srvs::Trigger::Request &request, std_srvs::Trigger::Response &response)
void ReadStorageResolution(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, int &storage_resolution)
int main(int argc, char *argv[])
void ReadMetricDimensions(const std::shared_ptr< Aws::Client::ParameterReaderInterface > ¶meter_reader, Aws::String &dimensions_param, std::map< std::string, std::string > &metric_dims)