| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_RRDLABELS_AGGREGATED_H |
| 4 | #define NETDATA_RRDLABELS_AGGREGATED_H |
| 5 | |
| 6 | #include "libnetdata/libnetdata.h" |
| 7 | #include "rrdlabels.h" |
| 8 | |
| 9 | // Aggregated labels structure for collecting unique keys and their values |
| 10 | // across multiple RRDLABELS instances |
| 11 | struct rrdlabels_aggregated; |
| 12 | typedef struct rrdlabels_aggregated RRDLABELS_AGGREGATED; |
| 13 | |
| 14 | // Create a new aggregated labels structure |
| 15 | RRDLABELS_AGGREGATED *rrdlabels_aggregated_create(void); |
| 16 | |
| 17 | // Destroy aggregated labels structure and free all memory |
| 18 | void rrdlabels_aggregated_destroy(RRDLABELS_AGGREGATED *agg); |
| 19 | |
| 20 | // Add all labels from an RRDLABELS instance to the aggregated structure |
| 21 | void rrdlabels_aggregated_add_from_rrdlabels(RRDLABELS_AGGREGATED *agg, RRDLABELS *labels); |
| 22 | |
| 23 | // Add a single label key-value pair to the aggregated structure |
| 24 | void rrdlabels_aggregated_add_label(RRDLABELS_AGGREGATED *agg, const char *key, const char *value); |
| 25 | |
| 26 | // Output aggregated labels as JSON object with keys and their value arrays |
| 27 | void rrdlabels_aggregated_to_buffer_json(RRDLABELS_AGGREGATED *agg, BUFFER *wb, const char *key, size_t cardinality_limit); |
| 28 | |
| 29 | // Merge all labels from source aggregated structure into destination |
| 30 | void rrdlabels_aggregated_merge(RRDLABELS_AGGREGATED *dst, RRDLABELS_AGGREGATED *src); |
| 31 | |
| 32 | #endif /* NETDATA_RRDLABELS_AGGREGATED_H */ |