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

Burrow input plugin #3489

Merged
merged 4 commits into from
May 22, 2018

Conversation

arkady-emelyanov
Copy link
Contributor

Required for all PRs:

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

This is another implementation of Burrow input plugin, completely rewritten and fully tested version of #2485

Besides, it supports Basic HTTP auth and SSL.

Burrow is a monitoring companion for Apache Kafka that provides consumer lag and topic offset checking.

@arkady-emelyanov arkady-emelyanov changed the title Implement Burrow input plugin WIP: Implement Burrow input plugin Nov 23, 2017
@arkady-emelyanov arkady-emelyanov changed the title WIP: Implement Burrow input plugin Burrow input plugin Dec 2, 2017
@arkady-emelyanov
Copy link
Contributor Author

We are using this plugin (and custom build of telegraf) for about 5 days, and now plugin is feature complete and considered stable.
Could you please accept this plugin to mainline?

@arkady-emelyanov arkady-emelyanov mentioned this pull request Dec 4, 2017
3 tasks
@danielnelson
Copy link
Contributor

Thanks @arkady-emelyanov, we will make sure to consider this in our planning.

@fenneh
Copy link

fenneh commented Jan 2, 2018

Any ETA on a potential merge?

@arkady-emelyanov
Copy link
Contributor Author

Burrow stable release update. Minimal supported version - Burrow v1.0.0

Changes:

  • Supported API updated from v2 to v3
  • Measurements simplification

### Configuration

```
## Burrow endpoints in format "sheme://[user:password@]host:port"
Copy link

Choose a reason for hiding this comment

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

schema?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, typo. Fixed.

@arkady-emelyanov
Copy link
Contributor Author

PR has been rebased to resolve conflicts, but now, circle-ci fails with

/var/lib/gems/2.3.0/gems/ffi-1.9.21/ext/ffi_c/libffi/autogen.sh: 2: exec: autoreconf: not found

Which have no relations with plugin implementation, any thoughts?

@danielnelson
Copy link
Contributor

@arkady-emelyanov This is fixed now but you may need to rebase.

@arkady-emelyanov
Copy link
Contributor Author

@danielnelson now failure in statsd. Ok, i'll just wait for a few days and then do rebase again.

@arkady-emelyanov
Copy link
Contributor Author

@danielnelson still no ETA? :(

@danielnelson
Copy link
Contributor

Sorry about the delay, I'll schedule a review for 1.7

@danielnelson danielnelson added this to the 1.7.0 milestone Mar 23, 2018
Copy link
Contributor

@danielnelson danielnelson left a comment

Choose a reason for hiding this comment

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

@arkady-emelyanov I'm really impressed with how detailed you were with pr. However, I don't understand why we need to use channels for processing and returning values. From what I can see there are no long running requests so it would be much simpler to remove the channels. I think the only channel we need is for the connection semaphore.

## e.g.
## servers = ["http://localhost:8080"]
## servers = ["https://example.com:8000"]
## servers = ["http://user:pass@example.com:8000"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest we remove support for the userinfo section of the URL. My experience with it in other plugins is that the escaping passwords is tricky for users and causes confusion about where the credentials end up being passed. I realize that this allows per server credentials but it may be better to require multiple plugin instantiations for this unless we expect this to be very common.

How about only using the username and password fields below?

servers = [ "http://127.0.0.1:8000" ]

## Prefix all HTTP API requests.
#api_prefix = "/v3/kafka"
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 guessing this is so you can use the plugin with v2 or future versions? Can you add a list of versions that the plugin has been tested against.

#topics = ["topicA"]

## Concurrent connections limit (per server), default is 4.
#max_concurrent_connections = 10
Copy link
Contributor

Choose a reason for hiding this comment

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

Use default:

#max_concurrent_connections = 4

Or perhaps 10 is the actual default, in which case update the comment.

func (b *burrow) Gather(acc telegraf.Accumulator) error {
var workers sync.WaitGroup

errorChan := b.getErrorChannel(acc)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just pass in the Accumulator to avoid channels


errorChan := b.getErrorChannel(acc)
for _, addr := range b.Servers {
c, err := b.getClient(acc, addr, errorChan)
Copy link
Contributor

Choose a reason for hiding this comment

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

Make the clients once on first run, guarded so it only runs once.

}

// enable SSL configuration (if provided by configuration)
tlsCfg, err := internal.GetTLSConfig(b.SSLCert, b.SSLKey, b.SSLCA, b.InsecureSkipVerify)
Copy link
Contributor

Choose a reason for hiding this comment

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

Run once and share for all servers.

// construct client
c = apiClient{
client: http.Client{
Transport: &http.Transport{
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the same transport across plugin.

#debug = false

## Disable burrow_group measurement, default is false
#disable_groups = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this option related to the groups option above? If so what we usually do is add an include/exclude option pair like in the docker input, these support globs:

groups_include = []
groups_exclude = []

#worker_queue_length = 5

## Log requests and response codes, default is false
#debug = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this option, you can just log at debug level D!.

for _, cluster := range clusterList {
escaped := url.PathEscape(cluster)
producerChan <- apiCall{
URI: fmt.Sprintf("%s/%s/consumer", api.apiPrefix, escaped),
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest using the url package for creating urls.

@arkady-emelyanov arkady-emelyanov changed the title Burrow input plugin WIP: Burrow input plugin May 18, 2018
@arkady-emelyanov arkady-emelyanov force-pushed the burrow-input-plugins branch 2 times, most recently from ca5801d to 6061716 Compare May 20, 2018 14:36
@arkady-emelyanov arkady-emelyanov force-pushed the burrow-input-plugins branch 2 times, most recently from b12eaf2 to de39ff9 Compare May 20, 2018 14:54
@arkady-emelyanov arkady-emelyanov changed the title WIP: Burrow input plugin Burrow input plugin May 20, 2018
@arkady-emelyanov
Copy link
Contributor Author

@danielnelson sorry for delay.

Well, i made full rewrite of code, hope now, it feels in harmony with the rest of the plugins. Could you please take a look again?

var err error

// compile glob patterns
b.gClusters, err = makeGlobs(b.Clusters)
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use filter.Compile( for the globs, I believe it works in the same manner.


## Filter out clusters by providing list of glob patterns.
## Default is no filtering.
# clusters = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename to clusters_exclude so that in the future you can add cluster_include, or add them both now and you can use filters.NewIncludeExcludeFilter(. Also applies to groups and topics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, totally missed that filter package is already present and very useful. I did include/exclude separation and replaced glob with filter.

"group": "",
"topic": ""
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a newline at the end of these json files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* newlines for json
* use filter package
* include/exclude options for clusters, groups and topics
@danielnelson danielnelson merged commit fd22b1e into influxdata:master May 22, 2018
@danielnelson
Copy link
Contributor

Thanks @arkady-emelyanov, merged for 1.7!

@arkady-emelyanov
Copy link
Contributor Author

arkady-emelyanov commented May 22, 2018

@danielnelson indeed. my longest PR ever :)
Thanks!

@danielnelson
Copy link
Contributor

Yeah, sorry about that. Hoping to add another maintainer soon.

maxunt pushed a commit that referenced this pull request Jun 26, 2018
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
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.

None yet

4 participants