Skip to content

Commit

Permalink
apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
walldiss committed Jul 4, 2024
1 parent 1aca186 commit cbf8894
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion store/cache/accessor_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewAccessorCache(name string, cacheSize int) (*AccessorCache, error) {
// Instantiate the Accessor Cache.
bslru, err := lru.NewWithEvict[key, *accessor](cacheSize, bc.evictFn())
if err != nil {
return nil, fmt.Errorf("failed to instantiate accessor cache: %w", err)
return nil, fmt.Errorf("creating accessor cache %s: %w", name, err)
}
bc.cache = bslru
return bc, nil
Expand Down
2 changes: 1 addition & 1 deletion store/cache/accessor_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestAccessorCache(t *testing.T) {
require.NoError(t, err)
})

t.Run("get blockstore from accessor", func(t *testing.T) {
t.Run("get reader from accessor", func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
cache, err := NewAccessorCache("test", 1)
Expand Down
2 changes: 1 addition & 1 deletion store/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
meter = otel.Meter("store_cache")
)

var ErrCacheMiss = errors.New("accessor not found in blockstore cache")
var ErrCacheMiss = errors.New("accessor not found in cache")

type OpenAccessorFn func(context.Context) (eds.AccessorStreamer, error)

Expand Down
8 changes: 4 additions & 4 deletions store/cache/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ type metrics struct {
}

func newMetrics(bc *AccessorCache) (*metrics, error) {
metricsPrefix := "eds_blockstore_cache_" + bc.name
metricsPrefix := "eds_cache" + bc.name

evictedCounter, err := meter.Int64Counter(metricsPrefix+"_evicted_counter",
metric.WithDescription("eds blockstore cache evicted event counter"))
metric.WithDescription("eds cache evicted event counter"))
if err != nil {
return nil, err
}

getCounter, err := meter.Int64Counter(metricsPrefix+"_get_counter",
metric.WithDescription("eds blockstore cache evicted event counter"))
metric.WithDescription("eds cache get event counter"))
if err != nil {
return nil, err
}

cacheSize, err := meter.Int64ObservableGauge(metricsPrefix+"_size",
metric.WithDescription("total amount of items in blockstore cache"),
metric.WithDescription("total amount of items in cache"),
)
if err != nil {
return nil, err
Expand Down

0 comments on commit cbf8894

Please sign in to comment.