@@ -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,42 @@ 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_MetricArgs object and must call TRITONSERVER_MetricArgsDelete
2660+ /// to release the object.
2661+ ///
2662+ /// \param args Returns the new metric args object.
2663+ /// \return a TRITONSERVER_Error indicating success or failure.
2664+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricArgsNew (
2665+ struct TRITONSERVER_MetricArgs * * args );
2666+
2667+ /// Set metric args with prometheus histogram metric parameter.
2668+ ///
2669+ /// \param args The metric args object to set.
2670+ /// \param buckets The array of bucket boundaries.
2671+ /// \param buckets_count The number of bucket boundaries.
2672+ /// \return a TRITONSERVER_Error indicating success or failure.
2673+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error *
2674+ TRITONSERVER_MetricArgsSetHistogram (
2675+ struct TRITONSERVER_MetricArgs * args , const double * buckets ,
2676+ const uint64_t buckets_count );
2677+
2678+ /// Delete a metric args object.
2679+ ///
2680+ /// \param args The metric args object.
2681+ /// \return a TRITONSERVER_Error indicating success or failure.
2682+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricArgsDelete (
2683+ struct TRITONSERVER_MetricArgs * args );
2684+
26482685/// Create a new metric object. The caller takes ownership of the
26492686/// TRITONSERVER_Metric object and must call
26502687/// TRITONSERVER_MetricDelete to release the object. The caller is also
@@ -2660,10 +2697,31 @@ TRITONSERVER_MetricFamilyDelete(struct TRITONSERVER_MetricFamily* family);
26602697/// bucket boundaries. For histogram only.
26612698/// \return a TRITONSERVER_Error indicating success or failure.
26622699TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricNew (
2700+ struct TRITONSERVER_Metric * * metric ,
2701+ struct TRITONSERVER_MetricFamily * family ,
2702+ const struct TRITONSERVER_Parameter * * labels , const uint64_t label_count );
2703+
2704+ /// Create a new metric object. The caller takes ownership of the
2705+ /// TRITONSERVER_Metric object and must call
2706+ /// TRITONSERVER_MetricDelete to release the object. The caller is also
2707+ /// responsible for ownership of the labels passed in.
2708+ /// Each label can be deleted immediately after creating the metric with
2709+ /// TRITONSERVER_ParameterDelete if not re-using the labels.
2710+ /// Metric args can be deleted immediately after creating the metric with
2711+ /// TRITONSERVER_MetricArgsDelete if not re-using the metric args.
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 Metric args that store additional arguments to construct
2718+ /// particular metric types, e.g. histogram.
2719+ /// \return a TRITONSERVER_Error indicating success or failure.
2720+ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricNewWithArgs (
26632721 struct TRITONSERVER_Metric * * metric ,
26642722 struct TRITONSERVER_MetricFamily * family ,
26652723 const struct TRITONSERVER_Parameter * * labels , const uint64_t label_count ,
2666- const void * buckets = nullptr );
2724+ const struct TRITONSERVER_MetricArgs * args );
26672725
26682726/// Delete a metric object.
26692727/// All TRITONSERVER_Metric* objects should be deleted BEFORE their
@@ -2700,8 +2758,9 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricValue(
27002758TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricIncrement (
27012759 struct TRITONSERVER_Metric * metric , double value );
27022760
2703- /// Set the current value of metric to value.
2704- /// Supports metrics of kind TRITONSERVER_METRIC_KIND_GAUGE and returns
2761+ /// Set the current value of metric to value or observe the value to metric.
2762+ /// Supports metrics of kind TRITONSERVER_METRIC_KIND_GAUGE and
2763+ /// TRITONSERVER_METRIC_KIND_HISTOGRAM. Returns
27052764/// TRITONSERVER_ERROR_UNSUPPORTED for unsupported TRITONSERVER_MetricKind.
27062765///
27072766/// \param metric The metric object to update.
@@ -2710,16 +2769,6 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricIncrement(
27102769TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricSet (
27112770 struct TRITONSERVER_Metric * metric , double value );
27122771
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-
27232772/// Collect metrics.
27242773/// Supports metrics of kind TRITONSERVER_METRIC_KIND_COUNTER,
27252774/// TRITONSERVER_METRIC_KIND_GAUGE, TRITONSERVER_METRIC_KIND_HISTOGRAM and
@@ -2732,7 +2781,7 @@ TRITONSERVER_DECLSPEC struct TRITONSERVER_Error* TRITONSERVER_MetricObserve(
27322781TRITONSERVER_DECLSPEC struct TRITONSERVER_Error * TRITONSERVER_MetricCollect (
27332782 struct TRITONSERVER_Metric * metric , void * value );
27342783
2735- /// Get the TRITONSERVER_MetricKind of metric and its corresponding family.
2784+ /// Get the TRITONSERVER_MetricKind of metric of its corresponding family.
27362785///
27372786/// \param metric The metric object to query.
27382787/// \param kind Returns the TRITONSERVER_MetricKind of metric.
0 commit comments