From e88c3b6fc1edc0fd19892497ad72bf7f902cebe9 Mon Sep 17 00:00:00 2001 From: Yingge He Date: Mon, 12 Aug 2024 18:17:02 -0700 Subject: [PATCH] Update C API --- include/triton/core/tritonserver.h | 2 +- python/tritonserver/_c/triton_bindings.pyi | 2 -- src/metric_family.cc | 2 +- src/test/metrics_api_test.cc | 3 +-- src/tritonserver.cc | 4 ++-- src/tritonserver_stub.cc | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/triton/core/tritonserver.h b/include/triton/core/tritonserver.h index 6478e95f8..8b5d1de33 100644 --- a/include/triton/core/tritonserver.h +++ b/include/triton/core/tritonserver.h @@ -2716,7 +2716,7 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricNew( /// \param label_count The number of labels. /// \param args Additional arguments to construct the metric. /// \return a TRITONSERVER_Error indicating success or failure. -TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricNewGeneric( +TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricNewWithArgs( struct TRITONSERVER_Metric** metric, struct TRITONSERVER_MetricFamily* family, const struct TRITONSERVER_Parameter** labels, const uint64_t label_count, diff --git a/python/tritonserver/_c/triton_bindings.pyi b/python/tritonserver/_c/triton_bindings.pyi index 15e6b9004..71deaba6b 100644 --- a/python/tritonserver/_c/triton_bindings.pyi +++ b/python/tritonserver/_c/triton_bindings.pyi @@ -357,7 +357,6 @@ class TRITONSERVER_Metric: ) -> None: ... def increment(self, arg0: float) -> None: ... def set_value(self, arg0: float) -> None: ... - def observe(self, arg0: float) -> None: ... @property def kind(self) -> TRITONSERVER_MetricKind: ... @property @@ -385,7 +384,6 @@ class TRITONSERVER_MetricKind: __members__: ClassVar[dict] = ... # read-only COUNTER: ClassVar[TRITONSERVER_MetricKind] = ... GAUGE: ClassVar[TRITONSERVER_MetricKind] = ... - HISTOGRAM: ClassVar[TRITONSERVER_MetricKind] = ... __entries: ClassVar[dict] = ... def __init__(self, value: int) -> None: ... def __eq__(self, other: object) -> bool: ... diff --git a/src/metric_family.cc b/src/metric_family.cc index 0602ea8ef..0a145b80c 100644 --- a/src/metric_family.cc +++ b/src/metric_family.cc @@ -26,7 +26,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifdef TRITON_ENABLE_METRICS -// Move to metric_family.cc + #include "metric_family.h" #include "metrics.h" diff --git a/src/test/metrics_api_test.cc b/src/test/metrics_api_test.cc index be5866291..598d120f9 100644 --- a/src/test/metrics_api_test.cc +++ b/src/test/metrics_api_test.cc @@ -413,7 +413,7 @@ TEST_F(MetricsApiTest, TestHistogramEndToEnd) "example2", TRITONSERVER_PARAMETER_STRING, "histogram_label2")); std::vector buckets = {0.1, 1.0, 2.5, 5.0, 10.0}; FAIL_TEST_IF_ERR( - TRITONSERVER_MetricNewGeneric( + TRITONSERVER_MetricNewWithArgs( &metric, family, labels.data(), labels.size(), reinterpret_cast(&buckets)), "Creating new metric"); @@ -436,7 +436,6 @@ TEST_F(MetricsApiTest, TestHistogramEndToEnd) ASSERT_EQ(NumMetricMatches(server_, description), 0); } - // Test that a duplicate metric family can't be added // with a conflicting type/kind TEST_F(MetricsApiTest, TestDupeMetricFamilyDiffKind) diff --git a/src/tritonserver.cc b/src/tritonserver.cc index cfc1b2e54..06714d522 100644 --- a/src/tritonserver.cc +++ b/src/tritonserver.cc @@ -3430,7 +3430,7 @@ TRITONSERVER_MetricNew( const TRITONSERVER_Parameter** labels, const uint64_t label_count) { #ifdef TRITON_ENABLE_METRICS - return TRITONSERVER_MetricNewGeneric( + return TRITONSERVER_MetricNewWithArgs( metric, family, labels, label_count, nullptr); #else return TRITONSERVER_ErrorNew( @@ -3442,7 +3442,7 @@ TRITONSERVER_MetricNew( // TRITONSERVER_MetricGeneric // TRITONSERVER_Error* -TRITONSERVER_MetricNewGeneric( +TRITONSERVER_MetricNewWithArgs( TRITONSERVER_Metric** metric, TRITONSERVER_MetricFamily* family, const TRITONSERVER_Parameter** labels, const uint64_t label_count, const TRITONSERVER_MetricArgs* args) diff --git a/src/tritonserver_stub.cc b/src/tritonserver_stub.cc index bc7cc1913..f6fbe6933 100644 --- a/src/tritonserver_stub.cc +++ b/src/tritonserver_stub.cc @@ -1081,7 +1081,7 @@ TRITONSERVER_MetricNew() } TRITONAPI_DECLSPEC void -TRITONSERVER_MetricNewGeneric() +TRITONSERVER_MetricNewWithArgs() { }