Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version info to prometheus metrics #272

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/metrics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ Metrics::Metrics()
"microseconds.")
.Register(*registry_)),

// Versions
version_info_family_(
prometheus::BuildGauge()
.Name("triton_version_information")
Copy link
Contributor

@rmccorm4 rmccorm4 Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ClifHouck, thanks for the contrbution.

I reached out on the original issue to clarify the ask - I'm not sure if server/backend API versions are necessary for the original ask if the actual triton release version is reflected and can be mapped.

However, it does raise a question that this extra level of detail may be useful to add to an existing endpoint. Do you have any reasoning on exposing these through prometheus rather than another existing REST endpoint? Pros of adding it to a standard (non-metrics) endpoint is that it would always be available, regardless of whether the server was built or configured at runtime to use prometheus metrics or not.

.Help("Triton API & Server Versions")
.Register(*registry_)),

#ifdef TRITON_ENABLE_METRICS_GPU
gpu_utilization_family_(prometheus::BuildGauge()
.Name("nv_gpu_utilization")
Expand Down Expand Up @@ -238,6 +245,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_;
Expand Down
3 changes: 3 additions & 0 deletions src/metrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,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