@@ -64,6 +64,7 @@ struct TRITONSERVER_Server;
6464struct TRITONSERVER_ServerOptions ;
6565struct TRITONSERVER_Metric ;
6666struct TRITONSERVER_MetricFamily ;
67+ struct TRITONSERVER_MetricArgs ;
6768
6869///
6970/// TRITONSERVER API Version
@@ -2645,6 +2646,44 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricFamilyNew(
26452646TRITONSERVER_DECLSPEC struct TRITONSERVER_Error *
26462647TRITONSERVER_MetricFamilyDelete (struct TRITONSERVER_MetricFamily * family );
26472648
2649+ /// Get the TRITONSERVER_MetricKind of the metric family.
2650+ ///
2651+ /// \param metric The metric family object to query.
2652+ /// \param kind Returns the TRITONSERVER_MetricKind of metric.
2653+ /// \return a TRITONSERVER_Error indicating success or failure.
2654+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error *
2655+ TRITONSERVER_GetMetricFamilyKind (
2656+ struct TRITONSERVER_MetricFamily * family , TRITONSERVER_MetricKind * kind );
2657+
2658+ /// Create a new metric args object. The caller takes ownership of the
2659+ /// TRITONSERVER_Parameter object and must call TRITONSERVER_ParameterDelete to
2660+ /// release the object. The object will maintain its own copy of the 'value'
2661+ ///
2662+ /// \param name The parameter name.
2663+ /// \param type The parameter type.
2664+ /// \param value The pointer to the value.
2665+ /// \return A new TRITONSERVER_Parameter object. 'nullptr' will be returned if
2666+ /// 'type' is 'TRITONSERVER_PARAMETER_BYTES'. The caller should use
2667+ /// TRITONSERVER_ParameterBytesNew to create parameter with bytes type.
2668+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricArgsNew (
2669+ struct TRITONSERVER_MetricArgs * * args );
2670+
2671+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error *
2672+ TRITONSERVER_MetricArgsSetHistogram (
2673+ struct TRITONSERVER_MetricArgs * args , const double * buckets ,
2674+ const uint64_t buckets_count );
2675+
2676+ /// Delete a metric args object.
2677+ ///
2678+ /// \param name The parameter name.
2679+ /// \param type The parameter type.
2680+ /// \param value The pointer to the value.
2681+ /// \return A new TRITONSERVER_Parameter object. 'nullptr' will be returned if
2682+ /// 'type' is 'TRITONSERVER_PARAMETER_BYTES'. The caller should use
2683+ /// TRITONSERVER_ParameterBytesNew to create parameter with bytes type.
2684+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricArgsDelete (
2685+ struct TRITONSERVER_MetricArgs * );
2686+
26482687/// Create a new metric object. The caller takes ownership of the
26492688/// TRITONSERVER_Metric object and must call
26502689/// TRITONSERVER_MetricDelete to release the object. The caller is also
@@ -2660,10 +2699,28 @@ TRITONSERVER_MetricFamilyDelete(struct TRITONSERVER_MetricFamily* family);
26602699/// bucket boundaries. For histogram only.
26612700/// \return a TRITONSERVER_Error indicating success or failure.
26622701TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricNew (
2702+ struct TRITONSERVER_Metric * * metric ,
2703+ struct TRITONSERVER_MetricFamily * family ,
2704+ const struct TRITONSERVER_Parameter * * labels , const uint64_t label_count );
2705+
2706+ /// Create a new metric object. The caller takes ownership of the
2707+ /// TRITONSERVER_Metric object and must call
2708+ /// TRITONSERVER_MetricDelete to release the object. The caller is also
2709+ /// responsible for ownership of the labels passed in. Each label can be deleted
2710+ /// immediately after creating the metric with TRITONSERVER_ParameterDelete
2711+ /// if not re-using the labels.
2712+ ///
2713+ /// \param metric Returns the new metric object.
2714+ /// \param family The metric family to add this new metric to.
2715+ /// \param labels The array of labels to associate with this new metric.
2716+ /// \param label_count The number of labels.
2717+ /// \param args Additional arguments to construct the metric.
2718+ /// \return a TRITONSERVER_Error indicating success or failure.
2719+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricNewWithArgs (
26632720 struct TRITONSERVER_Metric * * metric ,
26642721 struct TRITONSERVER_MetricFamily * family ,
26652722 const struct TRITONSERVER_Parameter * * labels , const uint64_t label_count ,
2666- const void * buckets = nullptr );
2723+ const struct TRITONSERVER_MetricArgs * args );
26672724
26682725/// Delete a metric object.
26692726/// All TRITONSERVER_Metric* objects should be deleted BEFORE their
@@ -2700,8 +2757,9 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricValue(
27002757TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricIncrement (
27012758 struct TRITONSERVER_Metric * metric , double value );
27022759
2703- /// Set the current value of metric to value.
2704- /// Supports metrics of kind TRITONSERVER_METRIC_KIND_GAUGE and returns
2760+ /// Set the current value of metric to value or observe the value to metric.
2761+ /// Supports metrics of kind TRITONSERVER_METRIC_KIND_GAUGE and
2762+ /// TRITONSERVER_METRIC_KIND_HISTOGRAM and returns
27052763/// TRITONSERVER_ERROR_UNSUPPORTED for unsupported TRITONSERVER_MetricKind.
27062764///
27072765/// \param metric The metric object to update.
@@ -2710,16 +2768,6 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricIncrement(
27102768TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricSet (
27112769 struct TRITONSERVER_Metric * metric , double value );
27122770
2713- /// Observe the current value of metric to value.
2714- /// Supports metrics of kind TRITONSERVER_METRIC_KIND_HISTOGRAM and returns
2715- /// TRITONSERVER_ERROR_UNSUPPORTED for unsupported TRITONSERVER_MetricKind.
2716- ///
2717- /// \param metric The metric object to update.
2718- /// \param value The amount to observe metric's value to.
2719- /// \return a TRITONSERVER_Error indicating success or failure.
2720- TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricObserve (
2721- struct TRITONSERVER_Metric * metric , double value );
2722-
27232771/// Collect metrics.
27242772/// Supports metrics of kind TRITONSERVER_METRIC_KIND_COUNTER,
27252773/// TRITONSERVER_METRIC_KIND_GAUGE, TRITONSERVER_METRIC_KIND_HISTOGRAM and
@@ -2732,7 +2780,7 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricObserve(
27322780TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricCollect (
27332781 struct TRITONSERVER_Metric * metric , void * value );
27342782
2735- /// Get the TRITONSERVER_MetricKind of metric and its corresponding family.
2783+ /// Get the TRITONSERVER_MetricKind of metric of its corresponding family.
27362784///
27372785/// \param metric The metric object to query.
27382786/// \param kind Returns the TRITONSERVER_MetricKind of metric.
0 commit comments