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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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.
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>