Add gauge metric for pose graph work queue size. (#1727)
Signed-off-by: Michael Grupp <grupp@magazino.eu>master
parent
340a9ac21a
commit
1cae11593d
|
@ -42,6 +42,7 @@ namespace cartographer {
|
||||||
namespace mapping {
|
namespace mapping {
|
||||||
|
|
||||||
static auto* kWorkQueueDelayMetric = metrics::Gauge::Null();
|
static auto* kWorkQueueDelayMetric = metrics::Gauge::Null();
|
||||||
|
static auto* kWorkQueueSizeMetric = metrics::Gauge::Null();
|
||||||
static auto* kConstraintsSameTrajectoryMetric = metrics::Gauge::Null();
|
static auto* kConstraintsSameTrajectoryMetric = metrics::Gauge::Null();
|
||||||
static auto* kConstraintsDifferentTrajectoryMetric = metrics::Gauge::Null();
|
static auto* kConstraintsDifferentTrajectoryMetric = metrics::Gauge::Null();
|
||||||
static auto* kActiveSubmapsMetric = metrics::Gauge::Null();
|
static auto* kActiveSubmapsMetric = metrics::Gauge::Null();
|
||||||
|
@ -181,6 +182,7 @@ void PoseGraph2D::AddWorkItem(
|
||||||
}
|
}
|
||||||
const auto now = std::chrono::steady_clock::now();
|
const auto now = std::chrono::steady_clock::now();
|
||||||
work_queue_->push_back({now, work_item});
|
work_queue_->push_back({now, work_item});
|
||||||
|
kWorkQueueSizeMetric->Set(work_queue_->size());
|
||||||
kWorkQueueDelayMetric->Set(
|
kWorkQueueDelayMetric->Set(
|
||||||
std::chrono::duration_cast<std::chrono::duration<double>>(
|
std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||||
now - work_queue_->front().time)
|
now - work_queue_->front().time)
|
||||||
|
@ -529,6 +531,7 @@ void PoseGraph2D::DrainWorkQueue() {
|
||||||
work_item = work_queue_->front().task;
|
work_item = work_queue_->front().task;
|
||||||
work_queue_->pop_front();
|
work_queue_->pop_front();
|
||||||
work_queue_size = work_queue_->size();
|
work_queue_size = work_queue_->size();
|
||||||
|
kWorkQueueSizeMetric->Set(work_queue_size);
|
||||||
}
|
}
|
||||||
process_work_queue = work_item() == WorkItem::Result::kDoNotRunOptimization;
|
process_work_queue = work_item() == WorkItem::Result::kDoNotRunOptimization;
|
||||||
}
|
}
|
||||||
|
@ -1288,6 +1291,10 @@ void PoseGraph2D::RegisterMetrics(metrics::FamilyFactory* family_factory) {
|
||||||
"mapping_2d_pose_graph_work_queue_delay",
|
"mapping_2d_pose_graph_work_queue_delay",
|
||||||
"Age of the oldest entry in the work queue in seconds");
|
"Age of the oldest entry in the work queue in seconds");
|
||||||
kWorkQueueDelayMetric = latency->Add({});
|
kWorkQueueDelayMetric = latency->Add({});
|
||||||
|
auto* queue_size =
|
||||||
|
family_factory->NewGaugeFamily("mapping_2d_pose_graph_work_queue_size",
|
||||||
|
"Number of items in the work queue");
|
||||||
|
kWorkQueueSizeMetric = queue_size->Add({});
|
||||||
auto* constraints = family_factory->NewGaugeFamily(
|
auto* constraints = family_factory->NewGaugeFamily(
|
||||||
"mapping_2d_pose_graph_constraints",
|
"mapping_2d_pose_graph_constraints",
|
||||||
"Current number of constraints in the pose graph");
|
"Current number of constraints in the pose graph");
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace cartographer {
|
||||||
namespace mapping {
|
namespace mapping {
|
||||||
|
|
||||||
static auto* kWorkQueueDelayMetric = metrics::Gauge::Null();
|
static auto* kWorkQueueDelayMetric = metrics::Gauge::Null();
|
||||||
|
static auto* kWorkQueueSizeMetric = metrics::Gauge::Null();
|
||||||
static auto* kConstraintsSameTrajectoryMetric = metrics::Gauge::Null();
|
static auto* kConstraintsSameTrajectoryMetric = metrics::Gauge::Null();
|
||||||
static auto* kConstraintsDifferentTrajectoryMetric = metrics::Gauge::Null();
|
static auto* kConstraintsDifferentTrajectoryMetric = metrics::Gauge::Null();
|
||||||
static auto* kActiveSubmapsMetric = metrics::Gauge::Null();
|
static auto* kActiveSubmapsMetric = metrics::Gauge::Null();
|
||||||
|
@ -169,6 +170,7 @@ void PoseGraph3D::AddWorkItem(
|
||||||
}
|
}
|
||||||
const auto now = std::chrono::steady_clock::now();
|
const auto now = std::chrono::steady_clock::now();
|
||||||
work_queue_->push_back({now, work_item});
|
work_queue_->push_back({now, work_item});
|
||||||
|
kWorkQueueSizeMetric->Set(work_queue_->size());
|
||||||
kWorkQueueDelayMetric->Set(
|
kWorkQueueDelayMetric->Set(
|
||||||
std::chrono::duration_cast<std::chrono::duration<double>>(
|
std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||||
now - work_queue_->front().time)
|
now - work_queue_->front().time)
|
||||||
|
@ -516,6 +518,7 @@ void PoseGraph3D::DrainWorkQueue() {
|
||||||
work_item = work_queue_->front().task;
|
work_item = work_queue_->front().task;
|
||||||
work_queue_->pop_front();
|
work_queue_->pop_front();
|
||||||
work_queue_size = work_queue_->size();
|
work_queue_size = work_queue_->size();
|
||||||
|
kWorkQueueSizeMetric->Set(work_queue_size);
|
||||||
}
|
}
|
||||||
process_work_queue = work_item() == WorkItem::Result::kDoNotRunOptimization;
|
process_work_queue = work_item() == WorkItem::Result::kDoNotRunOptimization;
|
||||||
}
|
}
|
||||||
|
@ -1268,6 +1271,10 @@ void PoseGraph3D::RegisterMetrics(metrics::FamilyFactory* family_factory) {
|
||||||
"mapping_3d_pose_graph_work_queue_delay",
|
"mapping_3d_pose_graph_work_queue_delay",
|
||||||
"Age of the oldest entry in the work queue in seconds");
|
"Age of the oldest entry in the work queue in seconds");
|
||||||
kWorkQueueDelayMetric = latency->Add({});
|
kWorkQueueDelayMetric = latency->Add({});
|
||||||
|
auto* queue_size =
|
||||||
|
family_factory->NewGaugeFamily("mapping_3d_pose_graph_work_queue_size",
|
||||||
|
"Number of items in the work queue");
|
||||||
|
kWorkQueueSizeMetric = queue_size->Add({});
|
||||||
auto* constraints = family_factory->NewGaugeFamily(
|
auto* constraints = family_factory->NewGaugeFamily(
|
||||||
"mapping_3d_pose_graph_constraints",
|
"mapping_3d_pose_graph_constraints",
|
||||||
"Current number of constraints in the pose graph");
|
"Current number of constraints in the pose graph");
|
||||||
|
|
Loading…
Reference in New Issue