fix: return empty when usage is not there instead of report error (#13842)

- [x] Should start check job after node start, otherwise it will report
gRPC can't connect.
- [x] Should skip usage check when there is no usage stream, otherwise
it will always report error.
This commit is contained in:
Hengfei Yang
2026-08-17 11:54:39 +00:00
committed by GitHub
parent 1c849a9c71
commit 42d4e2a203
2 changed files with 7 additions and 2 deletions
+6
View File
@@ -21,6 +21,7 @@ use config::{
search::{
Query, Request as SearchRequest, RequestEncoding, SearchEventType, default_use_cache,
},
self_reporting::usage::USAGE_STREAM,
stream::StreamType,
},
utils::json,
@@ -42,6 +43,11 @@ pub async fn get_usage(
(vec![], vec![])
};
// return empty if usage stream is not there
if !infra::schema::exists(META_ORG_ID, StreamType::Logs, USAGE_STREAM).await {
return Ok(vec![]);
}
let req = SearchRequest {
query: Query {
sql,
+1 -2
View File
@@ -41,8 +41,7 @@ pub async fn run() -> Result<(), anyhow::Error> {
{
log::error!("[SERVICE_GRAPH::JOB] Processing failed: {e}");
}
},
sleep_after
}
);
}