You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 23, 2023. It is now read-only.
Copy file name to clipboardexpand all lines: docs/CONTRIBUTING.md
+18-9
Original file line number
Diff line number
Diff line change
@@ -4,36 +4,45 @@ Thanks for your interest in contributing to metrictank!
4
4
5
5
*[dep](https://github.com/golang/dep) for managing vendored dependencies
6
6
*`make` to build binaries and docker image.
7
-
*[metrics2docs](https://github.com/Dieterbe/metrics2docs) generates the metrics documentation for the [metrics page](https://github.com/grafana/metrictank/blob/master/docs/metrics.md) though it is a bit buggy and often manual intervention is needed.
7
+
*[metrics2docs](https://github.com/Dieterbe/metrics2docs) generates the metrics documentation for the [metrics page](https://github.com/grafana/metrictank/blob/master/docs/metrics.md) though it is buggy and manual intervention is needed, for now can just manually update the metrics page.
8
8
9
-
# Building
9
+
# Building, testing and QA
10
10
11
11
*`make bin`: for building all binaries.
12
12
*`make docker`: for building docker image (after building binaries)
13
13
*`make test`: unit tests
14
-
*`make qa`: run all QA (code quality) tests
14
+
*`make qa`: run all QA (code quality) tests, same as CirceCI qa checks except CI also runs stack tests.
15
15
16
16
see the [Makefile](../Makefile) for more targets
17
17
18
18
# When contributing PR's
19
19
20
20
1. functions, methods, types should be clearly understandable, either through an obvious name, or documentation when needed.
21
-
2. all documentation must conform to [golang best practices](https://blog.golang.org/godoc-documenting-go-code)
21
+
2. all code documentation must conform to [golang best practices](https://blog.golang.org/godoc-documenting-go-code)
22
22
3. add unit tests for tricky or non-trivial code. Not needed for obvious, simple or glue code. Use your best judgment or just ask us.
23
23
4. add benchmarks for performance sensitive functionality (e.g. code in the read and write path) or commonly executed code. (e.g. index inserts and searches)
24
+
([how to write benchmarks tutorial](https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go))
24
25
5. It's OK for your PR to not be based on the absolute latest master, but don't let the base of your branch get too out of date. (rule of thumb: no more than 40 commits or 2 weeks behind)
25
26
6. never merge master into your PR. As it mangles up git history and makes things harder to review. Instead, rebase your PR on top of master.
26
-
7. code must be well formatted. You can use `gofmt -w -s $(find . -name '*.go' | grep -v vendor | grep -v _gen.go)` to help with this.
27
+
7. code must be well formatted. (checked via `scripts/qa/gofmt.sh`, `make qa` and circleCI)
27
28
8. regarding configuration:
28
29
* config options and metrictank-sample.ini must be in sync. the latter must match the former.
29
30
* all other config files should also be in sync with metrictank-sample.ini except where the file should differ on purpose.
30
31
(example: `docker/docker-cluster/metrictank.ini` is the same as metrictank-sample.ini except for the options that support the use case of running metrictank in a cluster)
31
32
Use `scripts/dev/sync-configs.sh` which helps with the process of updating all configs based on metrictank-sample.ini.
32
-
Use `scripts/configs-to-doc.sh` to sync the sample configuration into the documentation.
33
-
9. PR's will only be merged if all tests pass
34
-
10. Any errors which can be recovered from sanely, must do so. And must trigger a high-level recovery metric (see other recovered_errors metrics) and an error message describing the problem.
33
+
Use `scripts/dev/config-to-doc.sh > docs/config.md` to sync the sample configuration into the documentation. (checked via `qa/docs.sh` , `make qa` and circleCI)
34
+
9. Any new tools must be properly documented. Use `scripts/dev/tools-to-doc.sh > docs/tools.md`. (checked via `qa/docs.sh` , `make qa` and circleCI)
35
+
10. PR's will only be merged if all tests pass
36
+
11. Any errors which can be recovered from sanely, must do so. And must trigger a high-level recovery metric (see other recovered_errors metrics) and an error message describing the problem.
35
37
In other words, panic is only legal in unrecoverable, unexpected situations.
36
-
11. When defining multiple functions or structures stick to this ordering:
38
+
12. When defining multiple functions or structures stick to this ordering:
37
39
* first the main structure, then other structures that it references (unless they belong in a different file or package of course)
38
40
* first the high-level function, then any other function that it calls (unless it belongs in a different file or package of course)
39
41
* first a structure, then its constructor, and then its methods
42
+
13. Documentation in the [docs](../docs) folder should be kept in sync with current state of affairs
0 commit comments