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

Add input plugin for DC/OS #3519

Merged
merged 15 commits into from
Nov 29, 2017
Merged

Add input plugin for DC/OS #3519

merged 15 commits into from
Nov 29, 2017

Conversation

danielnelson
Copy link
Contributor

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@danielnelson danielnelson added this to the 1.5.0 milestone Nov 28, 2017
@danielnelson danielnelson mentioned this pull request Nov 28, 2017
3 tasks

resp, err := c.httpClient.Do(req.WithContext(ctx))
if err != nil {
<-c.semaphore
Copy link
Contributor

Choose a reason for hiding this comment

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

Possibly add this to the defer above

return c.token.text
}

func (c *client) EnsureAuth(ctx context.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably move ensureauth to a higher level and expose the login function publicly.

}

func (c *client) GetContainers(ctx context.Context, node string) ([]string, error) {
containers := []string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Make a type Containers []string

Title string
Description string
}
type Login struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

newline here

GetAppMetrics(ctx context.Context, node, container string) (*Metrics, error)
}

type Credentials struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to have comments on structs

ExpiresAt: 0,
},
})
ss, err := token.SignedString(c.credentials.PrivateKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just return here.


func (d *DCOS) Gather(acc telegraf.Accumulator) error {
if !d.initialized {
err := d.createFilters()
Copy link
Contributor

Choose a reason for hiding this comment

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

put initialized in createFilters

}
}

results := []*point{}
Copy link
Contributor

Choose a reason for hiding this comment

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

preallocate the slice.

fieldKey = fieldKey + "_bytes"
}

tagset := []string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

preallocate here.

fields := make(map[string]interface{})
for k, v := range p.fields {
if strings.HasPrefix(k, "dcos_metrics_module_") {
k = strings.TrimPrefix(k, "dcos_metrics_module_")
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably move this trim up above.

return err
}
func (c *client) url(path string) string {
c.clusterURL.Path = path
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to copy clusterURL before setting path.

@danielnelson
Copy link
Contributor Author

I think everything is addressed except the struct comments.

@danielnelson danielnelson merged commit 414a7e3 into master Nov 29, 2017
@danielnelson danielnelson deleted the dcos-input branch November 29, 2017 19:50
aromeyer pushed a commit to aromeyer/telegraf that referenced this pull request May 19, 2018
maxunt pushed a commit that referenced this pull request Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants