Skip to content

Conversation

tobert
Copy link
Collaborator

@tobert tobert commented Jun 20, 2023

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.

Amy Tobey added 5 commits June 16, 2023 14:27
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.
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.
Amy Tobey added 3 commits June 20, 2023 10:16
otelcmd was a bad idea in progress from another branch, somehow snuck
through
@tobert tobert merged commit f2ffe9c into main Jun 20, 2023
@tobert tobert deleted the keep-them-separated branch June 20, 2023 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant