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

ddtrace/tracer: Add WithLogStartup startup option #860

Merged
merged 11 commits into from
Sep 2, 2021

Conversation

eriklarko
Copy link
Contributor

@eriklarko eriklarko commented Mar 3, 2021

This PR implements the proposal described in #861

@eriklarko eriklarko closed this Mar 3, 2021
@eriklarko eriklarko deleted the withlogstartup branch March 3, 2021 22:05
@eriklarko eriklarko changed the title Add WithLogStartup startup option ddtrace/tracer: Add WithLogStartup startup option Mar 4, 2021
@eriklarko eriklarko reopened this Mar 4, 2021
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. A few nits.

ddtrace/tracer/option.go Outdated Show resolved Hide resolved

func TestWithLogStartup(t *testing.T) {
var c config
defaultValue := c.logStartup
Copy link
Contributor

Choose a reason for hiding this comment

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

We already know that the zero-value of a boolean is false, so we can simplify this and just do:

c := newConfig()
assert.False(t, c.logStartup)
WithLogStartup()(&c)
assert.True(t, c.logStartup)

That should do for the whole test. I don't think there's a need for documentation either. It's pretty self-explanatory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. Inverting a value like that is a bit opaque, it's much easier to grasp the code if the values are more explicit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@gbbr gbbr modified the milestones: 1.29.0, 1.30.0 Mar 5, 2021
@@ -443,6 +443,13 @@ func WithHostname(name string) StartOption {
}
}

// WithLogStartup allows control over whether to print the startup log or not
func WithLogStartup(logStartup bool) StartOption {
Copy link
Contributor

Choose a reason for hiding this comment

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

Except maybe let's rename the argument to something else.

Suggested change
func WithLogStartup(logStartup bool) StartOption {
func WithLogStartup(yes bool) StartOption {

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm going with enabled to be consistent with our other boolean StartOptions.

@gbbr gbbr modified the milestones: 1.30.0, Triage Apr 22, 2021
@knusbaum knusbaum modified the milestones: Triage, 1.33.0 Aug 9, 2021
knusbaum
knusbaum previously approved these changes Aug 9, 2021
Copy link
Contributor

@knusbaum knusbaum left a comment

Choose a reason for hiding this comment

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

LGTM.
Needs approval from @gbbr since I added some commits.

@knusbaum knusbaum requested a review from gbbr August 9, 2021 22:53
@felixge felixge modified the milestones: 1.33.0, 1.34.0 Aug 19, 2021
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

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

This is fine, just a small change request to the docs please.

ddtrace/tracer/option.go Outdated Show resolved Hide resolved
Co-authored-by: Gabriel Aszalos <gabriel.aszalos@gmail.com>
@knusbaum knusbaum requested a review from gbbr August 31, 2021 19:53
@gbbr gbbr merged commit a8c99b5 into DataDog:v1 Sep 2, 2021
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.

4 participants