-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
separate otlpclient code from CLI code (#223)
The most important change in this PR is that the config global is now gone. Along the way a bunch of sites where the global was still accessed got fixed. In a few places, config is passed around more than snecessary but the PR had to stop somewhere. The code that relies on Cobra isn't as wound up with the OTLP client code now. It's also using relatively recent features in Cobra that allow for passing context.Context through to command functions, so now config can be plumbed without package globals. Since the cobra.Command declarations have moved to functions, they are no longer global, another win. There are no new features in this PR. No major changes to the tests except to fix 2 gaps that were hiding 2 bugs, that are now fixed. Squashed commitlog follows: * move OTLP client files to otlpclient directory * fix testing gap: test was underspecified It passed before this refactor because there were bugs in the traceparent file and localhost detection code. Fortunately localhost detection failed closed, so no harm done, mostly. Bug fixes will come in following commits. * move helpers code to more specific files * rework code so otlp client and cmd are separate all tests pass now, no new functionality A bunch of otelcli funcs were made public. The interface isn't meant to protect anyone from themselves. Also refactored Cobra code and setup funcs to pass ctx and config around instead of relying on globals so the worst are gone. Some files in otlpclient might make more sense in otelcli, but this is already more than enough refactoring for one PR. * update package names in tests * remove vestiges of otelcmd otelcmd was a bad idea in progress from another branch, somehow snuck through * cleanups * remove unused variable
- Loading branch information
Showing
32 changed files
with
1,052 additions
and
927 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.