GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — events: allow monitoring error events by Flarna · Pull Request #30932 · nodejs/node

Conversation

@Flarna

@Flarna Flarna commented Dec 13, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Installing an error listener has a side effect that emitted errors are considered as handled. This is quite bad for monitoring/logging tools which tend to be interested in errors but don't want to cause side
effects like swallow an exception.

There are some workarounds in the wild like monkey patching emit or remit the error if monitoring tool detects that it is the only listener but this is error prone and risky.

This PR allows to install a listener to monitor errors with the side effect to consume the error. To avoid conflicts with other events it exports a symbol on EventEmitter which owns this special meaning.

Refs: open-telemetry/opentelemetry-js#225

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR, bricss, derhuerst, and kanongil reacted with thumbs up emoji
All reactions
  • 👍 4 reactions
@nodejs-github-bot nodejs-github-bot added the events Issues and PRs related to EventEmitter and the events module. label Dec 13, 2019
@Flarna
events: allow monitoring error events
0a773db
Installing an error listener has a side effect that emitted errors are
considered as handled. This is quite bad for monitoring/logging tools
which tend to be interested in errors but don't want to cause side
effects like swallow an exception.

There are some workarounds in the wild like monkey patching emit or
remit the error if monitoring tool detects that it is the only listener
but this is error prone and risky.

This PR allows to install a listener to monitor errors with the side
effect to consume the error. To avoid conflicts with other events it
exports a symbol on EventEmitter which owns this special meaning.

Refs: open-telemetry/opentelemetry-js#225
@Flarna
Flarna force-pushed the monitor-error-events branch from 6c53686 to 0a773db Compare December 13, 2019 10:53
addaleax
addaleax reviewed Dec 13, 2019
View reviewed changes
Comment thread lib/events.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

mscdex
mscdex reviewed Dec 13, 2019
View reviewed changes
Comment thread doc/api/events.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

mscdex
mscdex reviewed Dec 13, 2019
View reviewed changes
Comment thread doc/api/events.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

mscdex
mscdex reviewed Dec 13, 2019
View reviewed changes
Comment thread doc/api/events.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR
BridgeAR approved these changes Dec 13, 2019
View reviewed changes

@BridgeAR BridgeAR left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I very much like this addition.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread doc/api/events.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/parallel/test-event-emitter-error-monitor.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

Flarna added 2 commits December 13, 2019 16:58
@Flarna
rename symbol
d156268
@Flarna
fix review findings
793205c
lpinca
lpinca approved these changes Dec 13, 2019
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Dec 15, 2019

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/27714/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR BridgeAR added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Dec 15, 2019
@targos targos added the semver-minor PRs that contain new features and should be released in the next minor version. label Dec 16, 2019
Trott
Trott approved these changes Dec 18, 2019
View reviewed changes
@Trott

Trott commented Dec 18, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Non-blocking comment, but I wouldn't mind this (and most new features) going in initially as experimental status so we can roll it back or change it in the first few releases it shows up in.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Dec 18, 2019
View reviewed changes
@Flarna

Flarna commented Dec 18, 2019

Copy link
Copy Markdown
Member Author

I'm fine with adding an experimental statement similar the "Capture Rejections" recently added.
Is it just about adding > Stability: 1 - errorMonitor experimental. in events.md or is there more to do?
How does this effect back-porting to e.g. nodejs 12?

I'm not involved enough in the node project that I feel that well on deciding this. Would be nice if some others could give hints if we should move to experimental nor not.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasnell

jasnell commented Dec 18, 2019

Copy link
Copy Markdown
Member

I really disagree with the experimental bit. For larger and more complicated changes it makes sense but we really don't need every API or feature addition to be experimental. This one is a simple, straightforward semver-minor. I think that's enough.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

BridgeAR pushed a commit that referenced this pull request Dec 20, 2019
@Flarna @BridgeAR
events: allow monitoring error events
fcd4c2e
Installing an error listener has a side effect that emitted errors are
considered as handled. This is quite bad for monitoring/logging tools
which tend to be interested in errors but don't want to cause side
effects like swallow an exception.

There are some workarounds in the wild like monkey patching emit or
remit the error if monitoring tool detects that it is the only listener
but this is error prone and risky.

This PR allows to install a listener to monitor errors with the side
effect to consume the error. To avoid conflicts with other events it
exports a symbol on EventEmitter which owns this special meaning.

Refs: open-telemetry/opentelemetry-js#225

PR-URL: #30932
Refs: open-telemetry/opentelemetry-js#225
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@BridgeAR

BridgeAR commented Dec 20, 2019

Copy link
Copy Markdown
Member

Landed in fcd4c2e 🎉

I landed this since the comment was not blocking.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@BridgeAR BridgeAR closed this Dec 20, 2019
@Flarna
Flarna deleted the monitor-error-events branch December 20, 2019 06:51
BridgeAR pushed a commit that referenced this pull request Jan 3, 2020
@Flarna @BridgeAR
events: allow monitoring error events
f570de8
Installing an error listener has a side effect that emitted errors are
considered as handled. This is quite bad for monitoring/logging tools
which tend to be interested in errors but don't want to cause side
effects like swallow an exception.

There are some workarounds in the wild like monkey patching emit or
remit the error if monitoring tool detects that it is the only listener
but this is error prone and risky.

This PR allows to install a listener to monitor errors with the side
effect to consume the error. To avoid conflicts with other events it
exports a symbol on EventEmitter which owns this special meaning.

Refs: open-telemetry/opentelemetry-js#225

PR-URL: #30932
Refs: open-telemetry/opentelemetry-js#225
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Jan 7, 2020
v13.6.0 proposal #31238
Merged
BridgeAR added a commit that referenced this pull request Jan 7, 2020
@BridgeAR
2020-01-07, Version v13.6.0 (Current)
170ec8a
Notable changes:

* assert:
  * Implement `assert.match()` and `assert.doesNotMatch()` (Ruben
    Bridgewater) #30929
* events:
  * Add `EventEmitter.on` to async iterate over events (Matteo Collina)
    #27994
  * Allow monitoring error events (Gerhard Stoebich)
    #30932
* fs:
  * Allow overriding `fs` for streams (Robert Nagy)
    #29083
* perf_hooks:
  * Move `perf_hooks` out of experimental (legendecas)
    #31101
* repl:
  * Implement ZSH-like reverse-i-search (Ruben Bridgewater)
    #31006
* tls:
  * Add PSK (pre-shared key) support (Denys Otrishko)
    #23188

PR-URL: #31238
BridgeAR added a commit that referenced this pull request Jan 7, 2020
@BridgeAR
2020-01-07, Version v13.6.0 (Current)
1a552f6
Notable changes:

* assert:
  * Implement `assert.match()` and `assert.doesNotMatch()` (Ruben
    Bridgewater) #30929
* events:
  * Add `EventEmitter.on` to async iterate over events (Matteo Collina)
    #27994
  * Allow monitoring error events (Gerhard Stoebich)
    #30932
* fs:
  * Allow overriding `fs` for streams (Robert Nagy)
    #29083
* perf_hooks:
  * Move `perf_hooks` out of experimental (legendecas)
    #31101
* repl:
  * Implement ZSH-like reverse-i-search (Ruben Bridgewater)
    #31006
* tls:
  * Add PSK (pre-shared key) support (Denys Otrishko)
    #23188

PR-URL: #31238
BridgeAR added a commit that referenced this pull request Jan 7, 2020
@BridgeAR
2020-01-07, Version v13.6.0 (Current)
e908323
Notable changes:

* assert:
  * Implement `assert.match()` and `assert.doesNotMatch()` (Ruben
    Bridgewater) #30929
* events:
  * Add `EventEmitter.on` to async iterate over events (Matteo Collina)
    #27994
  * Allow monitoring error events (Gerhard Stoebich)
    #30932
* fs:
  * Allow overriding `fs` for streams (Robert Nagy)
    #29083
* perf_hooks:
  * Move `perf_hooks` out of experimental (legendecas)
    #31101
* repl:
  * Implement ZSH-like reverse-i-search (Ruben Bridgewater)
    #31006
* tls:
  * Add PSK (pre-shared key) support (Denys Otrishko)
    #23188

PR-URL: #31238
@Flarna Flarna mentioned this pull request Jan 8, 2020
process: allow monitoring uncaughtException #31257
Closed
4 tasks done
@Flarna Flarna mentioned this pull request Feb 28, 2020
[v12.x backport] events: allow monitoring error events #32004
Closed
4 tasks done
mmarchini pushed a commit that referenced this pull request Mar 2, 2020
@Flarna @mmarchini
events: convert errorMonitor to a normal property
ed8007a
Convert property errorMonitor to a normal property as non-writable
caused unwanted side effects.

Refs: #30932 (comment)

PR-URL: #31848
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
MylesBorins pushed a commit that referenced this pull request Mar 4, 2020
@Flarna @MylesBorins
events: convert errorMonitor to a normal property
3c8daa3
Convert property errorMonitor to a normal property as non-writable
caused unwanted side effects.

Refs: #30932 (comment)

PR-URL: #31848
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Flarna added a commit to dynatrace-oss-contrib/node that referenced this pull request Apr 6, 2020
@Flarna
events: allow monitoring error events
1c14d65
Installing an error listener has a side effect that emitted errors are
considered as handled. This is quite bad for monitoring/logging tools
which tend to be interested in errors but don't want to cause side
effects like swallow an exception.

There are some workarounds in the wild like monkey patching emit or
remit the error if monitoring tool detects that it is the only listener
but this is error prone and risky.

This PR allows to install a listener to monitor errors with the side
effect to consume the error. To avoid conflicts with other events it
exports a symbol on EventEmitter which owns this special meaning.

Refs: open-telemetry/opentelemetry-js#225

PR-URL: nodejs#30932
Refs: open-telemetry/opentelemetry-js#225
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Flarna added a commit to dynatrace-oss-contrib/node that referenced this pull request Apr 6, 2020
@Flarna
events: convert errorMonitor to a normal property
c483e6d
Convert property errorMonitor to a normal property as non-writable
caused unwanted side effects.

Refs: nodejs#30932 (comment)
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@Flarna @targos
process: allow monitoring uncaughtException
689a74c
Installing an uncaughtException listener has a side effect that process
is not aborted. This is quite bad for monitoring/logging tools which
tend to be interested in errors but don't want to cause side effects
like swallow an exception or change the output on console.

There are some workarounds in the wild like monkey patching emit or
rethrow in the exception if monitoring tool detects that it is the only
listener but this is error prone and risky.

This PR allows to install a listener to monitor uncaughtException
without the side effect to consider the exception has handled.

PR-URL: nodejs#31257
Refs: nodejs#30932
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@Flarna @targos
events: allow monitoring error events
c49889f
Installing an error listener has a side effect that emitted errors are
considered as handled. This is quite bad for monitoring/logging tools
which tend to be interested in errors but don't want to cause side
effects like swallow an exception.

There are some workarounds in the wild like monkey patching emit or
remit the error if monitoring tool detects that it is the only listener
but this is error prone and risky.

This PR allows to install a listener to monitor errors with the side
effect to consume the error. To avoid conflicts with other events it
exports a symbol on EventEmitter which owns this special meaning.

Refs: open-telemetry/opentelemetry-js#225

Backport-PR-URL: nodejs#32004
PR-URL: nodejs#30932
Refs: open-telemetry/opentelemetry-js#225
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Apr 25, 2020
@Flarna @targos
events: convert errorMonitor to a normal property
0d60fc2
Convert property errorMonitor to a normal property as non-writable
caused unwanted side effects.

Refs: nodejs#30932 (comment)

PR-URL: nodejs#31848
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@targos targos added backported-to-v12.x and removed author ready PRs with CI started, the required approvals, and no outstanding review comments. backport-requested-v12.x labels Apr 25, 2020
targos pushed a commit that referenced this pull request Apr 28, 2020
@Flarna @targos
process: allow monitoring uncaughtException
de3603f
Installing an uncaughtException listener has a side effect that process
is not aborted. This is quite bad for monitoring/logging tools which
tend to be interested in errors but don't want to cause side effects
like swallow an exception or change the output on console.

There are some workarounds in the wild like monkey patching emit or
rethrow in the exception if monitoring tool detects that it is the only
listener but this is error prone and risky.

This PR allows to install a listener to monitor uncaughtException
without the side effect to consider the exception has handled.

PR-URL: #31257
Refs: #30932
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
targos pushed a commit that referenced this pull request Apr 28, 2020
@Flarna @targos
events: allow monitoring error events
8c497f8
Installing an error listener has a side effect that emitted errors are
considered as handled. This is quite bad for monitoring/logging tools
which tend to be interested in errors but don't want to cause side
effects like swallow an exception.

There are some workarounds in the wild like monkey patching emit or
remit the error if monitoring tool detects that it is the only listener
but this is error prone and risky.

This PR allows to install a listener to monitor errors with the side
effect to consume the error. To avoid conflicts with other events it
exports a symbol on EventEmitter which owns this special meaning.

Refs: open-telemetry/opentelemetry-js#225

Backport-PR-URL: #32004
PR-URL: #30932
Refs: open-telemetry/opentelemetry-js#225
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit that referenced this pull request Apr 28, 2020
@Flarna @targos
events: convert errorMonitor to a normal property
3241aee
Convert property errorMonitor to a normal property as non-writable
caused unwanted side effects.

Refs: #30932 (comment)

PR-URL: #31848
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
@targos targos mentioned this pull request May 2, 2020
v12.17.0 release proposal #33197
Merged
Flarna added a commit to dynatrace-oss-contrib/node that referenced this pull request Aug 4, 2020
@Flarna
[async_hooks] improve property descriptors in als.bind
ccc0467
The length property should be non enumerable to match behavior of
normal functions.

The asyncResource property is enumerable and therefore it should be
also writable to avoid issues like there:
nodejs#30932 (comment)

Both properties should be configurable.

Refs: nodejs#34574
@Flarna Flarna mentioned this pull request Aug 4, 2020
async_hooks: improve property descriptors in als.bind #34620
Closed
Flarna added a commit that referenced this pull request Aug 4, 2020
@Flarna
async_hooks: improve property descriptors in als.bind
3ea94ec
The length property should be non enumerable to match behavior of
normal functions.

The asyncResource property is enumerable and therefore it should be
also writable to avoid issues like there:
#30932 (comment)

Both properties should be configurable.

Refs: #34574

PR-URL: #34620
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax pushed a commit that referenced this pull request Aug 8, 2020
@Flarna @addaleax
async_hooks: improve property descriptors in als.bind
0af9bee
The length property should be non enumerable to match behavior of
normal functions.

The asyncResource property is enumerable and therefore it should be
also writable to avoid issues like there:
#30932 (comment)

Both properties should be configurable.

Refs: #34574

PR-URL: #34620
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
codebytere pushed a commit that referenced this pull request Aug 11, 2020
@Flarna @codebytere
async_hooks: improve property descriptors in als.bind
0730c76
The length property should be non enumerable to match behavior of
normal functions.

The asyncResource property is enumerable and therefore it should be
also writable to avoid issues like there:
#30932 (comment)

Both properties should be configurable.

Refs: #34574

PR-URL: #34620
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax pushed a commit that referenced this pull request Sep 22, 2020
@Flarna @addaleax
async_hooks: improve property descriptors in als.bind
07968ac
The length property should be non enumerable to match behavior of
normal functions.

The asyncResource property is enumerable and therefore it should be
also writable to avoid issues like there:
#30932 (comment)

Both properties should be configurable.

Refs: #34574

PR-URL: #34620
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@Flarna Flarna mentioned this pull request Feb 4, 2021
Convert span to ReadableSpan before sending to span processor open-telemetry/opentelemetry-js#1902
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Jun 9, 2026
[New] add types tape-testing/tape#603
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ljharb ljharb ljharb left review comments
@addaleax addaleax addaleax left review comments
@jasnell jasnell jasnell approved these changes
@Trott Trott Trott approved these changes
@lpinca lpinca lpinca approved these changes
@BridgeAR BridgeAR BridgeAR approved these changes
+1 more reviewer
@mscdex mscdex mscdex left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

events Issues and PRs related to EventEmitter and the events module. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

12 participants

@Flarna @nodejs-github-bot @Trott @jasnell @BridgeAR @MylesBorins @kanongil @ljharb @mscdex @addaleax @lpinca @targos
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.