Skip to content

Commit d4fe958

Browse files
authored
chore: upgrade lru-cache; replace use of async-cache (#3610)
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
1 parent cd2e80a commit d4fe958

File tree

4 files changed

+267
-288
lines changed

4 files changed

+267
-288
lines changed

lib/opentelemetry-metrics/ElasticApmMetricExporter.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const {
1414
DropAggregation,
1515
DataPointType,
1616
} = require('@opentelemetry/sdk-metrics');
17-
const LRU = require('lru-cache');
17+
const { LRUCache } = require('lru-cache');
1818

1919
/**
2020
* The `timestamp` in a metricset for APM Server intake is "UTC based and
@@ -102,8 +102,8 @@ class ElasticApmMetricExporter {
102102
this._sumAggregation = new SumAggregation();
103103
this._lastValueAggregation = new LastValueAggregation();
104104
this._dropAggregation = new DropAggregation();
105-
this._attrDropWarnCache = new LRU({ max: 1000 });
106-
this._dataPointTypeDropWarnCache = new LRU({ max: 1000 });
105+
this._attrDropWarnCache = new LRUCache({ max: 1000 });
106+
this._dataPointTypeDropWarnCache = new LRUCache({ max: 1000 });
107107
}
108108

109109
/**

0 commit comments

Comments
 (0)