dd-trace-js
dd-trace-js copied to clipboard
Integrate browser-bunyan
What does this PR do?
This pull requests integrates dd-trace with the logging library browser-bunyan, when it is running on the server-side in Node.js.
Motivation
As frameworks such as Next.js and Remix focus on isomorphic React, the logging library should be isomorphic. I've found browser-bunyan to fit the bill of something lightweight and very usable.
For example, if a web app is attempting to follow the twelve-factor methodology, then it only needs to write its event stream, unbuffered, to stdout, so a simpler the logging library is better.
Plugin Checklist
- [x] Unit tests.
- [x] TypeScript definitions.
- [x] TypeScript tests.
- [x] API documentation.
- [x] CircleCI jobs/workflows.
- [x] Plugin is exported.
Additional Notes
This updates all the upstream tests to remove package-lock.json from the upstream repos to better simulate installing as a library and to clear any non-public resolved URLs that were saved in the repo.
This library only supports Node and not the browser. If you need support for the browser that's handled by the browser SDK for RUM.
@rochdev Hi I understand that dd-trace only runs on node. I want to use the same logging library in both the browser and node because I'm using it in an isomorphic React framework. So this instruments the browser-bunyan library, when it's running on node.
Makes sense, I completely misunderstood what this does, sorry for the confusion.
The upstream tests clone the target library repo, but there's some weirdness around the package-lock.json file that is attempting to pull from localhost on some packages.
I could just drop the upstream tests?
Or maybe this could be resolved with a .npmrc and registry= setting?
Another option would be to skip using the lockfile entirely. This would actually also be closer to reality since installing a library as a dependency wouldn't use the library lockfile in the first place.
@rochdev good idea on removing package-lock.json from the upstream repos. It does affect multiple tests, so it's a separate commit. I don't think the node-elasticsearch-16 failure is related, so maybe you can force a rerun on that test to see if it is flaky?
I've re-based this code to integrate browser-bunyan as an light-weight logging framework. The tests run locally. It looks like something needs to happen to run the GitHub actions.
Codecov Report
Merging #1935 (79c2377) into master (ea81490) will decrease coverage by
0.02%. Report is 77 commits behind head on master. The diff coverage is0.00%.
@@ Coverage Diff @@
## master #1935 +/- ##
==========================================
- Coverage 84.71% 84.70% -0.02%
==========================================
Files 211 211
Lines 8256 8257 +1
Branches 33 33
==========================================
Hits 6994 6994
- Misses 1262 1263 +1
| Files Changed | Coverage Δ | |
|---|---|---|
| packages/dd-trace/src/plugins/index.js | 5.71% <0.00%> (-0.09%) |
:arrow_down: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more