summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorchenzizhan <[email protected]>2024-07-15 13:46:14 +0800
committerchenzizhan <[email protected]>2024-07-15 13:46:14 +0800
commite97ea6cc29970f1c31a1a9bb23d2507c88e31b37 (patch)
treecc1b297d2e7cd8c0c378b8fb4f0ea2a3143f2900 /include
parent6b3dcefab5b4049a3f40be9faab6a05c79a8bb5b (diff)
flat
Diffstat (limited to 'include')
-rw-r--r--include/fieldstat/fieldstat_exporter.h44
1 files changed, 43 insertions, 1 deletions
diff --git a/include/fieldstat/fieldstat_exporter.h b/include/fieldstat/fieldstat_exporter.h
index 83e4c37..d314ba0 100644
--- a/include/fieldstat/fieldstat_exporter.h
+++ b/include/fieldstat/fieldstat_exporter.h
@@ -20,13 +20,55 @@ void fieldstat_json_exporter_free(struct fieldstat_json_exporter *exporter);
/*
Output the fieldstat instance to json string array. User must free the output string.
+ format:
+ [
+ {
+ "name":"exporter_name",
+ "tags":[
+ {"device ID":123},
+ {"CLIENT IP":"123.1.1.1"}
+ ],
+ "fields":[
+ {"in_bytes":1024},
+ {"in_pkts":123},
+ {"sessions":<hll blob base64-encoded string>}
+ ]
+ "timestamp_ms":123456789
+ }.
+ {
+ "name":"exporter_name",
+ "tags":[
+ {"device ID":123},
+ {"CLIENT IP":"1.2.3.4"}
+ ],
+ "fields":[
+ {"in_bytes":1},
+ {"in_pkts":2},
+ ]
+ "timestamp_ms":123456789
+ }
+ ]
*/
char *fieldstat_json_exporter_export(const struct fieldstat_json_exporter *exporter, const struct fieldstat *instance, const struct timeval *timestamp);
/*
- after call fieldstat_json_exporter_export_array, user must free the output array and each string.
+ after call fieldstat_json_exporter_export_array, user must free the output array and each string. output[0] =
+ "{"name":"exporter_name", "tags":[{"device ID":123}, {"CLIENT IP":"1.2.3.4"}],"fields":[{"in_bytes":1}, {"in_pkts":2},]"timestamp_ms":123456789}"
+ The same as every object in the array output by `fieldstat_json_exporter_export`.
*/
void fieldstat_json_exporter_export_array(const struct fieldstat_json_exporter *exporter, const struct fieldstat *instance, const struct timeval *timestamp, char ***output, size_t *output_size);
+/*
+the content is the same, but no nested format. flat format :
+{
+"name":"exporter_name",
+"device ID":123,
+"in_bytes":1,
+"timestamp_ms":123456789
+}
+do not support fieldstat_json_exporter_enable_delta.
+
+if a cell has no metric record, the cell will not be exported. (The same as fieldstat_json_exporter_export_array)
+*/
void fieldstat_json_exporter_export_flat(const struct fieldstat_json_exporter *exporter, const struct fieldstat *instance, const struct timeval *timestamp, char ***output, size_t *output_size);
/*
let json exporter output delta value by the side of the original value(accumulated). If a cell / metric is new, the delta value is the same as the original value.