From 7ed184bdc2639e7f52f55e4be9b6c6b6a5b8140d Mon Sep 17 00:00:00 2001 From: Clif Houck Date: Mon, 25 Sep 2023 16:12:00 -0500 Subject: [PATCH 1/2] Add version info to prometheus metrics Signed-off-by: Clif Houck --- src/metrics.cc | 17 +++++++++++++++++ src/metrics.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/src/metrics.cc b/src/metrics.cc index 28ab921ca..07c4ad568 100644 --- a/src/metrics.cc +++ b/src/metrics.cc @@ -190,6 +190,18 @@ Metrics::Metrics() "microseconds.") .Register(*registry_)), + // Versions + version_info_family_( + prometheus::BuildGauge() + .Name("triton_version_information") + .Help("Triton API & Server Versions") + /*.Labels({ + //{std::string("api_major_version"), std::to_string(TRITONBACKEND_API_VERSION_MAJOR)}, + {std::string("api_minor_version"), std::to_string(TRITONBACKEND_API_VERSION_MINOR)}, + {std::string("server_major_version"), std::to_string(TRITONSERVER_API_VERSION_MAJOR)}, + {std::string("server_minor_version"), std::to_string(TRITONSERVER_API_VERSION_MINOR)}})*/ + .Register(*registry_)), + #ifdef TRITON_ENABLE_METRICS_GPU gpu_utilization_family_(prometheus::BuildGauge() .Name("nv_gpu_utilization") @@ -238,6 +250,11 @@ Metrics::Metrics() cpu_metrics_enabled_(false), pinned_memory_metrics_enabled_(false), metrics_interval_ms_(2000) { + version_info_family_.Add({ + {std::string("api_major_version"), std::to_string(TRITONBACKEND_API_VERSION_MAJOR)}, + {std::string("api_minor_version"), std::to_string(TRITONBACKEND_API_VERSION_MINOR)}, + {std::string("server_major_version"), std::to_string(TRITONSERVER_API_VERSION_MAJOR)}, + {std::string("server_minor_version"), std::to_string(TRITONSERVER_API_VERSION_MINOR)}}); } static prometheus::detail::LabelHasher label_hasher_; diff --git a/src/metrics.h b/src/metrics.h index 2abec1cf3..ce7b5be31 100644 --- a/src/metrics.h +++ b/src/metrics.h @@ -324,6 +324,9 @@ class Metrics { prometheus::Family& cache_hit_summary_us_model_family_; prometheus::Family& cache_miss_summary_us_model_family_; + // Version + prometheus::Family& version_info_family_; + #ifdef TRITON_ENABLE_METRICS_GPU prometheus::Family& gpu_utilization_family_; prometheus::Family& gpu_memory_total_family_; From ab8e129e821bfcfc637e9fe07220ba9098d0b96e Mon Sep 17 00:00:00 2001 From: Clif Houck Date: Tue, 3 Oct 2023 11:37:58 -0500 Subject: [PATCH 2/2] Remove commented out code Signed-off-by: Clif Houck --- src/metrics.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/metrics.cc b/src/metrics.cc index 07c4ad568..91b2231f1 100644 --- a/src/metrics.cc +++ b/src/metrics.cc @@ -195,11 +195,6 @@ Metrics::Metrics() prometheus::BuildGauge() .Name("triton_version_information") .Help("Triton API & Server Versions") - /*.Labels({ - //{std::string("api_major_version"), std::to_string(TRITONBACKEND_API_VERSION_MAJOR)}, - {std::string("api_minor_version"), std::to_string(TRITONBACKEND_API_VERSION_MINOR)}, - {std::string("server_major_version"), std::to_string(TRITONSERVER_API_VERSION_MAJOR)}, - {std::string("server_minor_version"), std::to_string(TRITONSERVER_API_VERSION_MINOR)}})*/ .Register(*registry_)), #ifdef TRITON_ENABLE_METRICS_GPU