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

feat(rum-core): limit the length of keyword/non-keyword fields #199

Closed

Conversation

vigneshshanmugam
Copy link
Member

@vigneshshanmugam vigneshshanmugam commented Mar 4, 2019

  • fixes Remove null and undefined values from apm-server payload #61

  • We now have the ability to truncate both keyword and non keywords fields to APM Server at a single place. This applies to Metadata, Transactions, Spans and Errors - Future: Metricsets as well

  • Inspired heavily from Node.js agent truncation module. Instead of truncating the string at creation time, We are now moving the truncation when the payload is sent to the server. This enables us to measure the performance of payload creation and filtering that gets applied.

  • All the undefined and null values are removed from the server payload to reduce the payload size. This is done using required field in truncation.

@vigneshshanmugam vigneshshanmugam changed the title Refactor validation feat(rum-core): limit the length of keyword/non-keyword fields Mar 4, 2019
@vigneshshanmugam vigneshshanmugam self-assigned this Mar 5, 2019
@vigneshshanmugam vigneshshanmugam requested a review from hmdhk March 5, 2019 10:54
Copy link
Contributor

@hmdhk hmdhk left a comment

Choose a reason for hiding this comment

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

@vigneshshanmugam , This one seems to have commits from another PR!

@vigneshshanmugam
Copy link
Member Author

@jahtalab Yes, This should be merged after merging the other PR. I have added the note in the description

@vigneshshanmugam
Copy link
Member Author

The test breaks because of the increase in bundle size due to changes in Task API as well the current PR. The increase in 0.35kb in the budget is fine since one is a feature and other is a consolidation of payload that gets sent to the APM server. I am going to increase the bundle size budget value by 0.5 kB to unblock.

We will improve the bundle size as part of #159

@vigneshshanmugam
Copy link
Member Author

@jahtalab Can you please review

@vigneshshanmugam
Copy link
Member Author

Waiting for prototype from Hamid on an alternative solution. Should be merged after agreeing on a decision.

Copy link
Contributor

@hmdhk hmdhk left a comment

Choose a reason for hiding this comment

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

@vigneshshanmugam , Since I might not have the time to make a prototype let's try to reach a conclusion here:

My main concern is that maintaining a switch-case is harder compared to having an object that specifies specification for each field. Furthermore with a spec object we can write a generic function that iterates over the required fields instead of spreading and potentially duplicating the logic across multiple functions, as it is done here with truncateSpan, truncateTransaction etc. Lastly, this approach has the advantage that we only iterate over a predefined and smaller spec object rather than iterating on an unknown object, i.e the payload fields which can have arbitrary fields (for example consider the error stack trace). In other words, the complexity of the function depends on the predefined (by us and known during development) number of fields rather than an unknown and potentially deeply nested object.

packages/rum-core/src/common/truncate.js Show resolved Hide resolved
packages/rum-core/src/common/truncate.js Show resolved Hide resolved
packages/rum-core/src/common/truncate.js Show resolved Hide resolved
@hmdhk hmdhk removed the blocked label Mar 20, 2019
@vigneshshanmugam
Copy link
Member Author

Notes:

  • We decided to go with Spec level instead of going over the . data payload to make the traversal time smaller
var fieldSpec = {
 'service': {
   'version': { required: false, limit:1024 }
 }
}
  • Non-Keyword fields can be removed from the spec for now.

@hmdhk
Copy link
Contributor

hmdhk commented Apr 25, 2019

Final Implementation have been merged with #241, closing this one.

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.

Remove null and undefined values from apm-server payload
3 participants