Skip to content

Commit

Permalink
Merge pull request #1432 from amousset/arch_25778/logger_v4_1_with_it…
Browse files Browse the repository at this point in the history
…erator_support

Fixes #25778: Logger v4.1 with iterator support
  • Loading branch information
amousset authored Nov 13, 2024
2 parents 9412f89 + a14a4cf commit 79cac95
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/acceptance/default_ncf.cf.sub
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ bundle agent apply_gm_v4(name, args, status, result_class, mode)
pass2::
"expected_classes" usebundle => define_expected_classes("${class_prefix}", "${status}", "class_prefix_${result_class}"),
comment => "${c_uuid}";
"expected_classes" usebundle => define_expected_classes("${c_uuid}_${d_uuid}", "${status}", "method_id_${result_class}"),
"expected_classes" usebundle => define_expected_classes("${c_uuid}_0", "${status}", "method_id_${result_class}"),
comment => "${c_uuid}";


Expand Down
2 changes: 2 additions & 0 deletions tree/10_ncf_internals/initialization.cf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ bundle agent initialization
vars:
# Reporting context for Rudder
"report_data.should_report" string => "true";
# Global counter
"report_data.index" int => "0";

files:
"${sys.workdir}/modules"
Expand Down
14 changes: 9 additions & 5 deletions tree/20_cfe_basics/log_rudder.cf
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ bundle agent log_rudder(message, class_parameter, old_class_prefix, class_prefix
bundle agent log_rudder_v4(parameter_value, message, details)
{
vars:
"component_key" string => "${report_data.component_key}";
"component_key" string => "${report_data.component_key}";
rudder_report_force_component_none::
"component_key" string => "None";

Expand All @@ -149,7 +149,9 @@ bundle agent log_rudder_v4(parameter_value, message, details)
"component_key" string => "${parameter_value}", if_match_regex => "";

methods:
"${report_data.method_id}_${component_key}" usebundle => _rudder_common_reports_generic("${report_data.technique_name}", "${report_data.report_id}", "${report_data.identifier}", "${report_data.component_name}", "${component_key}", "${message} ${details}");
"${report_data.method_id}" usebundle => _classes_copy("${report_data.method_id}", "${report_data.report_id}"),
if => "${report_data.should_report}";
"${report_data.method_id}" usebundle => _rudder_common_reports_generic("${report_data.technique_name}", "${report_data.method_id}", "${report_data.identifier}", "${report_data.component_name}", "${component_key}", "${message} ${details}");
}

# @name Log for Non Applicable call to generic method
Expand Down Expand Up @@ -518,8 +520,8 @@ bundle agent _method_reporting_context_v4(c_name, c_key, report_id)
"report_data.report_id_r" string => "${report_id}";
# Canonified version, to be used in policies (as class prefix)
# it needs the directive_id to enforce unicity
"report_data.report_id" string => canonify("${report_id}_${report_data.directive_id}");
"report_data.method_id" string => canonify("${report_id}_${report_data.directive_id}");
"report_data.report_id" string => canonify("${report_id}");
"report_data.method_id" string => canonify("${report_id}_${report_data.index}");
"report_data.identifier" string => "${report_data.rule_id}@@${report_data.directive_id}@@${report_data.report_id_r}";

methods:
Expand Down Expand Up @@ -552,7 +554,7 @@ bundle agent rudder_reporting_context_v4(d_id, r_id, t_name, c_name, c_key, repo
"report_data.report_id_r" string => "${report_id}";
# Canonified version, to be used in policies (as class prefix)
"report_data.report_id" string => canonify("${report_id}");
"report_data.method_id" string => canonify("${report_id}");
"report_data.method_id" string => canonify("${report_id}_${report_data.index}");
"report_data.identifier" string => "${report_data.rule_id}@@${report_data.directive_id}@@${report_data.report_id_r}";

methods:
Expand Down Expand Up @@ -581,6 +583,7 @@ bundle agent dump_reporting_context
report_id_r = ${report_data.report_id_r}
report_id = ${report_data.report_id}
method_id = ${report_data.method_id}
index = ${report_data.index}
}";
}

Expand All @@ -597,6 +600,7 @@ bundle agent clean_reporting_context
"report_data.report_id_r" string => "";
"report_data.report_id" string => "";
"report_data.method_id" string => "";
# We MUST NOT reset the index
}

bundle agent disable_reporting
Expand Down

0 comments on commit 79cac95

Please sign in to comment.