Skip to content

Commit

Permalink
chore: upgrade lru-cache; replace use of async-cache (#3610)
Browse files Browse the repository at this point in the history
lru-cache@7 added support for async fetching, and async-cache
was deprecated

See https://github.com/isaacs/node-lru-cache#fetchmethod-read-only
for the best docs for using lru-cache for async caching.

Refs: #2760
  • Loading branch information
trentm authored Sep 7, 2023
1 parent cd2e80a commit d4fe958
Show file tree
Hide file tree
Showing 4 changed files with 267 additions and 288 deletions.
6 changes: 3 additions & 3 deletions lib/opentelemetry-metrics/ElasticApmMetricExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
DropAggregation,
DataPointType,
} = require('@opentelemetry/sdk-metrics');
const LRU = require('lru-cache');
const { LRUCache } = require('lru-cache');

/**
* The `timestamp` in a metricset for APM Server intake is "UTC based and
Expand Down Expand Up @@ -102,8 +102,8 @@ class ElasticApmMetricExporter {
this._sumAggregation = new SumAggregation();
this._lastValueAggregation = new LastValueAggregation();
this._dropAggregation = new DropAggregation();
this._attrDropWarnCache = new LRU({ max: 1000 });
this._dataPointTypeDropWarnCache = new LRU({ max: 1000 });
this._attrDropWarnCache = new LRUCache({ max: 1000 });
this._dataPointTypeDropWarnCache = new LRUCache({ max: 1000 });
}

/**
Expand Down
Loading

0 comments on commit d4fe958

Please sign in to comment.