Skip to content

Commit

Permalink
Add version info to prometheus metrics
Browse files Browse the repository at this point in the history
Signed-off-by: Clif Houck <[email protected]>
  • Loading branch information
ClifHouck committed Oct 3, 2023
1 parent 55358c6 commit a28ed6b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/metrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,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")
Expand Down Expand Up @@ -224,6 +236,11 @@ Metrics::Metrics()
metrics_enabled_(false), gpu_metrics_enabled_(false),
cpu_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_;
Expand Down
3 changes: 3 additions & 0 deletions src/metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,9 @@ class Metrics {
prometheus::Family<prometheus::Summary>& cache_hit_summary_us_model_family_;
prometheus::Family<prometheus::Summary>& cache_miss_summary_us_model_family_;

// Version
prometheus::Family<prometheus::Gauge>& version_info_family_;

#ifdef TRITON_ENABLE_METRICS_GPU
prometheus::Family<prometheus::Gauge>& gpu_utilization_family_;
prometheus::Family<prometheus::Gauge>& gpu_memory_total_family_;
Expand Down

0 comments on commit a28ed6b

Please sign in to comment.