]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
write_open_telemetry plugin: Configure the flush callback to be called periodically.
authorFlorian Forster <octo@collectd.org>
Sat, 16 Dec 2023 19:59:39 +0000 (20:59 +0100)
committerFlorian Forster <octo@collectd.org>
Wed, 3 Jan 2024 16:16:28 +0000 (17:16 +0100)
src/write_open_telemetry.cc

index 916f2c66f8ec902b11fce0cf12ed4c90fbf4c6e0..a2bcbc2af472b6f929a74e4d57acc3d27cb2735d 100644 (file)
@@ -234,6 +234,11 @@ static int ot_config_node(oconfig_item_t *ci) {
       .free_func = ot_callback_decref,
   };
 
+  /* Call ot_flush periodically. */
+  plugin_ctx_t ctx = plugin_get_ctx();
+  ctx.flush_interval = plugin_get_interval();
+  plugin_set_ctx(ctx);
+
   cb->reference_count++;
   plugin_register_write(callback_name.ptr, ot_write, &user_data);