Skip to content

Commit

Permalink
Don't unescape logtypes when ingesting IR log events.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkrodrigues committed Sep 19, 2023
1 parent 40f02b0 commit a72d52f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/core/src/EncodedVariableInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ void EncodedVariableInterpreter::encode_and_add_to_dictionary(
encoded_vars.push_back(encoded_var);
};

ffi::ir_stream::generic_decode_message(
ffi::ir_stream::generic_decode_message<false>(
log_event.get_logtype(),
log_event.get_encoded_vars(),
log_event.get_dict_vars(),
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/ffi/ir_stream/decoding_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ generic_decode_next_message(ReaderInterface& reader, string& message, epoch_time
auto dict_var_handler = [&](string const& dict_var) { message.append(dict_var); };

try {
generic_decode_message(
generic_decode_message<true>(
logtype,
encoded_vars,
dict_vars,
Expand Down
3 changes: 3 additions & 0 deletions components/core/src/ffi/ir_stream/decoding_methods.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ auto deserialize_ir_message(
/**
* Decodes the IR message calls the given methods to handle each component of
* the message
* @tparam unescape_logtype Whether to remove the escape characters from the
* logtype before calling \p ConstantHandler
* @tparam encoded_variable_t Type of the encoded variable
* @tparam ConstantHandler Method to handle constants in the logtype.
* Signature: (const std::string&, size_t, size_t) -> void
Expand All @@ -93,6 +95,7 @@ auto deserialize_ir_message(
* @throw DecodingException if the message can not be decoded properly
*/
template <
bool unescape_logtype,
typename encoded_variable_t,
typename ConstantHandler,
typename EncodedIntHandler,
Expand Down
18 changes: 11 additions & 7 deletions components/core/src/ffi/ir_stream/decoding_methods.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace ffi::ir_stream {
template <
bool unescape_logtype,
typename encoded_variable_t,
typename ConstantHandler,
typename EncodedIntHandler,
Expand Down Expand Up @@ -109,14 +110,17 @@ void generic_decode_message(
cUnexpectedEscapeCharacterMessage
);
}
constant_handler(
logtype,
next_static_text_begin_pos,
cur_pos - next_static_text_begin_pos
);

// Skip the escape character
next_static_text_begin_pos = cur_pos + 1;
if constexpr (unescape_logtype) {
constant_handler(
logtype,
next_static_text_begin_pos,
cur_pos - next_static_text_begin_pos
);

// Skip the escape character
next_static_text_begin_pos = cur_pos + 1;
}
// The character after the escape character is static text
// (regardless of whether it is a variable placeholder), so
// increment cur_pos by 1 to ensure we don't process the
Expand Down

0 comments on commit a72d52f

Please sign in to comment.