Register MapBuilderServer metrics (#1133)

I am not adding these registration calls to `cartographer/metrics/register.cc` because they are specific to cloud based mapping.
master
Christoph Schütte 2018-05-01 17:18:34 +02:00 committed by Wally B. Feed
parent 913b1b5856
commit e080df5ea3
3 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,10 @@
namespace cartographer {
namespace cloud {
void RegisterMapBuilderServerMetrics(metrics::FamilyFactory* factory) {
MapBuilderServer::RegisterMetrics(factory);
}
std::unique_ptr<MapBuilderServerInterface> CreateMapBuilderServer(
const proto::MapBuilderServerOptions& map_builder_server_options,
std::unique_ptr<mapping::MapBuilderInterface> map_builder) {

View File

@ -21,6 +21,7 @@
#include "cartographer/cloud/proto/map_builder_server_options.pb.h"
#include "cartographer/mapping/map_builder_interface.h"
#include "cartographer/metrics/family_factory.h"
namespace cartographer {
namespace cloud {
@ -45,6 +46,9 @@ class MapBuilderServerInterface {
virtual void Shutdown() = 0;
};
// Registers all metrics for the MapBuilderServer.
void RegisterMapBuilderServerMetrics(metrics::FamilyFactory* factory);
// Returns MapBuilderServer with the actual implementation.
std::unique_ptr<MapBuilderServerInterface> CreateMapBuilderServer(
const proto::MapBuilderServerOptions& map_builder_server_options,

View File

@ -41,6 +41,7 @@ void Run(const std::string& configuration_directory,
#if USE_PROMETHEUS
metrics::prometheus::FamilyFactory registry;
::cartographer::metrics::RegisterAllMetrics(&registry);
RegisterMapBuilderServerMetrics(&registry);
::prometheus::Exposer exposer("0.0.0.0:9100");
exposer.RegisterCollectable(registry.GetCollectable());
LOG(INFO) << "Exposing metrics at http://localhost:9100/metrics";