Skip to content

Commit

Permalink
Update C API
Browse files Browse the repository at this point in the history
  • Loading branch information
yinggeh committed Aug 13, 2024
1 parent fce8314 commit e88c3b6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/triton/core/tritonserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions python/tritonserver/_c/triton_bindings.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: ...
Expand Down
2 changes: 1 addition & 1 deletion src/metric_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions src/test/metrics_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ TEST_F(MetricsApiTest, TestHistogramEndToEnd)
"example2", TRITONSERVER_PARAMETER_STRING, "histogram_label2"));
std::vector<double> 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<TRITONSERVER_MetricArgs*>(&buckets)),
"Creating new metric");
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/tritonserver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/tritonserver_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,7 @@ TRITONSERVER_MetricNew()
}

TRITONAPI_DECLSPEC void
TRITONSERVER_MetricNewGeneric()
TRITONSERVER_MetricNewWithArgs()
{
}

Expand Down

0 comments on commit e88c3b6

Please sign in to comment.