diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-02-08 16:54:37 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-02-10 10:38:09 +0300 |
commit | ce69d7c3155a29181fdde1713b3435ccdb2e7f8e (patch) | |
tree | 86b31d02a0a530c88e3b210736fdfd40e2a9a674 /internal/praefect/transactions | |
parent | ab983aac6c2d4e2dcfa0b543ac285118d235fd0d (diff) |
transactions: Rename transaction-related log fields
The log fields for transaction-related log messages are hard to identify
given that they're not grouped together. This makes it hard to see what
information is readily available regarding the transaction when
inspecting the logs e.g. via Elastic.
Improve this by using a common "transaction" prefix.
Diffstat (limited to 'internal/praefect/transactions')
-rw-r--r-- | internal/praefect/transactions/manager.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/praefect/transactions/manager.go b/internal/praefect/transactions/manager.go index 55f0f2cb4..1aa744f82 100644 --- a/internal/praefect/transactions/manager.go +++ b/internal/praefect/transactions/manager.go @@ -152,8 +152,8 @@ func (mgr *Manager) RegisterTransaction(ctx context.Context, voters []Voter, thr mgr.transactions[transactionID] = transaction mgr.log(ctx).WithFields(logrus.Fields{ - "transaction_id": transactionID, - "voters": voters, + "transaction.id": transactionID, + "transaction.voters": voters, }).Debug("RegisterTransaction") mgr.counterMetric.WithLabelValues("registered").Add(float64(len(voters))) @@ -185,9 +185,9 @@ func (mgr *Manager) cancelTransaction(ctx context.Context, transaction *Transact } mgr.log(ctx).WithFields(logrus.Fields{ - "transaction_id": transaction.ID(), - "committed": fmt.Sprintf("%d/%d", committed, len(state)), - "subtransactions": transaction.CountSubtransactions(), + "transaction.id": transaction.ID(), + "transaction.committed": fmt.Sprintf("%d/%d", committed, len(state)), + "transaction.subtransactions": transaction.CountSubtransactions(), }).Info("transaction completed") return nil @@ -219,9 +219,9 @@ func (mgr *Manager) VoteTransaction(ctx context.Context, transactionID uint64, n }() logger := mgr.log(ctx).WithFields(logrus.Fields{ - "transaction_id": transactionID, - "node": node, - "hash": hex.EncodeToString(hash), + "transaction.id": transactionID, + "transaction.voter": node, + "transaction.hash": hex.EncodeToString(hash), }) mgr.counterMetric.WithLabelValues("started").Inc() @@ -271,7 +271,7 @@ func (mgr *Manager) StopTransaction(ctx context.Context, transactionID uint64) e } mgr.log(ctx).WithFields(logrus.Fields{ - "transaction_id": transactionID, + "transaction.id": transactionID, }).Debug("VoteTransaction: transaction stopped") mgr.counterMetric.WithLabelValues("stopped").Inc() |