|
@@ -46,10 +46,12 @@ typedef enum exporting_options {
|
|
|
typedef enum exporting_connector_types {
|
|
|
EXPORTING_CONNECTOR_TYPE_UNKNOWN, // Invalid type
|
|
|
EXPORTING_CONNECTOR_TYPE_GRAPHITE, // Send plain text to Graphite
|
|
|
- EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_TELNET, // Send data to OpenTSDB using telnet API
|
|
|
- EXPORTING_CONNECTOR_TYPE_OPENTSDB_USING_HTTP, // Send data to OpenTSDB using HTTP API
|
|
|
- EXPORTING_CONNECTOR_TYPE_JSON, // Stores the data using JSON.
|
|
|
- EXPORTING_CONNECTOR_TYPE_PROMETHEUS_REMOTE_WRITE, // The user selected to use Prometheus backend
|
|
|
+ EXPORTING_CONNECTOR_TYPE_GRAPHITE_HTTP, // Send data to Graphite using HTTP API
|
|
|
+ EXPORTING_CONNECTOR_TYPE_JSON, // Send data in JSON format
|
|
|
+ EXPORTING_CONNECTOR_TYPE_JSON_HTTP, // Send data in JSON format using HTTP API
|
|
|
+ EXPORTING_CONNECTOR_TYPE_OPENTSDB, // Send data to OpenTSDB using telnet API
|
|
|
+ EXPORTING_CONNECTOR_TYPE_OPENTSDB_HTTP, // Send data to OpenTSDB using HTTP API
|
|
|
+ EXPORTING_CONNECTOR_TYPE_PROMETHEUS_REMOTE_WRITE, // User selected to use Prometheus backend
|
|
|
EXPORTING_CONNECTOR_TYPE_KINESIS, // Send message to AWS Kinesis
|
|
|
EXPORTING_CONNECTOR_TYPE_PUBSUB, // Send message to Google Cloud Pub/Sub
|
|
|
EXPORTING_CONNECTOR_TYPE_MONGODB, // Send data to MongoDB collection
|
|
@@ -81,6 +83,38 @@ struct simple_connector_config {
|
|
|
int default_port;
|
|
|
};
|
|
|
|
|
|
+struct simple_connector_buffer {
|
|
|
+ BUFFER *header;
|
|
|
+ BUFFER *buffer;
|
|
|
+
|
|
|
+ size_t buffered_metrics;
|
|
|
+ size_t buffered_bytes;
|
|
|
+
|
|
|
+ int used;
|
|
|
+
|
|
|
+ struct simple_connector_buffer *next;
|
|
|
+};
|
|
|
+
|
|
|
+struct simple_connector_data {
|
|
|
+ void *connector_specific_data;
|
|
|
+
|
|
|
+ size_t total_buffered_metrics;
|
|
|
+
|
|
|
+ BUFFER *header;
|
|
|
+ BUFFER *buffer;
|
|
|
+ size_t buffered_metrics;
|
|
|
+ size_t buffered_bytes;
|
|
|
+
|
|
|
+ struct simple_connector_buffer *previous_buffer;
|
|
|
+ struct simple_connector_buffer *first_buffer;
|
|
|
+ struct simple_connector_buffer *last_buffer;
|
|
|
+
|
|
|
+#ifdef ENABLE_HTTPS
|
|
|
+ SSL *conn; //SSL connection
|
|
|
+ int flags; //The flags for SSL connection
|
|
|
+#endif
|
|
|
+};
|
|
|
+
|
|
|
struct prometheus_remote_write_specific_config {
|
|
|
char *remote_write_path;
|
|
|
};
|
|
@@ -175,7 +209,7 @@ struct instance {
|
|
|
int (*end_host_formatting)(struct instance *instance, RRDHOST *host);
|
|
|
int (*end_batch_formatting)(struct instance *instance);
|
|
|
|
|
|
- int (*send_header)(int *sock, struct instance *instance);
|
|
|
+ void (*prepare_header)(struct instance *instance);
|
|
|
int (*check_response)(BUFFER *buffer, struct instance *instance);
|
|
|
|
|
|
void *connector_specific_data;
|
|
@@ -210,6 +244,7 @@ struct engine *read_exporting_config();
|
|
|
EXPORTING_CONNECTOR_TYPE exporting_select_type(const char *type);
|
|
|
|
|
|
int init_connectors(struct engine *engine);
|
|
|
+void simple_connector_init(struct instance *instance);
|
|
|
|
|
|
int mark_scheduled_instances(struct engine *engine);
|
|
|
void prepare_buffers(struct engine *engine);
|
|
@@ -232,11 +267,12 @@ void end_chart_formatting(struct engine *engine, RRDSET *st);
|
|
|
void end_host_formatting(struct engine *engine, RRDHOST *host);
|
|
|
void end_batch_formatting(struct engine *engine);
|
|
|
int flush_host_labels(struct instance *instance, RRDHOST *host);
|
|
|
-int simple_connector_update_buffered_bytes(struct instance *instance);
|
|
|
+int simple_connector_end_batch(struct instance *instance);
|
|
|
|
|
|
int exporting_discard_response(BUFFER *buffer, struct instance *instance);
|
|
|
void simple_connector_receive_response(int *sock, struct instance *instance);
|
|
|
-void simple_connector_send_buffer(int *sock, int *failures, struct instance *instance);
|
|
|
+void simple_connector_send_buffer(
|
|
|
+ int *sock, int *failures, struct instance *instance, BUFFER *header, BUFFER *buffer, size_t buffered_metrics);
|
|
|
void simple_connector_worker(void *instance_p);
|
|
|
|
|
|
void create_main_rusage_chart(RRDSET **st_rusage, RRDDIM **rd_user, RRDDIM **rd_system);
|
|
@@ -244,6 +280,7 @@ void send_main_rusage(RRDSET *st_rusage, RRDDIM *rd_user, RRDDIM *rd_system);
|
|
|
void send_internal_metrics(struct instance *instance);
|
|
|
|
|
|
extern void clean_instance(struct instance *ptr);
|
|
|
+void simple_connector_cleanup(struct instance *instance);
|
|
|
|
|
|
static inline void disable_instance(struct instance *instance)
|
|
|
{
|