Function TRTSERVER_MetricsFormatted

Function Documentation

TRTSERVER_Error *TRTSERVER_MetricsFormatted(TRTSERVER_Metrics *metrics, TRTSERVER_Metric_Format format, const char **base, size_t *byte_size)

Get a buffer containing the metrics in the specified format.

For each format the buffer contains the following:

TRTSERVER_METRIC_PROMETHEUS: ‘base’ points to a single multiline string (char*) that gives a text representation of the metrics in prometheus format. ‘byte_size’ returns the length of the string in bytes.

The buffer is owned by the ‘metrics’ object and should not be modified or freed by the caller. The lifetime of the buffer extends only as long as ‘metrics’ and must not be accessed once ‘metrics’ is deleted.


a TRTSERVER_Error indicating success or failure.

  • metrics: The metrics object.

  • format: The format to use for the returned metrics.

  • base: Returns a pointer to the base of the formatted metrics, as described above.

  • byte_size: Returns the size, in bytes, of the formatted metrics.