|
25 | 25 | #include <fluent-bit/flb_bucket_queue.h>
|
26 | 26 | #include <fluent-bit/flb_event_loop.h>
|
27 | 27 | #include <fluent-bit/flb_time.h>
|
| 28 | +#include <fluent-bit/flb_lib.h> |
28 | 29 | #include <fluent-bit/flb_info.h>
|
29 | 30 | #include <fluent-bit/flb_bits.h>
|
30 | 31 |
|
@@ -241,6 +242,7 @@ static inline int handle_output_event(uint64_t ts,
|
241 | 242 | int retry_seconds;
|
242 | 243 | uint32_t type;
|
243 | 244 | uint32_t key;
|
| 245 | + double latency_seconds; |
244 | 246 | char *name;
|
245 | 247 | struct flb_task *task;
|
246 | 248 | struct flb_task_retry *retry;
|
@@ -305,6 +307,13 @@ static inline int handle_output_event(uint64_t ts,
|
305 | 307 | cmt_counter_add(ins->cmt_proc_bytes, ts, task->event_chunk->size,
|
306 | 308 | 1, (char *[]) {name});
|
307 | 309 |
|
| 310 | + /* latency histogram */ |
| 311 | + if (ins->cmt_latency) { |
| 312 | + latency_seconds = flb_time_now() - ((struct flb_input_chunk *) task->ic)->create_time; |
| 313 | + cmt_histogram_observe(ins->cmt_latency, ts, latency_seconds, 2, |
| 314 | + (char *[]) {(char *) flb_input_name(task->i_ins), name}); |
| 315 | + } |
| 316 | + |
308 | 317 | /* [OLD API] Update metrics */
|
309 | 318 | #ifdef FLB_HAVE_METRICS
|
310 | 319 | if (ins->metrics) {
|
@@ -984,7 +993,7 @@ int flb_engine_start(struct flb_config *config)
|
984 | 993 |
|
985 | 994 | config->grace_input = config->grace / 2;
|
986 | 995 | flb_info("[engine] Shutdown Grace Period=%d, Shutdown Input Grace Period=%d", config->grace, config->grace_input);
|
987 |
| - |
| 996 | + |
988 | 997 | while (1) {
|
989 | 998 | rb_flush_flag = FLB_FALSE;
|
990 | 999 |
|
@@ -1057,10 +1066,10 @@ int flb_engine_start(struct flb_config *config)
|
1057 | 1066 | if (ret > 0 && (config->grace_count < config->grace || config->grace == -1)) {
|
1058 | 1067 | if (config->grace_count == 1) {
|
1059 | 1068 | flb_task_running_print(config);
|
1060 |
| - /* |
| 1069 | + /* |
1061 | 1070 | * If storage.backlog.shutdown_flush is enabled, attempt to flush pending
|
1062 |
| - * filesystem chunks during shutdown. This is particularly useful in scenarios |
1063 |
| - * where Fluent Bit cannot restart to ensure buffered data is not lost. |
| 1071 | + * filesystem chunks during shutdown. This is particularly useful in scenarios |
| 1072 | + * where Fluent Bit cannot restart to ensure buffered data is not lost. |
1064 | 1073 | */
|
1065 | 1074 | if (config->storage_bl_flush_on_shutdown) {
|
1066 | 1075 | ret = sb_segregate_chunks(config);
|
|
0 commit comments