Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture Log Attributes in the Agent #900

Merged
merged 7 commits into from
May 1, 2024

Conversation

iamemilio
Copy link
Contributor

@iamemilio iamemilio commented Apr 12, 2024

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:

  • Additional Test Coverage for new JSON including attributes added
  • Manually Tested and Verified by sending logs with attributes attached to NR collector
  • Verify we can consolidate JSON generation with other attribute types with the collector team (the agent guards against adding user attributes that are of an illegal type, so this is not a blocker)

@iamemilio iamemilio changed the title Capture Logging Attributes in the Agent Capture Log Attributes in the Agent Apr 12, 2024
@iamemilio iamemilio marked this pull request as ready for review April 18, 2024 18:31
nr-swilloughby
nr-swilloughby previously approved these changes Apr 18, 2024
Copy link
Contributor

@nr-swilloughby nr-swilloughby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

v3/newrelic/log_event.go Outdated Show resolved Hide resolved
@nr-swilloughby nr-swilloughby merged commit b740dcb into newrelic:develop May 1, 2024
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants