-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Conversation
|
||
resp, err := c.httpClient.Do(req.WithContext(ctx)) | ||
if err != nil { | ||
<-c.semaphore |
There was a problem hiding this comment.
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
plugins/inputs/dcos/client.go
Outdated
return c.token.text | ||
} | ||
|
||
func (c *client) EnsureAuth(ctx context.Context) error { |
There was a problem hiding this comment.
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.
plugins/inputs/dcos/client.go
Outdated
} | ||
|
||
func (c *client) GetContainers(ctx context.Context, node string) ([]string, error) { | ||
containers := []string{} |
There was a problem hiding this comment.
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
plugins/inputs/dcos/client.go
Outdated
Title string | ||
Description string | ||
} | ||
type Login struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline here
plugins/inputs/dcos/client.go
Outdated
GetAppMetrics(ctx context.Context, node, container string) (*Metrics, error) | ||
} | ||
|
||
type Credentials struct { |
There was a problem hiding this comment.
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
plugins/inputs/dcos/client.go
Outdated
ExpiresAt: 0, | ||
}, | ||
}) | ||
ss, err := token.SignedString(c.credentials.PrivateKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just return here.
plugins/inputs/dcos/dcos.go
Outdated
|
||
func (d *DCOS) Gather(acc telegraf.Accumulator) error { | ||
if !d.initialized { | ||
err := d.createFilters() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put initialized in createFilters
plugins/inputs/dcos/dcos.go
Outdated
} | ||
} | ||
|
||
results := []*point{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preallocate the slice.
plugins/inputs/dcos/dcos.go
Outdated
fieldKey = fieldKey + "_bytes" | ||
} | ||
|
||
tagset := []string{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
preallocate here.
plugins/inputs/dcos/dcos.go
Outdated
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_") |
There was a problem hiding this comment.
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.
plugins/inputs/dcos/client.go
Outdated
return err | ||
} | ||
func (c *client) url(path string) string { | ||
c.clusterURL.Path = path |
There was a problem hiding this comment.
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.
I think everything is addressed except the struct comments. |
Required for all PRs: