-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
When querying historical metrics data for a Prometheus-type monitor, the query returns empty results even though the data has been successfully stored. Consequently, historical data charts display "No Data."
The issue stems from an inconsistency in the app parameter value between the storage and query phases for Prometheus monitors.
Expected Behavior
No response
Steps To Reproduce
No response
Environment
HertzBeat version(s):1.8.0Debug logs
No response
Anything else?
At Storage (Monitor Creation/Modification): In MonitorServiceImpl.java:
if (CommonConstants.PROMETHEUS.equals(monitor.getApp())) {
appDefine.setApp(CommonConstants.PROMETHEUS_APP_PREFIX + monitor.getName());
}For Prometheus monitors, AppDefine.app is set to prometheus_{monitorName} (e.g., prometheus_my_monitor). This value is used to construct table names in storage engines.
At Storage Execution (using TdEngine as an example):
String app = metricsData.getApp()(retrieves the prefixed name from AppDefine).- Table name becomes
app + "_" + metrics + "_" + instance + "_v2", resulting in prometheus_my_monitor_metrics_instance_v2.
At Query (Frontend to Controller):
- The frontend passes the app parameter from Monitor.getApp(), which is simply prometheus.
- MetricsDataController.java: Extracts
app = names[0](resulting in prometheus).
When the query reaches the storage layer (e.g., TdEngineDataStorage.java:360), getTable(app, metrics, instance) uses the raw prometheus string instead of the prefixed prometheus_my_monitor, failing to locate the correct table.
The following storages construct table names using the app parameter and are affected:
TDengine (TdEngineDataStorage.java)
IoTDB (IotDbDataStorage.java)
InfluxDB (InfluxdbDataStorage.java)
QuestDB (QuestdbDataStorage.java)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status