Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VAULT-27563 CE changes #27847

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions vault/activity_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ type ActivityLog struct {

// nodeID is the ID to use for all fragments that
// are generated.
// TODO: use secondary ID when available?
// This uses the primary ID as of right now, but
// could be adapted to use a secondary in the future.
nodeID string

// current log fragment (may be nil)
Expand Down Expand Up @@ -187,14 +188,6 @@ type ActivityLog struct {

inprocessExport *atomic.Bool

// CensusReportDone is a channel used to signal tests upon successful calls
// to (CensusReporter).Write() in CensusReport.
CensusReportDone chan bool

// CensusReportInterval is the testing configuration for time between
// Write() calls initiated in CensusReport.
CensusReportInterval time.Duration

// clock is used to support manipulating time in unit and integration tests
clock timeutil.Clock
// precomputedQueryWritten receives an element whenever a precomputed query
Expand All @@ -214,9 +207,6 @@ type ActivityLogCoreConfig struct {
// Do not start timers to send or persist fragments.
DisableTimers bool

// CensusReportInterval is the testing configuration for time
CensusReportInterval time.Duration

// MinimumRetentionMonths defines the minimum value for retention
MinimumRetentionMonths int

Expand Down Expand Up @@ -249,7 +239,6 @@ func NewActivityLog(core *Core, logger log.Logger, view *BarrierView, metrics me
sendCh: make(chan struct{}, 1), // buffered so it can be triggered by fragment size
doneCh: make(chan struct{}, 1),
partialMonthClientTracker: make(map[string]*activity.EntityRecord),
CensusReportInterval: time.Hour * 1,
clock: clock,
currentSegment: segmentInfo{
startTimestamp: 0,
Expand Down Expand Up @@ -998,7 +987,7 @@ func (a *ActivityLog) refreshFromStoredLog(ctx context.Context, wg *sync.WaitGro
return nil
}

// This version is used during construction
// SetConfigInit is used during construction
func (a *ActivityLog) SetConfigInit(config activityConfig) {
switch config.Enabled {
case "enable":
Expand All @@ -1020,13 +1009,9 @@ func (a *ActivityLog) SetConfigInit(config activityConfig) {
if a.configOverrides.MinimumRetentionMonths > 0 {
a.retentionMonths = a.configOverrides.MinimumRetentionMonths
}

if a.configOverrides.CensusReportInterval > 0 {
a.CensusReportInterval = a.configOverrides.CensusReportInterval
}
}

// This version reacts to user changes
// SetConfig reacts to user changes
func (a *ActivityLog) SetConfig(ctx context.Context, config activityConfig) {
a.l.Lock()
defer a.l.Unlock()
Expand Down Expand Up @@ -1948,8 +1933,6 @@ type activityConfig struct {

// Enabled is one of enable, disable, default.
Enabled string `json:"enabled"`

CensusReportInterval time.Duration `json:"census_report_interval"`
}

func defaultActivityConfig() activityConfig {
Expand Down
3 changes: 3 additions & 0 deletions vault/census_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ func (c *Core) setupCensusManager(ctx context.Context) error {
func (cm *CensusManager) BillingStart() time.Time {
return time.Time{}
}

// StartManualReportingSnapshots is a stub for CE.
func (cm *CensusManager) StartManualReportingSnapshots() {}
4 changes: 0 additions & 4 deletions vault/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -2467,10 +2467,6 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
if err := c.setupCensusManager(ctx); err != nil {
return err
}

c.StartCensusReports(ctx)
c.StartManualCensusSnapshots()

} else {
brokerLogger := logger.Named("audit")
broker, err := audit.NewBroker(brokerLogger)
Expand Down
Loading