Adds context embedding to pkg/count, and embeds the backup, restore, and export operation ctx with the operations count.bus. The bus is extracted from the ctx in api middleware to track throttling response counts, as well as token consumption counts. Counts are globally tracked, not on a per-time or per resource basis. --- #### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🌻 Feature #### Test Plan - [x] ⚡ Unit test - [x] 💚 E2E
21 lines
802 B
Go
21 lines
802 B
Go
package count
|
|
|
|
type key string
|
|
|
|
const (
|
|
// count of bucket-tokens consumed by api calls.
|
|
APICallTokensConsumed key = "api-call-tokens-consumed"
|
|
// count of times that items had collisions during restore,
|
|
// and that collision was solved by replacing the item.
|
|
CollisionReplace key = "collision-replace"
|
|
// count of times that items had collisions during restore,
|
|
// and that collision was solved by skipping the item.
|
|
CollisionSkip key = "collision-skip"
|
|
// NewItemCreated should be used for non-skip, non-replace,
|
|
// non-meta item creation counting. IE: use it specifically
|
|
// for counting new items (no collision) or copied items.
|
|
NewItemCreated key = "new-item-created"
|
|
// count of api calls that resulted in failure due to throttling.
|
|
ThrottledAPICalls key = "throttled-api-calls"
|
|
)
|