engine: load storage metrics interface
@@ -411,11 +411,13 @@ int flb_engine_start(struct flb_config *config)
return -1;
}
- /* Start the Storage engine */
- ret = flb_storage_create(config);
- if (ret == -1) {
+ /* Create the event loop and set it in the global configuration */
+ evl = mk_event_loop_create(256);
+ if (!evl) {
return -1;
}
+ config->evl = evl;
+
flb_info("[engine] started (pid=%i)", getpid());
@@ -425,13 +427,6 @@ int flb_engine_start(struct flb_config *config)
flb_debug("[engine] coroutine stack size: %u bytes (%s)",
config->coro_stack_size, tmp);
- /* Create the event loop and set it in the global configuration */
- evl = mk_event_loop_create(256);
- if (!evl) {
- return -1;
- }
- config->evl = evl;
-
/*
* Create a communication channel: this routine creates a channel to
* signal the Engine event loop. It's useful to stop the event loop
@@ -446,6 +441,12 @@ int flb_engine_start(struct flb_config *config)
return -1;
}
+ /* Start the Storage engine */
+ ret = flb_storage_create(config);
+ if (ret == -1) {
+ return -1;
+ }
+
/* Initialize input plugins */
ret = flb_input_init_all(config);
if (ret == -1) {
@@ -491,6 +492,12 @@ int flb_engine_start(struct flb_config *config)
return -1;
}
+#ifdef FLB_HAVE_METRICS
+ if (config->storage_metrics == FLB_TRUE) {
+ config->storage_metrics_ctx = flb_storage_metrics_create(config);
+ }
+#endif
+
/* Initialize collectors */
flb_input_collectors_start(config);
@@ -647,7 +654,6 @@ int flb_engine_shutdown(struct flb_config *config)
flb_input_exit_all(config);
flb_output_exit(config);
-
/* Destroy the storage context */
flb_storage_destroy(config);
