diff --git a/plugins/processor_labels/labels.c b/plugins/processor_labels/labels.c index 62e5323fd43..ee34e639f25 100644 --- a/plugins/processor_labels/labels.c +++ b/plugins/processor_labels/labels.c @@ -1524,26 +1524,27 @@ static int insert_labels(struct cmt *metrics_context, pair->key); if (result == FLB_TRUE) { - result = metrics_context_insert_dynamic_label(metrics_context, - pair->key, - pair->val); + continue; + } - if (result == FLB_FALSE) { - return FLB_FALSE; - } + result = metrics_context_insert_dynamic_label(metrics_context, + pair->key, + pair->val); + + if (result == FLB_FALSE) { + return FLB_FALSE; } - else { - result = metrics_context_contains_static_label(metrics_context, - pair->key); - if (result == FLB_FALSE) { - result = metrics_context_insert_static_label(metrics_context, - pair->key, - pair->val); + result = metrics_context_contains_static_label(metrics_context, + pair->key); - if (result == FLB_FALSE) { - return FLB_FALSE; - } + if (result == FLB_TRUE) { + result = metrics_context_insert_static_label(metrics_context, + pair->key, + pair->val); + + if (result == FLB_FALSE) { + return FLB_FALSE; } } }