summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorchenzizhan <[email protected]>2023-06-27 14:39:21 +0800
committerchenzizhan <[email protected]>2023-06-27 14:39:21 +0800
commit090b6028eb16d606eaa8a576019a7d39e3b82f8f (patch)
tree9cde7c9a4e60ae4df9f385c250a9a0299bf0a7e5 /include
parent75f0ffdfbccd96cdb911fa6c67aae32cccec2c78 (diff)
test and debug for export
Diffstat (limited to 'include')
-rw-r--r--include/fieldstat/fieldstat_exporter.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/fieldstat/fieldstat_exporter.h b/include/fieldstat/fieldstat_exporter.h
index 57d6c6f..9d69269 100644
--- a/include/fieldstat/fieldstat_exporter.h
+++ b/include/fieldstat/fieldstat_exporter.h
@@ -1,5 +1,6 @@
#pragma once
#include <stdio.h>
+#include "fieldstat.h"
#ifdef __cplusplus
extern "C"
@@ -19,7 +20,7 @@ int fieldstat_global_enable_prometheus_endpoint(unsigned short listen_port, cons
* @param instance The fieldstat instance.
* @return -1 is failed. 0 is success.
*/
-int fieldstat_enable_prometheus_output(struct fieldstat_instance *instance);
+int fieldstat_enable_prometheus_output(struct fieldstat *instance);
/**
* Enable output metric to statsd server.
* The operation should be executed in single-threaded fashion.
@@ -28,7 +29,7 @@ int fieldstat_enable_prometheus_output(struct fieldstat_instance *instance);
* @param port Statsd server port. i.e., 80,8080
* @return -1 is failed. 0 is success.
*/
-int fieldstat_set_statsd_server(struct fieldstat_instance *instance, const char *ip, unsigned short port);
+int fieldstat_set_statsd_server(struct fieldstat *instance, const char *ip, unsigned short port);
/**
* Enable output metric to line protocol server.
* The operation should be executed in single-threaded fashion.
@@ -37,7 +38,7 @@ int fieldstat_set_statsd_server(struct fieldstat_instance *instance, const char
* @param port Line protocol server port. i.e., 80,8080
* @return -1 is failed. 0 is success.
*/
-int fieldstat_set_line_protocol_server(struct fieldstat_instance *instance, const char *ip, unsigned short port);
+int fieldstat_set_line_protocol_server(struct fieldstat *instance, const char *ip, unsigned short port);
/**
* Enable output metric to file.
* The operation should be executed in single-threaded fashion.
@@ -46,22 +47,27 @@ int fieldstat_set_line_protocol_server(struct fieldstat_instance *instance, cons
* @param format The output format. value in {"json","default"}
* @return -1 is failed. 0 is success.
*/
-int fieldstat_set_local_output(struct fieldstat_instance *instance, const char *filename, const char *format);
+int fieldstat_set_local_output(struct fieldstat *instance, const char *filename, const char *format);
/**
* Disable the background thread.
* The operation should be executed in single-threaded fashion.
* @param instance The fieldstat instance.
* @return -1 is failed. 0 is success.
*/
-int fieldstat_disable_background_thread(struct fieldstat_instance *instance);
+int fieldstat_disable_background_thread(struct fieldstat *instance);
/**
* Set the output interval in milliseconds
* The operation should be executed in single-threaded fashion.
* @param seconds In milliseconds.
* @return -1 is failed. 0 is success.
*/
-int fieldstat_set_output_interval(struct fieldstat_instance *instance, int milliseconds);
+int fieldstat_set_output_interval(struct fieldstat *instance, int milliseconds);
+/**
+ * Output the fieldstat instance to json string array arranging with tags.
+ * @param out The output json string array. Every element is a json string converted from cell. User should free the memory of every element and the array.
+ * @param n_out The output json string array size.
+ */
void fieldstat_export_to_json_arr(struct fieldstat *instance, char ***out, size_t *n_out);