elixir_agent
elixir_agent copied to clipboard
Bad attribute on redis encoded string
Describe the bug
When calling SET <string key> <encoded value>
the agent reports this as a "Bad attribute". We're using a library that calls :erlang.binary_to_term
on the value before putting it into redis.
Environment
- Elixir & Erlang version (
elixir -v
): Erlang 24.0.6, Elixir 1.12.3 - Agent version (
mix deps | grep new_relic_agent
): 1.27.8
Example log message:
[DEBUG] - 2023-05-15 19:57:34 - Bad attribute value: :sql => <<83, 69, 84, 32, 101, 110, 116, 105, 116, 108, 101, 109, 101, 110, 116, 115, 58, 53, 50, 48, 54, 57, 51, 32, 131, 116, 0, 0, 0, 4, 109, 0, 0, 0, 7, 103, 101, 110, 101, 114, 105, 99, 116, 0, 0, 0, 1, 109, 0, 0, 0, 18, 112, 108, 97, 116, 102, 111, 114, 109, 95, 114, 101, 116, 101, 110, 116, 105, 111, 110, 116, 0, 0, 0, 0, 109, 0, 0, 0, 8, 105, 110, 115, 105, 103, 104, 116, 115, 116, 0, 0, 0, 0, 109, 0, 0, 0, 8, 110, 114, 49, 95, 100, 97, 116, 97, 116, 0, 0, 0, 1, 109, 0, 0, 0, 37, 110, 114, 49, 95, 100, 97, 116, 97, 95, 97, 100, 100, 105, 116, 105, 111, 110, 97, 108, 95, 100, 97, 121, 115, 95, 111, 102, 95, 114, 101, 116, 101, 110, 116, 105, 111, 110, 116, 0, 0, 0, 0, 109, 0, 0, 0, 10, 110, 114, 95, 113, 117, 101, 114, 105, 101, 115, 116, 0, 0, 0, 1, 109, 0, 0, 0, 38, 110, 114, 95, 113, 117, 101, 114, 105, 101, 115, 95, 105, 110, 115, 112, 101, 99, 116, 101, 100, 95, 99, 111, 117, 110, 116, 95, 105, 110, 95, 98, 105, 108, 108, 105, 111, 110, 115, 116, 0, 0, 0, 0>>
We can see part of this:
<<83, 69, 84, 32, 101, 110, 116, 105, 116, 108, 101, 109, 101, 110, 116, 115, 58, 53, 50, 48, 54, 57, 51, 32>>
Will return "SET entitlements:520693 "
. And then if we take the rest of the data, and call :erlang.binary_to_term
that returns a valid elixir map.
Our solution will probably be to turn log level back to INFO. But just thought this should be shared.
We're also experiencing this when we store binary values in a Redis string.