From 1bcbc3eea73d9426c7129303a007e0c0f23f6440 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Tue, 2 Apr 2019 16:27:45 -0700 Subject: [PATCH] Update docs and changelog for github input --- CHANGELOG.md | 4 +++ README.md | 1 + docs/LICENSE_OF_DEPENDENCIES.md | 2 ++ plugins/inputs/github/README.md | 50 +++++++++++++++++++-------------- plugins/inputs/github/github.go | 11 ++++---- 5 files changed, 41 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ca1f04a5..065680958 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## v1.11 [unreleased] +#### New Inputs + +- [github](/plugins/inputs/github/README.md) - Contributed by @influxdata + #### Features - [#5556](https://github.com/influxdata/telegraf/pull/5556): Add TTL field to ping input. diff --git a/README.md b/README.md index 8d08c6dfd..5d85ae5d6 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,7 @@ For documentation on the latest development code see the [documentation index][d * [filestat](./plugins/inputs/filestat) * [filecount](./plugins/inputs/filecount) * [fluentd](./plugins/inputs/fluentd) +* [github](./plugins/inputs/github) * [graylog](./plugins/inputs/graylog) * [haproxy](./plugins/inputs/haproxy) * [hddtemp](./plugins/inputs/hddtemp) diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index 485b758a4..5b6faf4c9 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -43,6 +43,8 @@ following works: - github.com/golang/protobuf [BSD 3-Clause "New" or "Revised" License](https://github.com/golang/protobuf/blob/master/LICENSE) - github.com/golang/snappy [BSD 3-Clause "New" or "Revised" License](https://github.com/golang/snappy/blob/master/LICENSE) - github.com/google/go-cmp [BSD 3-Clause "New" or "Revised" License](https://github.com/google/go-cmp/blob/master/LICENSE) +- github.com/google/go-github [BSD 3-Clause "New" or "Revised" License](https://github.com/google/go-github/blob/master/LICENSE) +- github.com/google/go-querystring [BSD 3-Clause "New" or "Revised" License](https://github.com/google/go-querystring/blob/master/LICENSE) - github.com/google/uuid [BSD 3-Clause "New" or "Revised" License](https://github.com/google/uuid/blob/master/LICENSE) - github.com/googleapis/gax-go [BSD 3-Clause "New" or "Revised" License](https://github.com/googleapis/gax-go/blob/master/LICENSE) - github.com/gorilla/context [BSD 3-Clause "New" or "Revised" License](https://github.com/gorilla/context/blob/master/LICENSE) diff --git a/plugins/inputs/github/README.md b/plugins/inputs/github/README.md index dc5a161cd..524d1d0e7 100644 --- a/plugins/inputs/github/README.md +++ b/plugins/inputs/github/README.md @@ -1,47 +1,55 @@ # GitHub Input Plugin -The [GitHub](https://www.github.com) input plugin gathers statistics from GitHub repositories. +Gather repository information from [GitHub][] hosted repositories. -### Configuration: +**Note:** Telegraf also contains the [webhook][] input which can be used as an +alternative method for collecting repository information. + +### Configuration ```toml [[inputs.github]] ## List of repositories to monitor - ## ex: repositories = ["influxdata/telegraf"] - # repositories = [] + repositories = ["influxdata/telegraf"] - ## Optional: Unauthenticated requests are limited to 60 per hour. + ## Github API access token. Unauthenticated requests are limited to 60 per hour. # access_token = "" - ## Optional: Default 5s. + ## Timeout for HTTP requests. # http_timeout = "5s" ``` -### Metrics: +### Metrics - github_repository - tags: - - `name` - The repository name - - `owner` - The owner of the repository - - `language` - The primary language of the repository - - `license` - The license set for the repository + - name - The repository name + - owner - The owner of the repository + - language - The primary language of the repository + - license - The license set for the repository - fields: - - `stars` (int) - - `forks` (int) - - `open_issues` (int) - - `size` (int) + - stars (int) + - forks (int) + - open_issues (int) + - size (int) -* github_rate_limit +When the [internal][] input is enabled: + ++ internal_github - tags: - - `access_token` - An obfusticated reference to the configured access token or "Unauthenticated" + - access_token - An obfusticated reference to the configured access token or "Unauthenticated" - fields: - - `limit` - How many requests you are limited to (per hour) - - `remaining` - How many requests you have remaining (per hour) - - `blocks` - How many requests have been blocked due to rate limit + - limit - How many requests you are limited to (per hour) + - remaining - How many requests you have remaining (per hour) + - blocks - How many requests have been blocked due to rate limit -### Example Output: +### Example Output ``` github,full_name=influxdata/telegraf,name=telegraf,owner=influxdata,language=Go,license=MIT\ License stars=6401i,forks=2421i,open_issues=722i,size=22611i 1552651811000000000 internal_github,access_token=Unauthenticated rate_limit_remaining=59i,rate_limit_limit=60i,rate_limit_blocks=0i 1552653551000000000 ``` + +[GitHub]: https://www.github.com +[internal]: /plugins/inputs/internal +[webhook]: /plugins/inputs/webhooks/github diff --git a/plugins/inputs/github/github.go b/plugins/inputs/github/github.go index cf709e69a..ff497e55b 100644 --- a/plugins/inputs/github/github.go +++ b/plugins/inputs/github/github.go @@ -31,14 +31,13 @@ type GitHub struct { } const sampleConfig = ` - ## List of repositories to monitor - ## ex: repositories = ["influxdata/telegraf"] - # repositories = [] + ## List of repositories to monitor. + repositories = ["influxdata/telegraf"] - ## Optional: Unauthenticated requests are limited to 60 per hour. + ## Github API access token. Unauthenticated requests are limited to 60 per hour. # access_token = "" - ## Optional: Default 5s. + ## Timeout for HTTP requests. # http_timeout = "5s" ` @@ -49,7 +48,7 @@ func (g *GitHub) SampleConfig() string { // Description returns the plugin description. func (g *GitHub) Description() string { - return "Read repository information from GitHub, including forks, stars, and more." + return "Gather repository information from GitHub hosted repositories." } // Create GitHub Client