mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-23 01:21:40 +00:00
Update metrics publisher hostname when hostname is changed (#2008)
This commit is contained in:
@@ -244,6 +244,19 @@ public class MetricsManager {
|
||||
|
||||
public void publishMetrics() {
|
||||
logger.debug("Publishing Metrics...");
|
||||
|
||||
// Check that the hostname hasn't changed
|
||||
if (!metricPublisher.getTopic().getName().equals(CameraServerJNI.getHostname())) {
|
||||
logger.warn("Metrics publisher name does not match hostname! Reinitializing publisher...");
|
||||
metricPublisher.close();
|
||||
metricPublisher =
|
||||
NetworkTablesManager.getInstance()
|
||||
.kRootTable
|
||||
.getSubTable("/metrics")
|
||||
.getProtobufTopic(CameraServerJNI.getHostname(), DeviceMetrics.proto)
|
||||
.publish();
|
||||
}
|
||||
|
||||
var metrics =
|
||||
new DeviceMetrics(
|
||||
this.getCpuTemp(),
|
||||
|
||||
Reference in New Issue
Block a user