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

do not increment sync operation count metric on per index set #6109

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
13 changes: 1 addition & 12 deletions pkg/storage/stores/shipper/downloads/index_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type indexSet struct {
baseIndexSet storage.IndexSet
tableName, userID string
cacheLocation string
metrics *metrics
boltDBIndexClient BoltDBIndexClient
logger log.Logger

Expand All @@ -58,8 +57,7 @@ type indexSet struct {
}

func NewIndexSet(tableName, userID, cacheLocation string, baseIndexSet storage.IndexSet,
boltDBIndexClient BoltDBIndexClient, logger log.Logger, metrics *metrics,
) (IndexSet, error) {
boltDBIndexClient BoltDBIndexClient, logger log.Logger) (IndexSet, error) {
if baseIndexSet.IsUserBasedIndexSet() && userID == "" {
return nil, fmt.Errorf("userID must not be empty")
} else if !baseIndexSet.IsUserBasedIndexSet() && userID != "" {
Expand All @@ -76,7 +74,6 @@ func NewIndexSet(tableName, userID, cacheLocation string, baseIndexSet storage.I
tableName: tableName,
userID: userID,
cacheLocation: cacheLocation,
metrics: metrics,
boltDBIndexClient: boltDBIndexClient,
logger: logger,
lastUsedAt: time.Now(),
Expand Down Expand Up @@ -284,14 +281,6 @@ func (t *indexSet) Sync(ctx context.Context) (err error) {
func (t *indexSet) sync(ctx context.Context, lock, bypassListCache bool) (err error) {
level.Debug(t.logger).Log("msg", "syncing index files")

defer func() {
status := statusSuccess
if err != nil {
status = statusFailure
}
t.metrics.tablesSyncOperationTotal.WithLabelValues(status).Inc()
}()

toDownload, toDelete, err := t.checkStorageForUpdates(ctx, lock, bypassListCache)
if err != nil {
return err
Expand Down
3 changes: 1 addition & 2 deletions pkg/storage/stores/shipper/downloads/index_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ func buildTestIndexSet(t *testing.T, userID, path string) (*indexSet, stopFunc)
cachePath := filepath.Join(path, cacheDirName)

baseIndexSet := storage.NewIndexSet(storageClient, userID != "")
idxSet, err := NewIndexSet(tableName, userID, filepath.Join(cachePath, tableName, userID), baseIndexSet,
boltDBIndexClient, util_log.Logger, newMetrics(nil))
idxSet, err := NewIndexSet(tableName, userID, filepath.Join(cachePath, tableName, userID), baseIndexSet, boltDBIndexClient, util_log.Logger)
require.NoError(t, err)

require.NoError(t, idxSet.Init(false))
Expand Down
9 changes: 3 additions & 6 deletions pkg/storage/stores/shipper/downloads/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ func LoadTable(name, cacheLocation string, storageClient storage.Client, boltDBI
}

userID := fileInfo.Name()
userIndexSet, err := NewIndexSet(name, userID, filepath.Join(cacheLocation, userID),
table.baseUserIndexSet, boltDBIndexClient, loggerWithUserID(table.logger, userID), metrics)
userIndexSet, err := NewIndexSet(name, userID, filepath.Join(cacheLocation, userID), table.baseUserIndexSet, boltDBIndexClient, loggerWithUserID(table.logger, userID))
if err != nil {
return nil, err
}
Expand All @@ -122,8 +121,7 @@ func LoadTable(name, cacheLocation string, storageClient storage.Client, boltDBI
table.indexSets[userID] = userIndexSet
}

commonIndexSet, err := NewIndexSet(name, "", cacheLocation, table.baseCommonIndexSet,
boltDBIndexClient, table.logger, metrics)
commonIndexSet, err := NewIndexSet(name, "", cacheLocation, table.baseCommonIndexSet, boltDBIndexClient, table.logger)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -298,8 +296,7 @@ func (t *table) getOrCreateIndexSet(ctx context.Context, id string, forQuerying
}

// instantiate the index set, add it to the map
indexSet, err = NewIndexSet(t.name, id, filepath.Join(t.cacheLocation, id), baseIndexSet, t.boltDBIndexClient,
loggerWithUserID(t.logger, id), t.metrics)
indexSet, err = NewIndexSet(t.name, id, filepath.Join(t.cacheLocation, id), baseIndexSet, t.boltDBIndexClient, loggerWithUserID(t.logger, id))
if err != nil {
return nil, err
}
Expand Down