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

feat: Adds new configuration options to add custom tags (labels) to logs #2743

Merged
merged 5 commits into from
Nov 18, 2024

Conversation

svetlanabrennan
Copy link
Contributor

@svetlanabrennan svetlanabrennan commented Nov 14, 2024

Description

  • Added feature to support adding labels (tags) to logs.
  • Added unit tests

How to Test

Run unit tests.

Related Issues

Closes #2716

TODO

  • Add supportability metrics

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 99.06542% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.21%. Comparing base (a7f14de) to head (a9d0fe3).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
lib/util/label-parser.js 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2743      +/-   ##
==========================================
- Coverage   97.25%   97.21%   -0.05%     
==========================================
  Files         294      294              
  Lines       46233    46310      +77     
==========================================
+ Hits        44965    45020      +55     
- Misses       1268     1290      +22     
Flag Coverage Δ
integration-tests-cjs-18.x 74.29% <78.50%> (-0.01%) ⬇️
integration-tests-cjs-20.x 74.29% <78.50%> (-0.01%) ⬇️
integration-tests-cjs-22.x 74.33% <78.50%> (-0.01%) ⬇️
integration-tests-esm-18.x 49.97% <43.92%> (+0.05%) ⬆️
integration-tests-esm-20.x 49.98% <43.92%> (+0.05%) ⬆️
integration-tests-esm-22.x 50.01% <43.92%> (+0.05%) ⬆️
unit-tests-18.x 88.98% <99.06%> (+0.01%) ⬆️
unit-tests-20.x 88.98% <99.06%> (+0.01%) ⬆️
unit-tests-22.x 88.99% <99.06%> (+0.01%) ⬆️
versioned-tests-18.x 79.01% <49.53%> (-0.16%) ⬇️
versioned-tests-20.x 79.02% <49.53%> (-0.16%) ⬇️
versioned-tests-22.x 79.02% <49.53%> (-0.16%) ⬇️

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.


🚨 Try these New Features:

lib/aggregators/log-aggregator.js Outdated Show resolved Hide resolved
lib/aggregators/log-aggregator.js Outdated Show resolved Hide resolved
jsumners-nr
jsumners-nr previously approved these changes Nov 18, 2024
Copy link
Contributor

@jsumners-nr jsumners-nr left a comment

Choose a reason for hiding this comment

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

I'm confused as to why we apply labels to all logs instead of providing a way for users to add labels to specific logs, but the implementation looks sound to me.

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.

approving but since I made updates on @svetlanabrennan's behalf, I'll wait for @jsumners-nr to approve as well

* Compares the labels list to the excluded label list and removes any labels that need to be excluded.
* Then prefixing each label with "tags."
*/
Config.prototype._filterLabels = function filterLabels() {
Copy link
Member

Choose a reason for hiding this comment

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

i'd add some tests in config unit tests that assert the labels are getting set accordingly. I know they are being tested in the log aggregator but it'll be hard to identified where this is getting covered in the future

@@ -24,6 +28,7 @@ class LogAggregator extends EventAggregator {

super(opts, agent)
this.agent = agent
createFeatureUsageMetrics(agent)
Copy link
Member

Choose a reason for hiding this comment

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

we were missing some supportability metrics per spec. This story was supposed to add the Supportability/Logging/Labels/Nodejs/<enabled|disabled>

lib/collector/facts.js Show resolved Hide resolved
@bizob2828 bizob2828 merged commit d20c874 into newrelic:main Nov 18, 2024
26 of 27 checks passed
@github-actions github-actions bot mentioned this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done: Issues recently completed
Development

Successfully merging this pull request may close these issues.

Attach labels (tags) to logs
3 participants