Skip to content
This repository has been archived by the owner on Aug 4, 2023. It is now read-only.

Only build metadata payload NDJSON string once #35

Closed
watson opened this issue Nov 26, 2018 · 2 comments · Fixed by #99
Closed

Only build metadata payload NDJSON string once #35

watson opened this issue Nov 26, 2018 · 2 comments · Fixed by #99

Comments

@watson
Copy link
Contributor

watson commented Nov 26, 2018

Only stringify the metadata object once and reuse the generated string for all future metadata events being sent.

@alemagio
Copy link
Contributor

Hi, i would like to work on this.
Tell me if i understood the problem:

  • In the _encode function of the Client.prototype we serialize the entire output
  • what we want is to save the serialized metadata and reuse it instead of doing the serialization every time.
    Correct?

@Qard
Copy link
Contributor

Qard commented Oct 30, 2019

Yeah, what I would do is store the encoded version on the client and just change this line to write the already encoded content rather than redoing the encoding every time. You'll want to make sure the pre-encoded metadata is rebuilt any time the config changes though--the end of Client.prototype.config is probably a good place to generate and store the pre-encoded metadata header.

alemagio added a commit to alemagio/apm-nodejs-http-client that referenced this issue Nov 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants