-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 697b4de
Showing
8 changed files
with
623 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.DS_Store | ||
github-project-exporter | ||
dist/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM quay.io/prometheus/busybox:latest | ||
|
||
COPY ./github-project-exporter /bin/github-project-exporter | ||
|
||
EXPOSE 9410 | ||
ENTRYPOINT ["/bin/github-project-exporter"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2017 Moto Ishizawa | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
NAME=github-project-exporter | ||
VERSION=0.1.0 | ||
COMMIT=$(shell git rev-parse --verify HEAD) | ||
|
||
PACKAGES=$(shell go list ./...) | ||
BUILD_FLAGS=-ldflags "-X main.VERSION=$(VERSION) -X main.COMMIT=$(COMMIT)" | ||
|
||
.PHONY: build test container clean | ||
|
||
build: vendor | ||
go build $(BUILD_FLAGS) . | ||
|
||
test: vendor | ||
go test -v $(PACKAGES) | ||
go vet $(PACKAGES) | ||
|
||
container: | ||
GOARCH=amd64 GOOS=linux go build $(BUILD_FLAGS) . | ||
docker build -t summerwind/$(NAME):latest -t summerwind/$(NAME):$(VERSION) . | ||
rm -rf $(NAME) | ||
|
||
clean: | ||
rm -rf $(NAME) | ||
rm -rf dist | ||
|
||
dist: | ||
mkdir -p dist | ||
|
||
GOARCH=amd64 GOOS=darwin go build $(BUILD_FLAGS) . | ||
tar -czf dist/$(NAME)_darwin_amd64.tar.gz $(NAME) | ||
rm -rf $(NAME) | ||
|
||
GOARCH=amd64 GOOS=linux go build $(BUILD_FLAGS) . | ||
tar -czf dist/$(NAME)_linux_amd64.tar.gz $(NAME) | ||
rm -rf $(NAME) | ||
|
||
GOARCH=arm64 GOOS=linux go build $(BUILD_FLAGS) . | ||
tar -czf dist/${NAME}_linux_arm64.tar.gz $(NAME) | ||
rm -rf $(NAME) | ||
|
||
GOARCH=arm GOOS=linux go build $(BUILD_FLAGS) . | ||
tar -czf dist/${NAME}_linux_arm.tar.gz $(NAME) | ||
rm -rf $(NAME) | ||
|
||
vendor: | ||
glide install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# github-project-exporter | ||
|
||
Export GitHub project status to Prometheus. | ||
|
||
## Install | ||
|
||
### Just want the binary? | ||
|
||
Go to the [releases page](https://github.com/summerwind/github-project-exporter/releases), find the version you want, and download the tarball file. | ||
|
||
### Run as container? | ||
|
||
``` | ||
$ docker pull summerwind/github-project-exporter:latest | ||
``` | ||
|
||
### Building binary yourself | ||
|
||
To build the binary you need to install [Go](https://golang.org/) and [Glide](https://github.com/Masterminds/glide). | ||
|
||
``` | ||
$ make | ||
``` | ||
|
||
## Usage | ||
|
||
You can specify the repository name with `--github.repository` flag to export the project metrics of the repository. An GitHub access token must be specified in `--github.token`. | ||
|
||
``` | ||
$ github-project-exporter --github.token ${ACCESS_TOKEN} --github.repository summerwind/github-project-exporter | ||
``` | ||
|
||
If you want to expose the project metrics of the organization, you can use `--github.organization` instead of `--github.repository`. | ||
|
||
``` | ||
$ github-project-exporter --github.token ${ACCESS_TOKEN} --github.organization summerwind | ||
``` | ||
|
||
Multiple flags can also be used. | ||
|
||
``` | ||
$ github-project-exporter --github.token ${ACCESS_TOKEN} --github.repository summerwind/github-project-exporter --github.repository summerwind/h2spec | ||
``` | ||
|
||
## Metrics | ||
|
||
This exporter will expose these metrics. | ||
|
||
| Metric | Meaning | Labels | | ||
| --- | --- | --- | | ||
| github_organization_projects | How many projects are in the organization. | organization | | ||
| github_organization_project_columns | How many columns are in the organization project. | organization, project | | ||
| github_organization_project_cards | How many cards are in the organization project. | organization, project, column | | ||
| github_repository_projects | How many projects are in the repository. | repository | | ||
| github_repository_project_columns | How many columns are in the repository project. | repository, project | | ||
| github_repository_project_cards | How many cards are in the repository project. | repository, project, column | |
Oops, something went wrong.