Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit c7fcb1d

Browse files
authored
Merge pull request #1035 from grafana/update-contributing
devdocs
2 parents 9359a93 + 708d41e commit c7fcb1d

File tree

3 files changed

+42
-18
lines changed

3 files changed

+42
-18
lines changed

devdocs/chaos-tools.md

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,49 @@
11
our chaos stack uses pumba and previously we've also used toxiproxy to trigger certain failures.
22

3-
# requirements
3+
This document merely describes our findings investigating several tools.
4+
5+
### requirements
46
* can kill, pause, network partition, network delays, etc
57
* has api
68
* udp support
79

8-
# nice to have
10+
### nice to have
911
* stateful
1012

11-
# options
13+
### options
14+
15+
#### toxiproxy
1216

13-
## toxiproxy
1417
+ Go
1518
+ stateful
1619
+ nice api/client lib
1720
- application level, needs app level changes: advertise addr, nslookup, config changes etc
1821
- NO udp
1922

20-
## https://github.com/worstcase/blockade
23+
#### blockade
24+
25+
https://github.com/worstcase/blockade
26+
2127
- no programmatic api?
2228
- python
2329

24-
## https://github.com/giantswarm/mizaru
30+
#### mizaru
31+
32+
https://github.com/giantswarm/mizaru
33+
2534
- no recent updates
2635

27-
## https://github.com/gaia-adm/pumba
36+
#### pumba
37+
38+
https://github.com/gaia-adm/pumba
39+
2840
+ Go
2941
+ recent updates/popular. looks solid code.
3042
+ can kill container
3143
- command based, not stateful. no api.
3244

33-
## https://github.com/tomakehurst/saboteur
45+
#### saboteur
46+
47+
https://github.com/tomakehurst/saboteur
48+
3449
- assumes control over iptables. probably doesn't work with docker?

expr/NOTES devdocs/expr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ there's 2 main choices:
2626
- often copying may be unnessary, but we can't know that in advance (unless we expand the expr tree to mark whether it'll do a write)
2727

2828

29-
for now we assume that multi-steps in a row is not that common, and COW seems more commonly the best approach
29+
for now we assume that multi-steps in a row is not that common, and COW seems more commonly the best approach, so we chose COW.
3030

3131

3232
This leaves the problem of effectively managing allocations and using a sync.Pool.

docs/CONTRIBUTING.md

+18-9
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,45 @@ Thanks for your interest in contributing to metrictank!
44

55
* [dep](https://github.com/golang/dep) for managing vendored dependencies
66
* `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.
88

9-
# Building
9+
# Building, testing and QA
1010

1111
* `make bin`: for building all binaries.
1212
* `make docker`: for building docker image (after building binaries)
1313
* `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.
1515

1616
see the [Makefile](../Makefile) for more targets
1717

1818
# When contributing PR's
1919

2020
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)
2222
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.
2323
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))
2425
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)
2526
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)
2728
8. regarding configuration:
2829
* config options and metrictank-sample.ini must be in sync. the latter must match the former.
2930
* all other config files should also be in sync with metrictank-sample.ini except where the file should differ on purpose.
3031
(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)
3132
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.
3537
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:
3739
* first the main structure, then other structures that it references (unless they belong in a different file or package of course)
3840
* first the high-level function, then any other function that it calls (unless it belongs in a different file or package of course)
3941
* 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
43+
44+
# Documentation
45+
46+
* [docs](../docs) for users and operators
47+
* [devdocs](../devdocs) for MT developers
48+

0 commit comments

Comments
 (0)