Commit Graph

202 Commits

Author SHA1 Message Date
575b484ba0 fix(alerts): set severity of 'ectdMembersDown' from 'critical' to 'warning'
Downgraded severity of 'etcdMembersDown' from 'critical' to 'warning' as a single etcd member being not available should not be a problem for etcd's quorum. If the quorum would not be fulfilled, 'etcdInsufficientMembers' should fire. In addition the 'for' interval was extended from '10m' to '20m' as e.g. a node reboot with a big physical node takes usually longer than 10 minutes.

Signed-off-by: Sebastian Gaiser <sebastiangaiser@users.noreply.github.com>
2025-01-30 09:51:19 +00:00
10d7cea552 chore: enable early-return and superfluous-else from revive
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Co-authored-by: Iván Valdés Castillo <iv@nvald.es>
2025-01-18 09:44:58 +01:00
7f9efcfe52 fix: use testify instead of t.Fatal or t.Error in contrib package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-12-01 21:36:39 +00:00
3ef69d2681 fix: enable gofumpt instead of gofmt linter in contrib, etcdctl and etcdutl
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-11-09 00:37:14 +01:00
e5a63483ff fix: enable errorlint linter
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-10-31 18:54:59 +01:00
63dad79245 fix: use require.NoError instead of t.Fatal(err) in contrib and tools packages
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-10-18 13:06:48 +02:00
33d7f2d53e fix: enable gofmt and whitespace linters
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-10-11 07:03:18 +02:00
1b006577d2 Automate labels for contrib pull requests.
Signed-off-by: James Blair <mail@jamesblair.net>
2024-05-12 22:24:21 +12:00
bc31162cc2 all: call Close() after reading http.Response.Body
As the doc of http.Response.Body says:

// The http Client and Transport guarantee that Body is always
// non-nil, even on responses without a body or responses with
// a zero-length body. It is the caller's responsibility to
// close Body.

Signed-off-by: Jes Cok <xigua67damn@gmail.com>
2024-03-25 12:17:47 +08:00
c89ee6f120 contrib: add missing lock and mixin readme descriptions
Signed-off-by: redwrasse <mail@redwrasse.io>
2023-12-12 23:48:07 -08:00
46b42a750e Fix cluster query
Fix mixin cluster parameter otherwise generated mixins looks like this:

```json
{"type":"prometheus","uid":"${datasource}"},"label":"cluster","name":"job","query":"label_values(etcd_server_has_leader{job=~\".*etcd.*\"}, job)","refresh":2,"type":"query"}]},"time":{"from":"now-15m","to":"now"},"timezone": "`}}{{ .Values.grafana.defaultDashboardsTimezone }}{{`","title":"etcd","uid":"c2f4e12cdf69feb95caa41a5a1b423d9"}`}}
```

where name is job when the variable name used in dashboard queries is cluster.

Signed-off-by: QuentinBisson <quentin@giantswarm.io>
2023-10-16 22:42:31 +02:00
19a6baf236 Merge pull request #16246 from grafana/vzhuravlev/refactor_mixin_with_grafonnet
Refactor mixin with grafonnet
2023-10-04 10:33:35 +01:00
b70745d764 Update jsonnet dependency
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-10-04 06:53:27 +00:00
40ada2a857 Add memo in README
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-08-28 14:16:08 +00:00
c852ffe6e2 Add etcdselector to grafana7x dashboard and rest of alerts. https://github.com/etcd-io/etcd/pull/16245
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-08-28 14:07:03 +00:00
957b58e560 Set grafana7x to false by default
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-08-28 13:46:13 +00:00
aa21d536d6 Keep grafana7x dashboard. Enable with grafana7x=true in config
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-08-28 13:42:02 +00:00
68db7087e1 Handle ErrCompacted errors for Compact in raftexample
Signed-off-by: Chen Yang <809476530@qq.com>
Signed-off-by: chenyangyang.cy <chenyangyang.cy@alibaba-inc.com>
2023-08-18 20:05:05 +08:00
d327cacb2f Hold to v10.0.0 version
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-07-26 20:47:48 +00:00
e282e6c111 Fix typo in mixin Makefile
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-07-17 09:32:59 +00:00
f5644361d0 Refactor monitroing mixin's dashboard
Uses new grafonnet lib to declare dashboard. Generated dashboard has same layout, but now has timeseries panels instead of deprecated graphs

Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-07-15 00:16:51 +00:00
a3bd22beef Add etcd_selector to dashboard queries
Otherwise common metrics like 'process_resident_memory_bytes' can return non etcd metrics (when cluster label is 'cluster' for example)

Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-07-15 00:16:51 +00:00
f8d4b4ef91 Added lint config & alert summaries
Signed-off-by: Vitaly Zhuravlev <v-zhuravlev@users.noreply.github.com>
2023-07-15 00:16:51 +00:00
b798aae9c5 Update golangci-lint from 1.49.0 to 1.53.3
Signed-off-by: iuriatan <iuriatan@gmail.com>
2023-07-14 16:46:26 -03:00
8f887d3a79 ci: add fix-yamllint rule in Makefile
Two rules have been specified for yamlfmt here:
* Automatically add the header `---` to YAML files.
* Preserve line breaks.

ref:
https://github.com/google/yamlfmt/blob/main/docs/config-file.md#configuration-1

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
Co-authored-by: Marek Siarkowicz <siarkowicz@google.com>
2023-06-01 09:06:36 +08:00
b0b922cd71 ci: Introduce yamllint for actions workflow files
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2023-05-26 16:34:23 +08:00
0c919dc212 use the more efficient strings.Builder
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-05-19 10:44:58 +08:00
330f871ff9 contrib: fix raftexample README's raft library link.
Signed-off-by: tangwz <tangwz.com@gmail.com>
2023-03-31 20:02:49 +08:00
6b9c1462fd Merge pull request #15291 from ggustafsson/main
etcd-mixin: Limit etcdDatabaseHighFragmentationRatio to 100MB+
2023-03-22 17:12:33 +08:00
1002346ceb etcd-mixin: Limit etcdDatabaseHighFragmentationRatio to 100MB+
Signed-off-by: Göran Gustafsson <gustafsson.g@gmail.com>
2023-03-07 14:58:58 +01:00
b17b9c1428 chore: Use http constants to replace numbers as parameters
Signed-off-by: xin.li <xin.li@daocloud.io>
2023-02-20 11:53:41 +08:00
0775d36e53 raftexample: update etcdserver to use the new raft module go.etcd.io/raft/v3
Just replaced all go.etcd.io/etcd/raft/v3 with go.etcd.io/raft/v3
under directory contrib/raftexample.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-02 14:25:50 +08:00
2c9c209eb6 all: Changing Printf and friends to Print if there is no formatting
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 22:11:23 +03:00
855aa4f7a7 all: Use ReplaceAll instead of Replace with -1 pos
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 00:06:09 +03:00
0f9d7a4f95 raft: make Message.Snapshot nullable, halve struct size
This commit makes the rarely used `raftpb.Message.Snapshot` field nullable.
In doing so, it reduces the memory size of a `raftpb.Message` message from
264 bytes to 128 bytes — a 52% reduction in size.

While this commit does not change the protobuf encoding, it does change
how that encoding is used. `(gogoproto.nullable) = false` instruct the
generated proto marshaling logic to always encode a value for the field,
even if that value is empty. `(gogoproto.nullable) = true` instructs the
generated proto marshaling logic to omit an encoded value for the field
if the field is nil.

This raises compatibility concerns in both directions. Messages encoded
by new binary versions without a `Snapshot` field will be decoded as an
empty field by old binary versions. In other words, old binary versions
can't tell the difference. However, messages encoded by old binary versions
with an empty Snapshot field will be decoded as a non-nil, empty field by
new binary versions. As a result, new binary versions need to be prepared
to handle such messages.

While Message.Snapshot is not intentionally part of the external interface
of this library, it was possible for users of the library to access it and
manipulate it. As such, this change may be considered a breaking change.

Signed-off-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
2022-11-09 17:35:52 +00:00
f67ec10779 etcd: format import order
golang CodeReviewComments:
https://github.com/golang/go/wiki/CodeReviewComments#imports

Signed-off-by: demoManito <1430482733@qq.com>
2022-09-20 18:41:39 +08:00
f8b65d53ba Add revive to the list of linters.
Part of "Enhance the static-analysis workflow" issue. #14164

Signed-off-by: Cenk Alti <cenkalti@gmail.com>
2022-08-27 13:41:14 -04:00
a7a48168a0 Add golangci-lint config file and make target.
Here we add file `.golangci.yaml`, to have a common configuration for
static analysis. If you use the following IDEs/editors, they will read
the file:

- `vim` with vim-go.
- VSCode.

The initial configuration file is based on Kubernetes' HEAD. We removed
a custom kubernetes-linter for custom kubernetes-logging. We also
changed to Golang version 1.17 (etcd's current target Golang version)
from 1.18.

Also, we added a new target to `Makefile`: `lint`. NOTE that auto-fixing
should be part of a later commit, once we are all happy with how the
configuration file is working for us.

As expected, this change fixes two issues found by this `.golangci.yaml`
in file `contrib/lock/client/client.go`:

- Dead code, removed.
- Innefective assignment, removed.

Finally, we are updating `CONTRIBUTING.md` to mention `golangci-lint`.

We will add a GitHub-action to run `golangci-lint` in a future change.

Local testing done:

- `make build`.
- `make test`.

Both are happy.

This is the initial step to fix
https://github.com/etcd-io/etcd/issues/14164.

Signed-off-by: Ramsés Morales <ramses@gmail.com>
2022-07-28 17:55:08 -07:00
118ab24b39 update contrib/lock example
Updating the locking example to avoid relying on GC to break the lease.
Updating the documentation to reflect the build process better, improve
error messages and logging to not confuse first time users.

Fixes #14224

Signed-off-by: Thomas Jungblut <tjungblu@redhat.com>
2022-07-22 12:14:37 +02:00
75d7bd0155 etcd-mixin: fix etcdDatabaseQuotaLowSpace alert name
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
2022-07-20 06:11:13 +02:00
2ef4043979 Merge pull request #14237 from Elbehery/use-last_over_time
etcd-mixin: use-last_over_time-with-etcdBackendQuotaLowSpace-alert
2022-07-19 21:43:57 -04:00
0d0fc573ba etcd-mixin:use-last_over_time-with-etcdBackendQuotaLowSpace-alert
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
2022-07-19 18:10:19 +02:00
7de89e8db6 etcd-mixin:add etcdBackendHighFragmentationRatio alert
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
:wq
2022-07-19 18:03:08 +02:00
91f8eb1bd6 fix:etcd-mixin:use-predictLinear-insteadof-increase
Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
2022-07-08 16:16:54 +02:00
8ad87be7a6 fix the DATA RACE issue of TestCloseProposerInflight 2022-06-07 18:59:00 +08:00
534d7b4795 use go install instead of go get 2022-05-20 23:45:14 +08:00
fe35b5130e Fix code scanning alert: This log write receives unsanitized user input 2022-04-19 13:49:08 +02:00
3152dc8174 contrib/raftexample: Save snapshot and WAL before hard state
Update raftexample to save the snapshot file and WAL snapshot entry
before hardstate to ensure the snapshot exists during recovery.
Otherwise if there is a failure after storing the hard state there may
be reference to a non-existent snapshot.
This PR introduces the fix from #10219 to the raftexample.
2022-04-11 23:44:54 +00:00
5cf6ba48de added a unit test for the method processMessages 2022-03-08 09:38:23 +08:00
793218ed2b update the confstate before sending snapshot
When there is a `raftpb.EntryConfChange` after creating the snapshot,
then the confState included in the snapshot is out of date. so We need
to update the confState before sending a snapshot to a follower.
2022-03-07 12:18:29 +08:00