Skip to content

Commit d261b8d

Browse files
authored
feat: Extend histogram metrics to non-decoupled models (#464)
1 parent 9686007 commit d261b8d

6 files changed

Lines changed: 21 additions & 36 deletions

File tree

src/backend_model_instance.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright 2020-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions
@@ -192,8 +192,8 @@ TritonModelInstance::TritonModelInstance(
192192
model_->Server()->ResponseCacheEnabled();
193193
MetricModelReporter::Create(
194194
model_->ModelId(), model_->Version(), id, response_cache_enabled,
195-
model_->IsDecoupled(), model_->Config().metric_tags(),
196-
model_->Config().model_metrics(), &reporter_);
195+
model_->Config().metric_tags(), model_->Config().model_metrics(),
196+
&reporter_);
197197
}
198198
#endif // TRITON_ENABLE_METRICS
199199
}

src/ensemble_scheduler/ensemble_scheduler.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,13 +1648,12 @@ EnsembleScheduler::EnsembleScheduler(
16481648
}
16491649
#endif // TRITON_ENABLE_GPU
16501650

1651-
const bool is_decoupled = config.model_transaction_policy().decoupled();
16521651
#ifdef TRITON_ENABLE_METRICS
16531652
if (Metrics::Enabled()) {
16541653
// Ensemble scheduler doesn't currently support response cache at top level.
16551654
MetricModelReporter::Create(
16561655
model_id, 1 /* model_version */, METRIC_REPORTER_ID_CPU,
1657-
false /* response_cache_enabled */, is_decoupled, config.metric_tags(),
1656+
false /* response_cache_enabled */, config.metric_tags(),
16581657
config.model_metrics(), &metric_reporter_);
16591658
}
16601659
#endif // TRITON_ENABLE_METRICS
@@ -1665,7 +1664,7 @@ EnsembleScheduler::EnsembleScheduler(
16651664
info_->ensemble_name_ = config.name();
16661665

16671666
// This config field is filled internally for ensemble models
1668-
info_->is_decoupled_ = is_decoupled;
1667+
info_->is_decoupled_ = config.model_transaction_policy().decoupled();
16691668

16701669
// field to check if response cache enabled in the ensemble model config.
16711670
info_->is_cache_enabled_ =

src/metric_model_reporter.cc

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions
@@ -42,8 +42,7 @@ namespace triton { namespace core {
4242
//
4343
void
4444
MetricReporterConfig::ParseConfig(
45-
bool response_cache_enabled, bool is_decoupled,
46-
const inference::ModelMetrics& model_metrics)
45+
bool response_cache_enabled, const inference::ModelMetrics& model_metrics)
4746
{
4847
// Global config only for now in config map
4948
auto metrics_config_map = Metrics::ConfigMap();
@@ -74,7 +73,6 @@ MetricReporterConfig::ParseConfig(
7473

7574
// Set flag to signal to stats aggregator if caching is enabled or not
7675
cache_enabled_ = response_cache_enabled;
77-
is_decoupled_ = is_decoupled;
7876

7977
// Override default histogram options if set in model_metrics.
8078
for (const auto& metric_control : model_metrics.metric_control()) {
@@ -139,7 +137,7 @@ const std::map<FailureReason, std::string>
139137
Status
140138
MetricModelReporter::Create(
141139
const ModelIdentifier& model_id, const int64_t model_version,
142-
const int device, bool response_cache_enabled, bool is_decoupled,
140+
const int device, bool response_cache_enabled,
143141
const triton::common::MetricTagsMap& model_tags,
144142
const inference::ModelMetrics& model_metrics,
145143
std::shared_ptr<MetricModelReporter>* metric_model_reporter)
@@ -169,23 +167,23 @@ MetricModelReporter::Create(
169167
}
170168

171169
metric_model_reporter->reset(new MetricModelReporter(
172-
model_id, model_version, device, response_cache_enabled, is_decoupled,
173-
model_tags, model_metrics));
170+
model_id, model_version, device, response_cache_enabled, model_tags,
171+
model_metrics));
174172
reporter_map.insert({hash_labels, *metric_model_reporter});
175173
return Status::Success;
176174
}
177175

178176
MetricModelReporter::MetricModelReporter(
179177
const ModelIdentifier& model_id, const int64_t model_version,
180-
const int device, bool response_cache_enabled, bool is_decoupled,
178+
const int device, bool response_cache_enabled,
181179
const triton::common::MetricTagsMap& model_tags,
182180
const inference::ModelMetrics& model_metrics)
183181
{
184182
std::map<std::string, std::string> labels;
185183
GetMetricLabels(&labels, model_id, model_version, device, model_tags);
186184

187185
// Parse metrics config to control metric setup and behavior
188-
config_.ParseConfig(response_cache_enabled, is_decoupled, model_metrics);
186+
config_.ParseConfig(response_cache_enabled, model_metrics);
189187

190188
// Initialize families and metrics
191189
InitializeCounters(labels);
@@ -306,12 +304,9 @@ MetricModelReporter::InitializeHistograms(
306304
const std::map<std::string, std::string>& labels)
307305
{
308306
// Update MetricReporterConfig::metric_map_ for new histograms.
309-
// Only create response metrics if decoupled model to reduce metric output
310307
if (config_.latency_histograms_enabled_) {
311-
if (config_.is_decoupled_) {
312-
histogram_families_[kFirstResponseHistogram] =
313-
&Metrics::FamilyFirstResponseDuration();
314-
}
308+
histogram_families_[kFirstResponseHistogram] =
309+
&Metrics::FamilyFirstResponseDuration();
315310
}
316311

317312
for (auto& iter : histogram_families_) {

src/metric_model_reporter.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright 2019-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions
@@ -47,7 +47,7 @@ struct MetricReporterConfig {
4747
#ifdef TRITON_ENABLE_METRICS
4848
// Parses Metrics::ConfigMap and sets fields if specified
4949
void ParseConfig(
50-
bool response_cache_enabled, bool is_decoupled,
50+
bool response_cache_enabled,
5151
const inference::ModelMetrics& model_metrics);
5252
// Parses pairs of quantiles "quantile1:error1, quantile2:error2, ..."
5353
// and overwrites quantiles_ field if successful.
@@ -76,8 +76,6 @@ struct MetricReporterConfig {
7676
// This helps handle infer_stats aggregation for summaries on cache misses.
7777
bool cache_enabled_ = false;
7878

79-
bool is_decoupled_ = false;
80-
8179
private:
8280
// Maps the metric family fullname to its lookup key. This field is required
8381
// because the users are expected to configure metric configuration
@@ -97,7 +95,7 @@ class MetricModelReporter {
9795
static Status Create(
9896
const triton::core::ModelIdentifier& model_id,
9997
const int64_t model_version, const int device,
100-
bool response_cache_enabled, bool is_decoupled,
98+
bool response_cache_enabled,
10199
// FIXME: [DLIS-7497] Merge model_tags with model_metrics
102100
const triton::common::MetricTagsMap& model_tags,
103101
const inference::ModelMetrics& model_metrics,
@@ -125,7 +123,7 @@ class MetricModelReporter {
125123
private:
126124
MetricModelReporter(
127125
const ModelIdentifier& model_id, const int64_t model_version,
128-
const int device, bool response_cache_enabled, bool is_decoupled,
126+
const int device, bool response_cache_enabled,
129127
const triton::common::MetricTagsMap& model_tags,
130128
const inference::ModelMetrics& model_metrics);
131129

src/model.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright 2018-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions
@@ -135,8 +135,7 @@ Model::Init(const bool is_config_provided)
135135
#ifdef TRITON_ENABLE_METRICS
136136
MetricModelReporter::Create(
137137
ModelId(), Version(), METRIC_REPORTER_ID_UTILITY, ResponseCacheEnabled(),
138-
IsDecoupled(), Config().metric_tags(), Config().model_metrics(),
139-
&reporter_);
138+
Config().metric_tags(), Config().model_metrics(), &reporter_);
140139
#endif // TRITON_ENABLE_METRICS
141140

142141
return Status::Success;

src/model.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
// Copyright 2018-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
//
33
// Redistribution and use in source and binary forms, with or without
44
// modification, are permitted provided that the following conditions
@@ -148,12 +148,6 @@ class Model {
148148
return config_.response_cache().enable();
149149
}
150150

151-
// Get whether the model is decoupled.
152-
bool IsDecoupled() const
153-
{
154-
return config_.model_transaction_policy().decoupled();
155-
}
156-
157151
// Get the number of required inputs
158152
size_t RequiredInputCount() const { return required_input_count_; }
159153

0 commit comments

Comments
 (0)