From 3cf2d49fb43523a4e9e68854de5dea1aba1bfffe Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 29 May 2020 10:54:53 -0400 Subject: [PATCH 1/2] Backport raft-storage.entry_size metric --- CHANGELOG.md | 2 ++ physical/raft/raft.go | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 967ff94a0a2..43d93bd435b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ IMPROVEMENTS: +* storage/raft: Introduce a new Raft metric, `vault.raft-storage.entry_size`, that allows for operators + to sample the entry size and view the average. * storage/raft: The storage stanza now accepts `leader_ca_cert_file`, `leader_client_cert_file`, and `leader_client_key_file` parameters to read and parse TLS certificate information from paths on disk. Existing non-path based parameters will continue to work, but their values will need to be provided as a diff --git a/physical/raft/raft.go b/physical/raft/raft.go index 217c82ac174..2ff177dfc4c 100644 --- a/physical/raft/raft.go +++ b/physical/raft/raft.go @@ -991,8 +991,11 @@ func (b *RaftBackend) applyLog(ctx context.Context, command *LogData) error { return err } + defer metrics.AddSample([]string{"raft-storage", "entry_size"}, float32(len(commandBytes))) + var chunked bool var applyFuture raft.ApplyFuture + switch { case len(commandBytes) <= raftchunking.ChunkSize: applyFuture = b.raft.Apply(commandBytes, 0) From 7ee0c6e09e92dfc5faebfa29c8212f2bac4f9443 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 29 May 2020 11:09:31 -0400 Subject: [PATCH 2/2] Undo cl --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43d93bd435b..967ff94a0a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,6 @@ IMPROVEMENTS: -* storage/raft: Introduce a new Raft metric, `vault.raft-storage.entry_size`, that allows for operators - to sample the entry size and view the average. * storage/raft: The storage stanza now accepts `leader_ca_cert_file`, `leader_client_cert_file`, and `leader_client_key_file` parameters to read and parse TLS certificate information from paths on disk. Existing non-path based parameters will continue to work, but their values will need to be provided as a