Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Henkel <6976069+ct2034@users.noreply.github.com>
  • Loading branch information
dwffls and ct2034 authored Jan 15, 2025
1 parent a73894f commit 6fcf498
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
8 changes: 2 additions & 6 deletions diagnostic_remote_logging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(dependencies
rclcpp_components
diagnostic_msgs
CURL
)
)

foreach(dep ${dependencies})
find_package(${dep} REQUIRED)
Expand All @@ -21,9 +21,7 @@ include_directories(
src/
include/
)
add_library(influx_component SHARED
src/influxdb.cpp
)
add_library(influx_component SHARED src/influxdb.cpp)

ament_target_dependencies(influx_component ${dependencies})

Expand Down Expand Up @@ -51,6 +49,4 @@ if(BUILD_TESTING)
target_link_libraries(unit_tests influx_component)
ament_target_dependencies(unit_tests ${dependencies} ament_cmake_gtest)
endif()


ament_package()
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ void statusToInfluxLineProtocol(std::string& output, const diagnostic_msgs::msg:
output += " " + timestamp_str + "\n";
}

std::string topLevelToInfluxLineProtocol(const diagnostic_msgs::msg::DiagnosticStatus::SharedPtr& msg, const rclcpp::Time& time)
std::string diagnosticStatusToInfluxLineProtocol(const diagnostic_msgs::msg::DiagnosticStatus::SharedPtr& msg, const rclcpp::Time& time)
{
std::string output = msg->name + " level=" + std::to_string(msg->level) + " " + toInfluxTimestamp(time) + "\n";
return output;
};

std::string arrayToInfluxLineProtocol(const diagnostic_msgs::msg::DiagnosticArray::SharedPtr& diag_msg)
std::string diagnosticArrayToInfluxLineProtocol(const diagnostic_msgs::msg::DiagnosticArray::SharedPtr& diag_msg)
{
std::string output;
std::string timestamp = toInfluxTimestamp(diag_msg->header.stamp);
Expand Down
4 changes: 1 addition & 3 deletions diagnostic_remote_logging/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>diagnostic_remote_logging</name>
<version>0.0.1</version>
<version>4.3.1</version>
<description>diagnostic_remote_logging</description>
<maintainer email="dwijffels@lely.com">Daan Wijffels</maintainer>
<license>>BSD-3-Clause</license>
Expand All @@ -16,8 +16,6 @@
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>ament_cmake_gtest</test_depend>


<export>
<build_type>ament_cmake</build_type>
</export>
Expand Down
4 changes: 2 additions & 2 deletions diagnostic_remote_logging/src/influxdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void InfluxDB::diagnosticsCallback(const diagnostic_msgs::msg::DiagnosticArray::
RCLCPP_ERROR(this->get_logger(), "Failed to send /diagnostics_agg to telegraf");
}

// RCLCPP_INFO(this->get_logger(), "%s", output.c_str());
RCLCPP_DEBUG(this->get_logger(), "%s", output.c_str());
}

void InfluxDB::topLevelCallback(const diagnostic_msgs::msg::DiagnosticStatus::SharedPtr msg)
Expand All @@ -62,7 +62,7 @@ void InfluxDB::topLevelCallback(const diagnostic_msgs::msg::DiagnosticStatus::Sh
RCLCPP_ERROR(this->get_logger(), "Failed to send /diagnostics_toplevel_state to telegraf");
}

// RCLCPP_INFO(this->get_logger(), "%s", output.c_str());
RCLCPP_DEBUGRCLCPP_INFO(this->get_logger(), "%s", output.c_str());
}

void InfluxDB::setupConnection(const std::string &url)
Expand Down

0 comments on commit 6fcf498

Please sign in to comment.