added instance id to config response (#459)

This commit is contained in:
Ashish Kolhe
2023-03-29 22:46:04 +08:00
committed by GitHub
parent 899fa0162d
commit d880dc86d7
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -19,7 +19,7 @@ use std::io::Error;
use utoipa::ToSchema;
use crate::common::json;
use crate::infra::config::{self, CONFIG};
use crate::infra::config::{self, CONFIG, INSTANCE_ID};
use crate::infra::{cache, cluster};
use crate::meta::functions::ZoFunction;
use crate::service::search::datafusion::DEFAULT_FUNCTIONS;
@@ -32,6 +32,7 @@ pub struct HealthzResponse {
#[derive(Serialize)]
struct ConfigResponse<'a> {
version: String,
instance: String,
commit_hash: String,
build_date: String,
functions_enabled: bool,
@@ -59,6 +60,7 @@ pub async fn healthz() -> Result<HttpResponse, Error> {
pub async fn zo_config() -> Result<HttpResponse, Error> {
Ok(HttpResponse::Ok().json(ConfigResponse {
version: config::VERSION.to_string(),
instance: INSTANCE_ID.get("instance_id").unwrap().to_string(),
commit_hash: config::COMMIT_HASH.to_string(),
build_date: config::BUILD_DATE.to_string(),
functions_enabled: config::HAS_FUNCTIONS,
+1 -1
View File
@@ -627,7 +627,7 @@ fn handle_metrics_response(sources: Vec<json::Value>) -> Vec<json::Value> {
fields.remove("value");
results_metrics.insert(key.clone(), json::Value::Object(fields));
}
let entry = results_values.entry(key).or_insert(Vec::new());
let entry = results_values.entry(key).or_default();
let value = [
fields
.get(&CONFIG.common.time_stamp_col)