From 7f0612c8984c58459394acdc33a03bc07b4431cc Mon Sep 17 00:00:00 2001 From: Yingge He Date: Thu, 17 Oct 2024 11:01:21 -0700 Subject: [PATCH] Fix incorrect initialization of shared_ptr --- src/infer_response.cc | 3 ++- src/infer_response.h | 4 ++-- src/metric_model_reporter.h | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/infer_response.cc b/src/infer_response.cc index 092338d97..1a3f85175 100644 --- a/src/infer_response.cc +++ b/src/infer_response.cc @@ -88,7 +88,8 @@ InferenceResponse::InferenceResponse( response_fn_(response_fn), response_userp_(response_userp), response_delegator_(delegator), #ifdef TRITON_ENABLE_METRICS - responses_sent_(responses_sent), infer_start_ns_(infer_start_ns), + responses_sent_(std::move(responses_sent)), + infer_start_ns_(infer_start_ns), #endif // TRITON_ENABLE_METRICS null_response_(false) { diff --git a/src/infer_response.h b/src/infer_response.h index 281af4740..8d09285ee 100644 --- a/src/infer_response.h +++ b/src/infer_response.h @@ -63,7 +63,7 @@ class InferenceResponseFactory { is_cancelled_(false) #ifdef TRITON_ENABLE_METRICS , - responses_sent_(0) + responses_sent_(std::make_shared>(0)) #endif // TRITON_ENABLE_METRICS #ifdef TRITON_ENABLE_STATS , @@ -387,7 +387,7 @@ class InferenceResponse { #ifdef TRITON_ENABLE_METRICS // Total number of responses sent created by its response factory. - std::shared_ptr> responses_sent_; + const std::shared_ptr> responses_sent_; // The start time of associate request in ns. const uint64_t infer_start_ns_; diff --git a/src/metric_model_reporter.h b/src/metric_model_reporter.h index 5ab9f0201..faeb5f399 100644 --- a/src/metric_model_reporter.h +++ b/src/metric_model_reporter.h @@ -57,11 +57,13 @@ struct MetricReporterConfig { bool latency_histograms_enabled_ = true; // Create and use Summaries for per-model latency related metrics bool latency_summaries_enabled_ = false; + // Buckets used for any histogram metrics. Each value represents + // a bucket boundary. + prometheus::Histogram::BucketBoundaries buckets_ = {100, 500, 2000, 5000}; // Quantiles used for any summary metrics. Each pair of values represents // { quantile, error }. For example, {0.90, 0.01} means to compute the // 90th percentile with 1% error on either side, so the approximate 90th // percentile value will be between the 89th and 91st percentiles. - prometheus::Histogram::BucketBoundaries buckets_ = {10, 100, 500, 1000}; prometheus::Summary::Quantiles quantiles_ = { {0.5, 0.05}, {0.9, 0.01}, {0.95, 0.001}, {0.99, 0.001}, {0.999, 0.001}};