Propose a metrics interface
Some checks failed
Tests / Clang total: 1533, failed: 2, passed: 1531
Tests / SIMD fallback total: 1533, failed: 2, passed: 1531
Tests / Release [gcc] total: 1533, failed: 2, passed: 1531
Tests / Release [gcc,aarch64] total: 1144, failed: 2, passed: 1142
Tests / Coverage total: 1151, passed: 1151
weaselab/conflict-set/pipeline/head There was a failure building this commit
Some checks failed
Tests / Clang total: 1533, failed: 2, passed: 1531
Tests / SIMD fallback total: 1533, failed: 2, passed: 1531
Tests / Release [gcc] total: 1533, failed: 2, passed: 1531
Tests / Release [gcc,aarch64] total: 1144, failed: 2, passed: 1142
Tests / Coverage total: 1151, passed: 1151
weaselab/conflict-set/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -88,6 +88,32 @@ struct __attribute__((__visibility__("default"))) ConflictSet {
|
||||
/** Returns the total bytes in use by this ConflictSet */
|
||||
int64_t getBytes() const;
|
||||
|
||||
/** Experimental! */
|
||||
struct MetricsV1 {
|
||||
/** A null-terminated string with static lifetime. Matches the regex
|
||||
* [a-zA-Z_:][a-zA-Z0-9_:]*
|
||||
*/
|
||||
const char *name;
|
||||
/** A null-terminated string with static lifetime. May contain any sequence
|
||||
* of UTF-8 characters (after the metric name), but the backslash and the
|
||||
* line feed characters have to be escaped as \\ and \n, respectively.
|
||||
*/
|
||||
const char *help;
|
||||
/** Counters are >= 0 and non-decreasing. Gauges are any value. */
|
||||
enum Type { Counter, Gauge } type;
|
||||
/** Thread-safety: do not read concurrently with a call to any non-const
|
||||
* method in the ConflictSet associated with this metric. */
|
||||
const double *value;
|
||||
};
|
||||
|
||||
/** Experimental! Store a pointer to an array of MetricsV1 (owned by the
|
||||
* ConflictSet) to `*metrics`, and its length to `*count`. This function makes
|
||||
* no guarantees about the contents of the metrics (e.g. names, help text, and
|
||||
* the meaning of values). A correct implementation is free to return nonsense
|
||||
* or nothing at all. Not intended to be inspected programmatically. Only
|
||||
* intended to be plumbed along to e.g. Prometheus. */
|
||||
void getMetricsV1(MetricsV1 **metrics, int *count) const;
|
||||
|
||||
#if __cplusplus > 199711L
|
||||
ConflictSet(ConflictSet &&) noexcept;
|
||||
ConflictSet &operator=(ConflictSet &&) noexcept;
|
||||
|
Reference in New Issue
Block a user