Skip to content

Commit 0ba19ce

Browse files
cosmo0920edsiper
authored andcommitted
processor_labels: Process operations for output purposed contexts of metrics instead of the original one
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent 0bea914 commit 0ba19ce

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

plugins/processor_labels/labels.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,44 +1713,41 @@ static int cb_process_metrics(struct flb_processor_instance *processor_instance,
17131713
return FLB_PROCESSOR_FAILURE;
17141714
}
17151715

1716-
result = delete_labels(metrics_context,
1716+
result = cmt_cat(out_cmt, metrics_context);
1717+
if (result != 0) {
1718+
cmt_destroy(out_cmt);
1719+
1720+
return FLB_PROCESSOR_FAILURE;
1721+
}
1722+
1723+
result = delete_labels(out_cmt,
17171724
&processor_context->delete_labels);
17181725

17191726
if (result == FLB_PROCESSOR_SUCCESS) {
1720-
result = update_labels(metrics_context,
1727+
result = update_labels(out_cmt,
17211728
&processor_context->update_labels);
17221729
}
17231730

17241731
if (result == FLB_PROCESSOR_SUCCESS) {
1725-
result = upsert_labels(metrics_context,
1732+
result = upsert_labels(out_cmt,
17261733
&processor_context->upsert_labels);
17271734
}
17281735

17291736
if (result == FLB_PROCESSOR_SUCCESS) {
1730-
result = insert_labels(metrics_context,
1737+
result = insert_labels(out_cmt,
17311738
&processor_context->insert_labels);
17321739
}
17331740

17341741
if (result == FLB_PROCESSOR_SUCCESS) {
1735-
result = hash_labels(metrics_context,
1742+
result = hash_labels(out_cmt,
17361743
&processor_context->hash_labels);
17371744
}
17381745

1739-
if (result == FLB_PROCESSOR_SUCCESS) {
1740-
result = cmt_cat(out_cmt, metrics_context);
1741-
if (result != 0) {
1742-
cmt_destroy(out_cmt);
1743-
1744-
return FLB_PROCESSOR_FAILURE;
1745-
}
1746-
1747-
*out_context = out_cmt;
1748-
}
1749-
17501746
if (result != FLB_PROCESSOR_SUCCESS) {
17511747
return FLB_PROCESSOR_FAILURE;
17521748
}
17531749

1750+
*out_context = out_cmt;
17541751
return FLB_PROCESSOR_SUCCESS;
17551752
}
17561753

0 commit comments

Comments
 (0)