|
42 | 42 |
|
43 | 43 | FLB_TLS_DEFINE(struct flb_out_flush_params, out_flush_params);
|
44 | 44 |
|
| 45 | +/* Histogram buckets for output latency in seconds */ |
| 46 | +static const double output_latency_buckets[] = { |
| 47 | + 0.5, 1.0, 1.5, 2.5, 5.0, 10.0, 20.0, 30.0 |
| 48 | +}; |
| 49 | + |
45 | 50 | struct flb_config_map output_global_properties[] = {
|
46 | 51 | {
|
47 | 52 | FLB_CONFIG_MAP_STR, "match", NULL,
|
@@ -1179,6 +1184,7 @@ int flb_output_init_all(struct flb_config *config)
|
1179 | 1184 | struct flb_output_instance *ins;
|
1180 | 1185 | struct flb_output_plugin *p;
|
1181 | 1186 | uint64_t ts;
|
| 1187 | + struct cmt_histogram_buckets *buckets; |
1182 | 1188 |
|
1183 | 1189 | /* Retrieve the plugin reference */
|
1184 | 1190 | mk_list_foreach_safe(head, tmp, &config->outputs) {
|
@@ -1320,6 +1326,22 @@ int flb_output_init_all(struct flb_config *config)
|
1320 | 1326 | 100.0,
|
1321 | 1327 | 1, (char *[]) {name});
|
1322 | 1328 |
|
| 1329 | + /* fluentbit_output_latency_seconds */ |
| 1330 | + buckets = cmt_histogram_buckets_create_size((double *) output_latency_buckets, |
| 1331 | + sizeof(output_latency_buckets) / sizeof(double)); |
| 1332 | + if (!buckets) { |
| 1333 | + flb_error("could not create latency histogram buckets for %s", name); |
| 1334 | + return -1; |
| 1335 | + } |
| 1336 | + |
| 1337 | + ins->cmt_latency = cmt_histogram_create(ins->cmt, |
| 1338 | + "fluentbit", |
| 1339 | + "output", |
| 1340 | + "latency_seconds", |
| 1341 | + "End-to-end latency in seconds", |
| 1342 | + buckets, |
| 1343 | + 2, (char *[]) {"input", "output"}); |
| 1344 | + |
1323 | 1345 | /* old API */
|
1324 | 1346 | ins->metrics = flb_metrics_create(name);
|
1325 | 1347 | if (ins->metrics) {
|
|
0 commit comments