summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorfumingwei <[email protected]>2023-03-01 10:36:59 +0800
committerfumingwei <[email protected]>2023-03-01 10:36:59 +0800
commitad590711cf82079ebe6009ce117611818ffbb964 (patch)
tree99df4c39b93a0c108ce6537712b4418dde99561e /inc
parent65d87a9d6eca81a80520246582c60b17d66ad59b (diff)
bugfix:修改结构体存放位置
Diffstat (limited to 'inc')
-rw-r--r--inc/fieldstat.h89
1 files changed, 11 insertions, 78 deletions
diff --git a/inc/fieldstat.h b/inc/fieldstat.h
index d8ba288..741f7a2 100644
--- a/inc/fieldstat.h
+++ b/inc/fieldstat.h
@@ -1,80 +1,11 @@
-#ifndef H_SCHEMA_STAT_H_INCLUDE
-#define H_SCHEMA_STAT_H_INCLUDE
+#pragma once
#include <stdio.h>
#include <time.h>
#include <pthread.h>
-#ifndef __cplusplus
-#error("This file should be compiled with C++ compiler")
-#endif
-
-
-#define URL_MAX_LEN 2048
-#define LEN_IP_MAX 32 //?????? 32 from document
-#define LEN_APP_NAME 32
-#define LEN_FORMAT_MAX 32
-#define LEN_PATH_MAX 256
-#define NUM_MAX_TABLE 64
-#define TABLE_COLUMN_SIZE 32
-#define UDP_PAYLOAD_SIZE 1460
-
-struct fieldstat_global_prometheus
-{
- unsigned short port;
- char *url_path;
-};
-
-struct fieldstat_instance
+#ifdef __cplusplus
+extern "C"
{
- //char *statsd_server_ip;
- char statsd_server_str_ip[LEN_IP_MAX];
- unsigned int statsd_server_ip;
- unsigned short statsd_server_port;
- int statsd_output_enable;
-
- char line_protocol_server_str_ip[LEN_IP_MAX];
- unsigned int line_protocol_server_ip;
- unsigned short line_protocol_server_port;
- int line_protocol_output_enable;
-
- char local_output_filename[LEN_PATH_MAX];
- char local_output_format[LEN_FORMAT_MAX];
- int local_output_enable;
-
- int background_thread_disable; //default:1
- int output_interval_s; //default:2
- char app_name[LEN_APP_NAME];
- int running;
-
- int metric_cnt;
- int metric_size;
- struct metric_t **metric;
- struct{
- struct metric_t **column;
- size_t column_size;
- } table_metrics[NUM_MAX_TABLE];
- int index_table[NUM_MAX_TABLE][1024];
- int per_table_metric_number[NUM_MAX_TABLE];
-
- int table_num;
- int line_seq;
-
- int prometheus_output_enable;
-
- int counter_cnt;
- int gauge_cnt;
- int histogram_cnt;
- int summary_cnt;
-
- struct timespec last_output_time;
-
- pthread_t cfg_mon_t;
- char line_protocol_send_buff[UDP_PAYLOAD_SIZE];
- size_t line_protocol_send_buff_offset;
- int line_protocol_socket;
-
- FILE* fp;
-};
-
+#endif
enum field_type
{
FIELD_TYPE_COUNTER,
@@ -83,10 +14,12 @@ enum field_type
FIELD_TYPE_SUMMARY
};
+struct fieldstat_global_prometheus;
+struct fieldstat_instance;
struct metric_id_list
{
- int num;
- int id[TABLE_COLUMN_SIZE];
+ int count;
+ int id[64];
};
/*
@@ -127,6 +60,6 @@ int fieldstat_value_decrby(struct fieldstat_instance *instance, int field_id, lo
void fieldstat_instance_start(struct fieldstat_instance *instance);
void fieldstat_passive_output(struct fieldstat_instance *instance);
-
-#endif
-
+#ifdef __cplusplus
+}
+#endif \ No newline at end of file