Skip to content

Commit

Permalink
OSS Changes Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
divyaac committed Dec 11, 2024
1 parent bf6ac1a commit b847d00
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions vault/logical_system_activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const (

// WarningCurrentMonthIsAnEstimate is a warning string that is used to let the customer know that for this query, the current month's data is estimated.
WarningCurrentMonthIsAnEstimate = "Since this usage period includes both the current month and at least one historical month, counts returned in this usage period are an estimate. Client counts for this period will no longer be estimated at the start of the next month."

ErrorUpgradeInProgress = "Upgrade to 1.19+ is in progress; the activity log is not queryable until the upgrade is complete"
)

// activityQueryPath is available in every namespace
Expand Down Expand Up @@ -293,6 +295,9 @@ func (b *SystemBackend) handleClientExport(ctx context.Context, req *logical.Req
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

startTime, endTime, err := parseStartEndTimes(d, b.Core.BillingStart())
if err != nil {
Expand Down Expand Up @@ -339,6 +344,9 @@ func (b *SystemBackend) handleClientMetricQuery(ctx context.Context, req *logica
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

warnings := make([]string, 0)

Expand Down Expand Up @@ -385,6 +393,9 @@ func (b *SystemBackend) handleMonthlyActivityCount(ctx context.Context, req *log
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

results, err := a.partialMonthClientCount(ctx)
if err != nil {
Expand All @@ -406,6 +417,9 @@ func (b *SystemBackend) handleActivityConfigRead(ctx context.Context, req *logic
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

config, err := a.loadConfigOrDefault(ctx)
if err != nil {
Expand Down Expand Up @@ -440,6 +454,9 @@ func (b *SystemBackend) handleActivityConfigUpdate(ctx context.Context, req *log
if a == nil {
return logical.ErrorResponse("no activity log present"), nil
}
if !a.hasDedupClientsUpgrade(ctx) {
return logical.ErrorResponse(ErrorUpgradeInProgress), nil
}

warnings := make([]string, 0)

Expand Down

0 comments on commit b847d00

Please sign in to comment.