elastic / elastic/apm-agent-nodejs

use process.emitWarning for user warnings

Open
#2,029 1 comment 0 reactions 0 assignees View on GitHub
agent-nodejs
Dominant language
JavaScript
Stars
594
Forks
244
Avg merge
1d 8h
Merged PRs (30d)
16

Description

As a follow-on to both https://github.com/elastic/apm-agent-nodejs/pull/2001 and the coming https://github.com/elastic/apm-nodejs-http-client/pull/144 let's consider changing the agent to use process.emitWarning when we want to give warnings to the user rather than logger.warn() or logger.error(). That will:
1. allow us to not spam to user if it is a repeated situation (e.g. if we are dropping events because of load on the APM server)
2. make the text more readable for the user (it won't be a JSON log record)
3. allow the user to handle/silence particular warnings if they want

A starter list of specific things we should be warning about:

- demote the log.error about APM server connection issues to a warning (the occasional APM server conn issue is not typically an error the user needs to deal with)
- add a warning if we are dropping a significant number of events because of load to the APM server (this from the `maxQueueSize` config coming after https://github.com/elastic/apm-nodejs-http-client/pull/144

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.