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

Set internal version for OpenTelemetry traces on initialization #114

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

RebeccaMahany
Copy link
Contributor

When I pulled in #110 to began using traces, I noticed that it was possible to have a data race when the first few spans created by a consuming application could be created at the same time. This PR fixes that issue and adds a test to confirm the fix as well.

)

func TestTraceInit(t *testing.T) {
t.Parallel()
Copy link
Contributor

Choose a reason for hiding this comment

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

Test looks good, though t.Parallel has no effect on this test. It is useful when used with t.Run().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

t.Parallel() can have an effect without t.Run() -- by default, all tests within a package run sequentially rather than in parallel, and the call to t.Parallel() here would change that behavior if/when any other test cases are added to this package.

It doesn't look like we're consistent with t.Parallel() in this repo -- some tests use it, others don't. I like it as a default, so I would be inclined to keep it here unless you feel strongly about it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ya, no worries, I agree. I meant to say that given there's only one test on this package, t.Parallel won't make a difference, but moving forward if we stick to using it then, yes.

Copy link
Contributor

@lucasmrod lucasmrod left a comment

Choose a reason for hiding this comment

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

LGTM, left a nitpick comment.

@RebeccaMahany RebeccaMahany merged commit 2e4891a into osquery:master Jul 7, 2023
@RebeccaMahany RebeccaMahany deleted the becca/trace-init branch July 7, 2023 15:48
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.

2 participants