Bosun and scollector are open source projects. We appreciate your help.
Use GitHub pull requests to submit code. General submission guidelines:
- Use
gofmt -s -w
andgo vet bosun.org/...
. Seebuild/validate.sh
for the full list of validation checks that will be run by Travis CI on each commit. - If using new third party packages, install party (
go get github.com/mjibson/party
) and runparty
in the root directory ($GOPATH/src/bosun.org
) to vendor them and rewrite import paths. - Squash all non-
_third_party
commits into one._third_party
changes should be squashed down separately and precede any code changes which require them. This may be done as the final step before merging. - The commit message should indicate what folder is being changed (example:
cmd/scollector: new xyz collector
ordocs: fix typo in window function
) - Documentation changes should be made in the same branch as code changes using the
docs
folder. After the PR is approved is merged into the master branch it will show up on https://bosun.org (and is rendered using Github Pages).
Unless otherwise noted, the source files are distributed under the MIT license found in the LICENSE file.
We use the golang Go Code Review Comments document as the basis for our style. Take particular note of Error Strings, Mixed Caps, and Indent Error Flow sections. Also we don't have blank lines within functions.
- If changing HTML, JS, or other static content, install esc (
go get github.com/mjibson/esc
), then rungo generate
incmd/bosun
. - typescript is required if changing JS files. Invoke bosun with
-w
to watch for.ts
changes and automatically run typescript. We currently use typescript 2.3.1:npm i -g [email protected]
As vim will usually save file in a temporary buffer, then will rename the file.
So for the -w option to work, one could eventually at this in
.vimrc
, assuming GOPATH is the homedir:
let &backupskip .= ',' . escape(expand('$HOME'), '\') . '/src/bosun.org/cmd/bosun/*.go'
let &backupskip .= ',' . escape(expand('$HOME'), '\') . '/src/bosun.org/cmd/bosun/web/static/templates/*.html'
let &backupskip .= ',' . escape(expand('$HOME'), '\') . '/src/bosun.org/cmd/bosun/web/static/js/*.ts'
Or one could prefer the shorter version:
set backupskip+=*/cmd/bosun/{*.go\\,web/static/{js/*.ts\\,templates/*.html}}
- New scollector collectors must have units, types, and descriptions for all new metrics. Descriptions should not be in the
Add()
line, but in another data structure or constant. See keepalive collectors for the constants, and the memcached for good patterns.