From 47a8b2f4966c141a9d1cb4473a63fc87ff16d498 Mon Sep 17 00:00:00 2001 From: miagilepner Date: Thu, 13 Apr 2023 17:00:01 +0200 Subject: [PATCH] Revert "backport of commit e3c59773e969336bb4e85ddbf3a3700a6250f4c8 (#19629)" This reverts commit acb9d7c2740e9ea4ab6ae2b4b6cc098bfc9098d8. --- vault/activity_log.go | 23 ----------------------- vault/activity_log_util.go | 3 --- vault/census.go | 6 ------ vault/core.go | 6 ------ vault/testing.go | 1 - 5 files changed, 39 deletions(-) delete mode 100644 vault/census.go diff --git a/vault/activity_log.go b/vault/activity_log.go index d45525f2f21a..965d34a662f3 100644 --- a/vault/activity_log.go +++ b/vault/activity_log.go @@ -171,14 +171,6 @@ type ActivityLog struct { partialMonthClientTracker map[string]*activity.EntityRecord 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 } // These non-persistent configuration options allow us to disable @@ -190,9 +182,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 } // NewActivityLog creates an activity log. @@ -214,7 +203,6 @@ func NewActivityLog(core *Core, logger log.Logger, view *BarrierView, metrics me writeCh: make(chan struct{}, 1), // same for full segment doneCh: make(chan struct{}, 1), partialMonthClientTracker: make(map[string]*activity.EntityRecord), - CensusReportInterval: time.Hour * 1, currentSegment: segmentInfo{ startTimestamp: 0, @@ -952,10 +940,6 @@ func (a *ActivityLog) SetConfigInit(config activityConfig) { a.defaultReportMonths = config.DefaultReportMonths a.retentionMonths = config.RetentionMonths - - if a.configOverrides.CensusReportInterval > 0 { - a.CensusReportInterval = a.configOverrides.CensusReportInterval - } } // This version reacts to user changes @@ -1092,9 +1076,6 @@ func (c *Core) setupActivityLog(ctx context.Context, wg *sync.WaitGroup) error { manager.retentionWorker(ctx, time.Now(), months) close(manager.retentionDone) }(manager.retentionMonths) - - manager.CensusReportDone = make(chan bool) - go c.activityLog.CensusReport(ctx, c.censusAgent) } return nil @@ -1595,9 +1576,7 @@ func (a *ActivityLog) handleQuery(ctx context.Context, startTime, endTime time.T if computePartial { // Traverse through current month's activitylog data and group clients // into months and namespaces - a.fragmentLock.RLock() partialByMonth, partialByNamespace = a.populateNamespaceAndMonthlyBreakdowns() - a.fragmentLock.RUnlock() // Convert the byNamespace breakdowns into structs that are // consumable by the /activity endpoint, so as to reuse code between these two @@ -1781,8 +1760,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 { diff --git a/vault/activity_log_util.go b/vault/activity_log_util.go index 57ba7215a513..8cfa76a0f093 100644 --- a/vault/activity_log_util.go +++ b/vault/activity_log_util.go @@ -8,6 +8,3 @@ import "context" func (a *ActivityLog) sendCurrentFragment(ctx context.Context) error { return nil } - -// CensusReport is a no-op on OSS -func (a *ActivityLog) CensusReport(_ctx context.Context, _ca *CensusAgent) {} diff --git a/vault/census.go b/vault/census.go deleted file mode 100644 index 2312b3b54ef1..000000000000 --- a/vault/census.go +++ /dev/null @@ -1,6 +0,0 @@ -//go:build !enterprise - -package vault - -// CensusAgent is a stub for OSS -type CensusAgent struct{} diff --git a/vault/core.go b/vault/core.go index 59df4057ac9c..a3f54ccd576b 100644 --- a/vault/core.go +++ b/vault/core.go @@ -638,9 +638,6 @@ type Core struct { activityLogConfig ActivityLogCoreConfig - // censusAgent is the mechanism used for reporting Vault's billing data. - censusAgent *CensusAgent - // activeTime is set on active nodes indicating the time at which this node // became active. activeTime time.Time @@ -807,9 +804,6 @@ type CoreConfig struct { LicensePath string LicensingConfig *LicensingConfig - // Configured Census Agent - censusAgent *CensusAgent - DisablePerformanceStandby bool DisableIndexing bool DisableKeyEncodingChecks bool diff --git a/vault/testing.go b/vault/testing.go index cce0d54ac671..056526173063 100644 --- a/vault/testing.go +++ b/vault/testing.go @@ -214,7 +214,6 @@ func TestCoreWithSealAndUINoCleanup(t testing.T, opts *CoreConfig) *Core { conf.PluginDirectory = opts.PluginDirectory conf.DetectDeadlocks = opts.DetectDeadlocks conf.Experiments = []string{experiments.VaultExperimentEventsAlpha1} - conf.censusAgent = opts.censusAgent if opts.Logger != nil { conf.Logger = opts.Logger