Compare commits
3 Commits
main
...
graph_metr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15e396ca92 | ||
|
|
f884f0809f | ||
|
|
9aad0aa428 |
@ -214,6 +214,8 @@ func genericCreateCommand(
|
||||
continue
|
||||
}
|
||||
|
||||
logger.Ctx(ictx).Infow("graph api stats", "stats", bo.Results.APIStats)
|
||||
|
||||
bIDs = append(bIDs, string(bo.Results.BackupID))
|
||||
|
||||
if !DisplayJSONFormat() {
|
||||
|
||||
@ -70,6 +70,7 @@ type BackupResults struct {
|
||||
BackupID model.StableID `json:"backupID"`
|
||||
// keys are found in /pkg/count/keys.go
|
||||
Counts map[string]int64 `json:"counts"`
|
||||
stats.APIStats
|
||||
}
|
||||
|
||||
// NewBackupOperation constructs and validates a backup operation.
|
||||
@ -846,6 +847,10 @@ func (op *BackupOperation) persistResults(
|
||||
|
||||
op.Results.ItemsRead = opStats.ctrl.Successes
|
||||
|
||||
// API stats
|
||||
apiStats := getAPIStats(op.Counter)
|
||||
op.Results.APITokensConsumed = apiStats.APITokensConsumed
|
||||
|
||||
// Only return non-recoverable errors at this point.
|
||||
return op.Errors.Failure()
|
||||
}
|
||||
|
||||
@ -6,9 +6,11 @@ import (
|
||||
"github.com/alcionai/clues"
|
||||
|
||||
"github.com/alcionai/corso/src/internal/model"
|
||||
"github.com/alcionai/corso/src/internal/stats"
|
||||
"github.com/alcionai/corso/src/internal/streamstore"
|
||||
"github.com/alcionai/corso/src/pkg/backup"
|
||||
"github.com/alcionai/corso/src/pkg/backup/details"
|
||||
"github.com/alcionai/corso/src/pkg/count"
|
||||
"github.com/alcionai/corso/src/pkg/fault"
|
||||
"github.com/alcionai/corso/src/pkg/store"
|
||||
)
|
||||
@ -59,3 +61,12 @@ func getDetailsFromBackup(
|
||||
|
||||
return &deets, nil
|
||||
}
|
||||
|
||||
func getAPIStats(
|
||||
ctr *count.Bus,
|
||||
) stats.APIStats {
|
||||
s := stats.APIStats{}
|
||||
s.APITokensConsumed = ctr.Total(count.APICallTokensConsumed)
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
@ -43,3 +43,7 @@ type SkippedCounts struct {
|
||||
SkippedMalware int `json:"skippedMalware"`
|
||||
SkippedInvalidOneNoteFile int `json:"skippedInvalidOneNoteFile"`
|
||||
}
|
||||
|
||||
type APIStats struct {
|
||||
APITokensConsumed int64 `json:"apiTokensConsumed"`
|
||||
}
|
||||
|
||||
@ -4,7 +4,8 @@ type key string
|
||||
|
||||
const (
|
||||
// count of bucket-tokens consumed by api calls.
|
||||
APICallTokensConsumed key = "api-call-tokens-consumed"
|
||||
APICallTokensConsumed key = "api-call-tokens-consumed"
|
||||
PeakAPITokenUsagePerMin key = "peak-api-token-usage-per-min"
|
||||
// count of api calls that resulted in failure due to throttling.
|
||||
ThrottledAPICalls key = "throttled-api-calls"
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user