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

add optional pino logger and collection of internal stats #143

Merged
merged 2 commits into from
Mar 25, 2021

Conversation

trentm
Copy link
Member

@trentm trentm commented Mar 24, 2021

  1. This adds a logger option to the client, which expects a pino logger. If not given, a "no-op" logger will be used to stay silent. This logger is documented to be for trace and debug-level logging only, i.e. nothing about logging for the user of this apmclient or the apm agent using this lib.
  2. This collects some internal stats on elapsed times on the "_write*" functions where the sync delays are. Also a private _getStats() is added that can be used by dev/debugging scripts to dump info under load tests.

The matching APM agent PR is: elastic/apm-agent-nodejs#2015


This is pre-support for a coming PR to fix #136
I'm trying to separate out some changes to make that change more focused.

@trentm trentm self-assigned this Mar 24, 2021
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Mar 24, 2021
@apmmachine
Copy link

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #143 opened

  • Start Time: 2021-03-24T19:38:17.965+0000

  • Duration: 10 min 17 sec

  • Commit: 7ed1e9d

Test stats 🧪

Test Results
Failed 0
Passed 11815
Skipped 0
Total 11815

Trends 🧪

Image of Build Times

Image of Tests

@trentm trentm requested a review from astorm March 24, 2021 20:15
Copy link
Contributor

@astorm astorm left a comment

Choose a reason for hiding this comment

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

👍 approving

@@ -54,7 +54,8 @@ Server.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 to the README.md changes. I see we've clarified some documentation about the the options array, added documentation for the new logger format, and made explicit note of the face payloadLogFile has a (negative) impact on perf, and clarified the behavior of http.send w/r/t errors.

README.md Outdated
An integer indicating the number of events (spans, transactions, errors, or
metricsets) sent by the client. An event is considered sent when the HTTP
request used to transmit it has ended. Note that errors in requests to APM
server may main this value is not the same as the number of events *accepted*
Copy link
Contributor

Choose a reason for hiding this comment

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

may main this value should be may mean this value?

Copy link
Member Author

Choose a reason for hiding this comment

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

indeed. thanks

@@ -15,6 +15,7 @@ const streamToBuffer = require('fast-stream-to-buffer')
const StreamChopper = require('stream-chopper')
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 to the changes in this file. I see we're assigning our new logger or a NoopLogger, and have added some internal properties for tracking metrics related to the client with a _getStats helper function. The simpler approach makes sense to me for tracking agent perf at this point (vs. a formal metrics system like Measured, which can be heavy). I also see we've renamed the _received property to the more precise _numEventsEnqueued and renamed _writevCleaned to _writeBatch.

@trentm trentm merged commit 8177176 into master Mar 25, 2021
@trentm trentm deleted the trentm/pino-logger branch March 25, 2021 18:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blocking Behavior under Benchmarking Load
3 participants