aboutsummaryrefslogtreecommitdiff
path: root/pkg/api/api0
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-20 01:12:37 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-20 01:12:37 -0400
commit5cf2066fe691968320b6590060eb9c0bcb7637da (patch)
tree01120213e0c9e3494a0846a03a8b15ffaf171736 /pkg/api/api0
parent6777286ba15d5bd05d0fcd9921049761bf2f59c0 (diff)
downloadAtlas-5cf2066fe691968320b6590060eb9c0bcb7637da.tar.gz
Atlas-5cf2066fe691968320b6590060eb9c0bcb7637da.zip
pkg/api/api0: Add metric for stored pdata size
Diffstat (limited to 'pkg/api/api0')
-rw-r--r--pkg/api/api0/accounts.go4
-rw-r--r--pkg/api/api0/metrics.go2
2 files changed, 5 insertions, 1 deletions
diff --git a/pkg/api/api0/accounts.go b/pkg/api/api0/accounts.go
index c87530e..9859ee6 100644
--- a/pkg/api/api0/accounts.go
+++ b/pkg/api/api0/accounts.go
@@ -147,7 +147,7 @@ func (h *Handler) handleAccountsWritePersistence(w http.ResponseWriter, r *http.
}
}
- if _, err := h.PdataStorage.SetPdata(uid, buf); err != nil {
+ if n, err := h.PdataStorage.SetPdata(uid, buf); err != nil {
hlog.FromRequest(r).Error().
Err(err).
Uint64("uid", uid).
@@ -155,6 +155,8 @@ func (h *Handler) handleAccountsWritePersistence(w http.ResponseWriter, r *http.
h.m().accounts_writepersistence_requests_total.fail_storage_error_pdata.Inc()
respFail(w, r, http.StatusInternalServerError, ErrorCode_INTERNAL_SERVER_ERROR.MessageObj())
return
+ } else {
+ h.m().accounts_writepersistence_stored_size_bytes.Update(float64(n))
}
h.m().accounts_writepersistence_requests_total.success.Inc()
diff --git a/pkg/api/api0/metrics.go b/pkg/api/api0/metrics.go
index dd98000..d9fa16d 100644
--- a/pkg/api/api0/metrics.go
+++ b/pkg/api/api0/metrics.go
@@ -21,6 +21,7 @@ type apiMetrics struct {
reject_notns *metrics.Counter
}
accounts_writepersistence_extradata_size_bytes *metrics.Histogram // only includes successful updates
+ accounts_writepersistence_stored_size_bytes *metrics.Histogram
accounts_writepersistence_requests_total struct {
success *metrics.Counter
reject_too_much_extradata *metrics.Counter
@@ -178,6 +179,7 @@ func (h *Handler) m() *apiMetrics {
mo.versiongate_checks_total.reject_invalid = mo.set.NewCounter(`atlas_api0_versiongate_checks_total{result="reject_invalid"}`)
mo.versiongate_checks_total.reject_notns = mo.set.NewCounter(`atlas_api0_versiongate_checks_total{result="reject_notns"}`)
mo.accounts_writepersistence_extradata_size_bytes = mo.set.NewHistogram(`atlas_api0_accounts_writepersistence_extradata_size_bytes`)
+ mo.accounts_writepersistence_stored_size_bytes = mo.set.NewHistogram(`atlas_api0_accounts_writepersistence_stored_size_bytes`)
mo.accounts_writepersistence_requests_total.success = mo.set.NewCounter(`atlas_api0_accounts_writepersistence_requests_total{result="success"}`)
mo.accounts_writepersistence_requests_total.reject_too_much_extradata = mo.set.NewCounter(`atlas_api0_accounts_writepersistence_requests_total{result="reject_too_much_extradata"}`)
mo.accounts_writepersistence_requests_total.reject_too_large = mo.set.NewCounter(`atlas_api0_accounts_writepersistence_requests_total{result="reject_too_large"}`)