newrelic / go-agent

New Relic Go Agent
Apache License 2.0
759 stars 297 forks source link

Capture Log Attributes in the Agent #900

Closed iamemilio closed 2 months ago

iamemilio commented 3 months ago

Adds support for collecting log attributes. This includes support for collecting complex objects like structs, slices, arrays, and maps. Passing a complex object will result in it getting marshaled into a JSON string using the standard library json.Marshal() function. This may increase the runtime complexity and allocation cost during harvest periods. If the object is marshaled into a string that exceeds 256 bytes, we will truncate it in the agent. This will result in an invalid JSON string getting sent to the collector, and it will not be parsed. We deemed collecting sub-optimal data to be better than dropping it in this case.

Verification Steps: