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

chore: Document emitted events #2561

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Conversation

jsumners-nr
Copy link
Contributor

While working on #2548 I needed to understand when some events are firing and learned that we do not have any documentation around events. Ideally, we'd have a document that outlines the common event sequences, but I don't have that picture right now. What this PR includes is jsdoc for almost every event the codebase generates. There is a whole class events in the Config namespace that I could not document. These events are emitting events named after configuration keys. There are two problems here:

  1. It's not clear what the event names will actually be. As an example, what would be fired if enabled from { feature_name: { enabled: true } } is changed to false? Would the event name be enabled, feature_name, or something like feature_name.enabled?
  2. There's no way to document dynamic event names with jsdoc. At least no way that I can think of that would really clarify anything.

Also, this PR changes the events around data sending. The current event names are like starting error_data data send.. This PR changes them to starting_data_send-error_data. We can't document event names with spaces, and other non-alphanum characters, in them. Indeed, it was a bit of a challenge to find a separator character to separate the prefix and actual event name that jsdoc would handle correctly.

So, while not everything is fully documented, I think the PR puts us in a better position than before.

@jsumners-nr jsumners-nr added the documentation Improvements or additions to documentation label Sep 11, 2024
Copy link

codecov bot commented Sep 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.22%. Comparing base (0b07be8) to head (e33cf26).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2561      +/-   ##
==========================================
+ Coverage   97.19%   97.22%   +0.03%     
==========================================
  Files         289      290       +1     
  Lines       45448    45882     +434     
==========================================
+ Hits        44172    44608     +436     
+ Misses       1276     1274       -2     
Flag Coverage Δ
integration-tests-cjs-18.x 74.07% <99.51%> (+0.25%) ⬆️
integration-tests-cjs-20.x 74.08% <99.51%> (+0.26%) ⬆️
integration-tests-cjs-22.x 74.12% <99.51%> (+0.26%) ⬆️
integration-tests-esm-18.x 49.71% <97.83%> (+0.52%) ⬆️
integration-tests-esm-20.x 49.71% <97.83%> (+0.52%) ⬆️
integration-tests-esm-22.x 49.74% <97.83%> (+0.52%) ⬆️
unit-tests-18.x 88.86% <99.75%> (+0.10%) ⬆️
unit-tests-20.x 88.86% <99.75%> (+0.10%) ⬆️
unit-tests-22.x 88.87% <99.75%> (+0.10%) ⬆️
versioned-tests-18.x 79.08% <97.83%> (+0.09%) ⬆️
versioned-tests-20.x 79.06% <97.83%> (+0.06%) ⬆️
versioned-tests-22.x 79.06% <97.83%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jsumners-nr jsumners-nr marked this pull request as ready for review September 11, 2024 13:24
Copy link
Member

@bizob2828 bizob2828 left a comment

Choose a reason for hiding this comment

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

LGTM

@jsumners-nr jsumners-nr merged commit 8ff0ef3 into newrelic:main Sep 11, 2024
29 checks passed
@jsumners-nr jsumners-nr deleted the doc-events branch September 11, 2024 13:33
sumitsuthar pushed a commit to k2io/fork-node-newrelic that referenced this pull request Sep 20, 2024
sumitsuthar added a commit to k2io/fork-node-newrelic that referenced this pull request Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Status: Done: Issues recently completed
Development

Successfully merging this pull request may close these issues.

2 participants