generated from honeycombio/.github
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix kvlist and byte arrays marshalling (#145)
## Which problem is this PR solving? This is step 1 of fixing a problem where some logs being sent to honeycomb contained some very large nested maps being sent as "Body" elements. Logs allow byte arrays to be sent, but we were just converting them to nil, so this adds byte array support and converts them with JSON marshal, which sends them as B64-encoded strings. OTel kvlist is a special type that OTel invented to allow a map to be indexed and traversed in-order. But the defined semantics are that of a map. Our previous marshalling had two problems: - It was sending the kvlist as a stringized array of objects, each of which had a single k-v pair. In other words, `[{"a":1},{"b":2}]` -- but this is unneeded, as it's guaranteed that keys are unique. So this PR converts that to a simple map: `{"a":1, "b":2}`. - A recursive routine was rendering each level of maps and arrays as strings, so unmarshalling nested objects would not result in an equivalent data structure. This PR creates a two-level recursion, where the first level converts objects to a "safe-for-honeycomb" data structure, and only then marshals the result with a single call to JSON marshal. A followup PR will limit the marshalling length to something Honeycomb will consume.
- Loading branch information
Showing
6 changed files
with
215 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters