@chainlink/external-adapter-framework 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -0
- package/package.json +42 -50
- package/adapter/basic.d.ts +0 -86
- package/adapter/basic.js +0 -325
- package/adapter/basic.js.map +0 -1
- package/adapter/endpoint.d.ts +0 -17
- package/adapter/endpoint.js +0 -19
- package/adapter/endpoint.js.map +0 -1
- package/adapter/index.d.ts +0 -4
- package/adapter/index.js +0 -21
- package/adapter/index.js.map +0 -1
- package/adapter/price.d.ts +0 -75
- package/adapter/price.js +0 -88
- package/adapter/price.js.map +0 -1
- package/adapter/types.d.ts +0 -118
- package/adapter/types.js +0 -3
- package/adapter/types.js.map +0 -1
- package/background-executor.d.ts +0 -9
- package/background-executor.js +0 -97
- package/background-executor.js.map +0 -1
- package/cache/factory.d.ts +0 -6
- package/cache/factory.js +0 -24
- package/cache/factory.js.map +0 -1
- package/cache/index.d.ts +0 -87
- package/cache/index.js +0 -133
- package/cache/index.js.map +0 -1
- package/cache/local.d.ts +0 -23
- package/cache/local.js +0 -84
- package/cache/local.js.map +0 -1
- package/cache/metrics.d.ts +0 -27
- package/cache/metrics.js +0 -121
- package/cache/metrics.js.map +0 -1
- package/cache/redis.d.ts +0 -16
- package/cache/redis.js +0 -101
- package/cache/redis.js.map +0 -1
- package/config/index.d.ts +0 -298
- package/config/index.js +0 -359
- package/config/index.js.map +0 -1
- package/config/provider-limits.d.ts +0 -27
- package/config/provider-limits.js +0 -75
- package/config/provider-limits.js.map +0 -1
- package/examples/bank-frick/accounts.d.ts +0 -52
- package/examples/bank-frick/accounts.js +0 -190
- package/examples/bank-frick/accounts.js.map +0 -1
- package/examples/bank-frick/config/index.d.ts +0 -17
- package/examples/bank-frick/config/index.js +0 -55
- package/examples/bank-frick/config/index.js.map +0 -1
- package/examples/bank-frick/index.d.ts +0 -16
- package/examples/bank-frick/index.js +0 -16
- package/examples/bank-frick/index.js.map +0 -1
- package/examples/bank-frick/util.d.ts +0 -4
- package/examples/bank-frick/util.js +0 -40
- package/examples/bank-frick/util.js.map +0 -1
- package/examples/coingecko/src/config/index.d.ts +0 -2
- package/examples/coingecko/src/config/index.js +0 -6
- package/examples/coingecko/src/config/index.js.map +0 -1
- package/examples/coingecko/src/config/overrides.json +0 -10825
- package/examples/coingecko/src/crypto-utils.d.ts +0 -48
- package/examples/coingecko/src/crypto-utils.js +0 -60
- package/examples/coingecko/src/crypto-utils.js.map +0 -1
- package/examples/coingecko/src/endpoint/coins.d.ts +0 -9
- package/examples/coingecko/src/endpoint/coins.js +0 -37
- package/examples/coingecko/src/endpoint/coins.js.map +0 -1
- package/examples/coingecko/src/endpoint/crypto-marketcap.d.ts +0 -3
- package/examples/coingecko/src/endpoint/crypto-marketcap.js +0 -30
- package/examples/coingecko/src/endpoint/crypto-marketcap.js.map +0 -1
- package/examples/coingecko/src/endpoint/crypto-volume.d.ts +0 -3
- package/examples/coingecko/src/endpoint/crypto-volume.js +0 -30
- package/examples/coingecko/src/endpoint/crypto-volume.js.map +0 -1
- package/examples/coingecko/src/endpoint/crypto.d.ts +0 -2
- package/examples/coingecko/src/endpoint/crypto.js +0 -28
- package/examples/coingecko/src/endpoint/crypto.js.map +0 -1
- package/examples/coingecko/src/endpoint/dominance.d.ts +0 -3
- package/examples/coingecko/src/endpoint/dominance.js +0 -28
- package/examples/coingecko/src/endpoint/dominance.js.map +0 -1
- package/examples/coingecko/src/endpoint/global-marketcap.d.ts +0 -3
- package/examples/coingecko/src/endpoint/global-marketcap.js +0 -28
- package/examples/coingecko/src/endpoint/global-marketcap.js.map +0 -1
- package/examples/coingecko/src/endpoint/index.d.ts +0 -6
- package/examples/coingecko/src/endpoint/index.js +0 -16
- package/examples/coingecko/src/endpoint/index.js.map +0 -1
- package/examples/coingecko/src/global-utils.d.ts +0 -27
- package/examples/coingecko/src/global-utils.js +0 -47
- package/examples/coingecko/src/global-utils.js.map +0 -1
- package/examples/coingecko/src/index.d.ts +0 -4
- package/examples/coingecko/src/index.js +0 -19
- package/examples/coingecko/src/index.js.map +0 -1
- package/examples/coingecko-old/batch-warming.d.ts +0 -7
- package/examples/coingecko-old/batch-warming.js +0 -54
- package/examples/coingecko-old/batch-warming.js.map +0 -1
- package/examples/coingecko-old/index.d.ts +0 -2
- package/examples/coingecko-old/index.js +0 -12
- package/examples/coingecko-old/index.js.map +0 -1
- package/examples/coingecko-old/rest.d.ts +0 -12
- package/examples/coingecko-old/rest.js +0 -55
- package/examples/coingecko-old/rest.js.map +0 -1
- package/examples/cryptocompare/src/config/index.d.ts +0 -2
- package/examples/cryptocompare/src/config/index.js +0 -6
- package/examples/cryptocompare/src/config/index.js.map +0 -1
- package/examples/cryptocompare/src/endpoints/crypto.d.ts +0 -28
- package/examples/cryptocompare/src/endpoints/crypto.js +0 -54
- package/examples/cryptocompare/src/endpoints/crypto.js.map +0 -1
- package/examples/cryptocompare/src/endpoints/index.d.ts +0 -1
- package/examples/cryptocompare/src/endpoints/index.js +0 -6
- package/examples/cryptocompare/src/endpoints/index.js.map +0 -1
- package/examples/cryptocompare/src/index.d.ts +0 -4
- package/examples/cryptocompare/src/index.js +0 -14
- package/examples/cryptocompare/src/index.js.map +0 -1
- package/examples/genesis/config/index.d.ts +0 -7
- package/examples/genesis/config/index.js +0 -11
- package/examples/genesis/config/index.js.map +0 -1
- package/examples/genesis/index.d.ts +0 -2
- package/examples/genesis/index.js +0 -13
- package/examples/genesis/index.js.map +0 -1
- package/examples/genesis/sseStream.d.ts +0 -16
- package/examples/genesis/sseStream.js +0 -149
- package/examples/genesis/sseStream.js.map +0 -1
- package/index.d.ts +0 -17
- package/index.js +0 -174
- package/index.js.map +0 -1
- package/metrics/constants.d.ts +0 -16
- package/metrics/constants.js +0 -26
- package/metrics/constants.js.map +0 -1
- package/metrics/index.d.ts +0 -19
- package/metrics/index.js +0 -139
- package/metrics/index.js.map +0 -1
- package/metrics/util.d.ts +0 -7
- package/metrics/util.js +0 -10
- package/metrics/util.js.map +0 -1
- package/rate-limiting/background/fixed-frequency.d.ts +0 -11
- package/rate-limiting/background/fixed-frequency.js +0 -36
- package/rate-limiting/background/fixed-frequency.js.map +0 -1
- package/rate-limiting/index.d.ts +0 -56
- package/rate-limiting/index.js +0 -86
- package/rate-limiting/index.js.map +0 -1
- package/rate-limiting/metrics.d.ts +0 -3
- package/rate-limiting/metrics.js +0 -45
- package/rate-limiting/metrics.js.map +0 -1
- package/rate-limiting/request/simple-counting.d.ts +0 -21
- package/rate-limiting/request/simple-counting.js +0 -63
- package/rate-limiting/request/simple-counting.js.map +0 -1
- package/transports/batch-warming.d.ts +0 -35
- package/transports/batch-warming.js +0 -138
- package/transports/batch-warming.js.map +0 -1
- package/transports/index.d.ts +0 -87
- package/transports/index.js +0 -56
- package/transports/index.js.map +0 -1
- package/transports/metrics.d.ts +0 -25
- package/transports/metrics.js +0 -122
- package/transports/metrics.js.map +0 -1
- package/transports/rest.d.ts +0 -51
- package/transports/rest.js +0 -133
- package/transports/rest.js.map +0 -1
- package/transports/routing.d.ts +0 -23
- package/transports/routing.js +0 -52
- package/transports/routing.js.map +0 -1
- package/transports/sse.d.ts +0 -40
- package/transports/sse.js +0 -92
- package/transports/sse.js.map +0 -1
- package/transports/util.d.ts +0 -9
- package/transports/util.js +0 -87
- package/transports/util.js.map +0 -1
- package/transports/websocket.d.ts +0 -81
- package/transports/websocket.js +0 -165
- package/transports/websocket.js.map +0 -1
- package/util/censor/censor-list.d.ts +0 -9
- package/util/censor/censor-list.js +0 -13
- package/util/censor/censor-list.js.map +0 -1
- package/util/index.d.ts +0 -13
- package/util/index.js +0 -38
- package/util/index.js.map +0 -1
- package/util/logger.d.ts +0 -49
- package/util/logger.js +0 -123
- package/util/logger.js.map +0 -1
- package/util/request.d.ts +0 -102
- package/util/request.js +0 -3
- package/util/request.js.map +0 -1
- package/util/subscription-set/expiring-sorted-set.d.ts +0 -21
- package/util/subscription-set/expiring-sorted-set.js +0 -36
- package/util/subscription-set/expiring-sorted-set.js.map +0 -1
- package/util/subscription-set/redis-sorted-set.d.ts +0 -9
- package/util/subscription-set/redis-sorted-set.js +0 -29
- package/util/subscription-set/redis-sorted-set.js.map +0 -1
- package/util/subscription-set/subscription-set.d.ts +0 -19
- package/util/subscription-set/subscription-set.js +0 -28
- package/util/subscription-set/subscription-set.js.map +0 -1
- package/util/test-payload-loader.d.ts +0 -26
- package/util/test-payload-loader.js +0 -85
- package/util/test-payload-loader.js.map +0 -1
- package/validation/error.d.ts +0 -48
- package/validation/error.js +0 -78
- package/validation/error.js.map +0 -1
- package/validation/index.d.ts +0 -5
- package/validation/index.js +0 -91
- package/validation/index.js.map +0 -1
- package/validation/input-params.d.ts +0 -14
- package/validation/input-params.js +0 -3
- package/validation/input-params.js.map +0 -1
- package/validation/input-validator.d.ts +0 -16
- package/validation/input-validator.js +0 -123
- package/validation/input-validator.js.map +0 -1
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.BatchWarmingTransport = void 0;
|
|
27
|
-
const util_1 = require("../util");
|
|
28
|
-
const _1 = require("./");
|
|
29
|
-
const util_2 = require("./util");
|
|
30
|
-
const rateLimitMetrics = __importStar(require("../rate-limiting/metrics"));
|
|
31
|
-
const cacheMetrics = __importStar(require("../cache/metrics"));
|
|
32
|
-
const transportMetrics = __importStar(require("./metrics"));
|
|
33
|
-
const error_1 = require("../validation/error");
|
|
34
|
-
const WARMUP_BATCH_REQUEST_ID = '9002';
|
|
35
|
-
const logger = (0, util_1.makeLogger)('BatchWarmingTransport');
|
|
36
|
-
/**
|
|
37
|
-
* Transport implementation that takes incoming batches requests and keeps a warm cache of values.
|
|
38
|
-
* Within the setup function, adapter params are added to an set that also keeps track and expires values.
|
|
39
|
-
* In the background execute, the list of non-expired items in the set is fetched.
|
|
40
|
-
* Then, the list is passed through the `prepareRequest` function, that returns an AxiosRequestConfig.
|
|
41
|
-
* The Data Provider response is, they are passed through the `parseResponse` function to create a [[CacheEntry]] list.
|
|
42
|
-
* Finally, the items in that [[CacheEntry]] list are set in the Cache so the Adapter can fetch values from there.
|
|
43
|
-
*
|
|
44
|
-
* @typeParam AdapterParams - interface for the adapter request body
|
|
45
|
-
* @typeParam ProviderRequestBody - interface for the body of the request to the Data Provider
|
|
46
|
-
* @typeParam ProviderResponseBody - interface for the body of the Data Provider's response
|
|
47
|
-
*/
|
|
48
|
-
class BatchWarmingTransport {
|
|
49
|
-
constructor(config) {
|
|
50
|
-
this.config = config;
|
|
51
|
-
// Flag used to track whether the warmer has moved from having no entries to having some and vice versa
|
|
52
|
-
// Used for recording the cache warmer active metrics accurately
|
|
53
|
-
this.WARMER_ACTIVE = false;
|
|
54
|
-
}
|
|
55
|
-
async initialize(dependencies, _, endpointName) {
|
|
56
|
-
this.cache = dependencies.cache;
|
|
57
|
-
this.rateLimiter = dependencies.backgroundExecuteRateLimiter;
|
|
58
|
-
this.subscriptionSet = dependencies.subscriptionSetFactory.buildSet(endpointName);
|
|
59
|
-
}
|
|
60
|
-
// This might need coalescing to avoid too frequent ttl updates
|
|
61
|
-
async registerRequest(req, config) {
|
|
62
|
-
logger.debug(`Adding entry to subscription set (ttl ${config.WARMUP_SUBSCRIPTION_TTL}): [${req.requestContext.cacheKey}] = ${req.requestContext.data}`);
|
|
63
|
-
if (config.BATCH_TRANSPORT_SETUP_VALIDATION) {
|
|
64
|
-
const response = await this.makeRequest([req.requestContext.data], config);
|
|
65
|
-
if (!response.results.length) {
|
|
66
|
-
throw new error_1.AdapterError({
|
|
67
|
-
statusCode: 200,
|
|
68
|
-
providerStatusCode: response.providerResponse.status,
|
|
69
|
-
message: response.providerResponse.message ||
|
|
70
|
-
'There was an error while validating the incoming request before adding to the batch subscription set',
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
await this.subscriptionSet.add(req.requestContext.cacheKey, req.requestContext.data, config.WARMUP_SUBSCRIPTION_TTL);
|
|
75
|
-
}
|
|
76
|
-
async backgroundExecute(context) {
|
|
77
|
-
logger.debug('Starting background execute');
|
|
78
|
-
const entries = await this.subscriptionSet.getAll();
|
|
79
|
-
// Keep track of active subscriptions for background execute
|
|
80
|
-
transportMetrics.bgExecuteSubscriptionSetCount
|
|
81
|
-
.labels({ endpoint: context.adapterEndpoint.name, transport_type: 'batch' })
|
|
82
|
-
.set(entries.length);
|
|
83
|
-
const interval = this.rateLimiter.msUntilNextExecution(context.adapterEndpoint.name);
|
|
84
|
-
if (!entries.length) {
|
|
85
|
-
logger.debug('No entries in batch warming set, skipping');
|
|
86
|
-
if (this.WARMER_ACTIVE) {
|
|
87
|
-
// Decrement count when warmer changed from having entries to having none
|
|
88
|
-
cacheMetrics.cacheWarmerCount.labels({ isBatched: 'true' }).dec();
|
|
89
|
-
this.WARMER_ACTIVE = false;
|
|
90
|
-
}
|
|
91
|
-
return interval;
|
|
92
|
-
}
|
|
93
|
-
else if (this.WARMER_ACTIVE === false) {
|
|
94
|
-
// Increment count when warmer changed from having no entries to having some
|
|
95
|
-
cacheMetrics.cacheWarmerCount.labels({ isBatched: 'true' }).inc();
|
|
96
|
-
this.WARMER_ACTIVE = true;
|
|
97
|
-
}
|
|
98
|
-
const response = await this.makeRequest(entries, context.adapterConfig);
|
|
99
|
-
if (!response.results?.length) {
|
|
100
|
-
return interval;
|
|
101
|
-
}
|
|
102
|
-
const cacheEntries = (0, _1.buildCacheEntriesFromResults)(response.results, context);
|
|
103
|
-
logger.debug('Setting adapter responses in cache');
|
|
104
|
-
await this.cache.setMany(cacheEntries, context.adapterConfig.CACHE_MAX_AGE);
|
|
105
|
-
// Record cost of data provider call
|
|
106
|
-
const cost = rateLimitMetrics.retrieveCost(response.providerResponse.data);
|
|
107
|
-
rateLimitMetrics.rateLimitCreditsSpentTotal
|
|
108
|
-
.labels({
|
|
109
|
-
feed_id: 'N/A',
|
|
110
|
-
participant_id: WARMUP_BATCH_REQUEST_ID,
|
|
111
|
-
})
|
|
112
|
-
.inc(cost);
|
|
113
|
-
return interval;
|
|
114
|
-
}
|
|
115
|
-
async makeRequest(entries, config) {
|
|
116
|
-
logger.trace(`Have ${entries.length} entries in batch, preparing request...`);
|
|
117
|
-
const request = this.config.prepareRequest(entries, config);
|
|
118
|
-
logger.trace(`Sending request to data provider: ${JSON.stringify(request)}`);
|
|
119
|
-
let providerResponse;
|
|
120
|
-
try {
|
|
121
|
-
providerResponse = await (0, util_2.axiosRequest)(request, config);
|
|
122
|
-
}
|
|
123
|
-
catch (e) {
|
|
124
|
-
logger.warn(`There was an error while performing the batch request: ${e}`);
|
|
125
|
-
return {
|
|
126
|
-
results: [],
|
|
127
|
-
providerResponse: e,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
logger.debug(`Got response from provider, parsing (raw body: ${providerResponse.data})`);
|
|
131
|
-
return {
|
|
132
|
-
results: this.config.parseResponse(entries, providerResponse, config),
|
|
133
|
-
providerResponse,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
exports.BatchWarmingTransport = BatchWarmingTransport;
|
|
138
|
-
//# sourceMappingURL=batch-warming.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-warming.js","sourceRoot":"","sources":["../../../src/transports/batch-warming.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,kCAAqD;AAErD,yBAAwF;AACxF,iCAAqC;AACrC,2EAA4D;AAC5D,+DAAgD;AAEhD,4DAA6C;AAC7C,+CAAkD;AAElD,MAAM,uBAAuB,GAAG,MAAM,CAAA;AAEtC,MAAM,MAAM,GAAG,IAAA,iBAAU,EAAC,uBAAuB,CAAC,CAAA;AAElD;;;;;;;;;;;GAWG;AACH,MAAa,qBAAqB;IAehC,YACU,MAUP;QAVO,WAAM,GAAN,MAAM,CAUb;QAfH,uGAAuG;QACvG,gEAAgE;QAChE,kBAAa,GAAG,KAAK,CAAA;IAclB,CAAC;IAEJ,KAAK,CAAC,UAAU,CACd,YAAiC,EACjC,CAAgC,EAChC,YAAoB;QAEpB,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,KAA2D,CAAA;QACrF,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,4BAA4B,CAAA;QAC5D,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC,sBAAsB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;IACnF,CAAC;IAED,+DAA+D;IAC/D,KAAK,CAAC,eAAe,CACnB,GAAkC,EAClC,MAAqC;QAErC,MAAM,CAAC,KAAK,CACV,yCAAyC,MAAM,CAAC,uBAAuB,OAAO,GAAG,CAAC,cAAc,CAAC,QA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KAAK,CAAC,QAAQ,OAAO,CAAC,MAAM,yCAAyC,CAAC,CAAA;QAC7E,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAE3D,MAAM,CAAC,KAAK,CAAC,qCAAqC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAC5E,IAAI,gBAAgB,CAAA;QACpB,IAAI;YACF,gBAAgB,GAAG,MAAM,IAAA,mBAAY,EAInC,OAAO,EAAE,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,EAAE,CAAC,CAAA;YAC1E,OAAO;gBACL,OAAO,EAAE,EAAE;gBACX,gBAAgB,EAAE,CAAkB;aACrC,CAAA;SACF;QAED,MAAM,CAAC,KAAK,CAAC,kDAAkD,gBAAgB,CAAC,IAAI,GAAG,CAAC,CAAA;QACxF,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC;YACrE,gBAAgB;SACjB,CAAA;IACH,CAAC;CACF;AArJD,sDAqJC"}
|
package/transports/index.d.ts
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { AdapterContext, AdapterDependencies } from '../adapter';
|
|
2
|
-
import { Cache, CacheEntry } from '../cache';
|
|
3
|
-
import { AdapterConfig, SettingsMap } from '../config';
|
|
4
|
-
import { AdapterRequest, AdapterResponse, ProviderResult } from '../util/request';
|
|
5
|
-
export * from './batch-warming';
|
|
6
|
-
export * from './rest';
|
|
7
|
-
export * from './sse';
|
|
8
|
-
export * from './websocket';
|
|
9
|
-
/**
|
|
10
|
-
* Generic interface for a Transport.
|
|
11
|
-
* A Transport defines the way in which an AdapterEndpoint will process incoming requests to
|
|
12
|
-
* fetch data from a Data Provider. The setup phase will take care of the former, while the
|
|
13
|
-
* backgroundExecute will be in charge of the latter.
|
|
14
|
-
* This separation gives us the ability of splitting these concerns, and optionally parallelizing
|
|
15
|
-
* the reading and writing of data to a centralized Cache.
|
|
16
|
-
*
|
|
17
|
-
* @typeParam Params - the structure of the AdapterRequest's body
|
|
18
|
-
* @typeParam Result - the structure of the AdapterResponse's body
|
|
19
|
-
*/
|
|
20
|
-
export interface Transport<Params, Result, CustomSettings extends SettingsMap> {
|
|
21
|
-
cache?: Cache<AdapterResponse<Result>>;
|
|
22
|
-
/**
|
|
23
|
-
* Initializes the transport in the Adapter context.
|
|
24
|
-
*
|
|
25
|
-
* @param dependencies - Adapter dependencies (e.g. cache instance)
|
|
26
|
-
* @param config - Adapter config containing env vars
|
|
27
|
-
* @returns an empty Promise
|
|
28
|
-
*/
|
|
29
|
-
initialize: (dependencies: AdapterDependencies, config: AdapterConfig<CustomSettings>, endpointName: string) => Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Registers a request within the context of the transport.
|
|
32
|
-
* This means things like adding the request to a subscription set.
|
|
33
|
-
*
|
|
34
|
-
* @param req - the incoming AdapterRequest
|
|
35
|
-
* @param config - common configuration for the Adapter as a whole
|
|
36
|
-
* @returns an empty Promise
|
|
37
|
-
*/
|
|
38
|
-
registerRequest?: (req: AdapterRequest<Params>, config: AdapterConfig<CustomSettings>) => Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Performs a synchronous fetch/processing of information within the lifecycle of an incoming request.
|
|
41
|
-
* This is mostly intended to be used as a backwards compatibility mechanism, or for very specific cases where
|
|
42
|
-
* processing is expected to be very simple. Things like rate limiting for example won't be able to be applied
|
|
43
|
-
* to this method with more than one EA instance. It's heavily encouraged to instead rework adapter logic
|
|
44
|
-
* to perform as much of the work as possible (or all of it) in the backgroundExecute method.
|
|
45
|
-
*
|
|
46
|
-
* @param req - the incoming AdapterRequest
|
|
47
|
-
* @param config - common configuration for the Adapter as a whole
|
|
48
|
-
* @returns a Promise that _optionally_ returns an AdapterResponse, if the Transport has the capability of
|
|
49
|
-
* immediately fetching data and returning it without the background process.
|
|
50
|
-
*/
|
|
51
|
-
foregroundExecute?: (req: AdapterRequest<Params>, config: AdapterConfig<CustomSettings>) => Promise<AdapterResponse<Result> | void>;
|
|
52
|
-
/**
|
|
53
|
-
* Main function that will be called by the main background loop of the writer EA.
|
|
54
|
-
* All logic fetching from providers should live here.
|
|
55
|
-
*
|
|
56
|
-
* @param context - background context for the execution (e.g. endpoint name)
|
|
57
|
-
* @returns an empty Promise
|
|
58
|
-
*/
|
|
59
|
-
backgroundExecute?: (context: AdapterContext<CustomSettings>) => Promise<number>;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Generic interface for a Transport that contains or manages other transports.
|
|
63
|
-
* Some transports, such as the RoutingTransport, do not directly fetch data from a Data Provider, but
|
|
64
|
-
* instead coordinate the execution of other transports for fetching and transforming data.
|
|
65
|
-
* These transports have alternative initialization procedures, which typically involve
|
|
66
|
-
* initializing each downstream transport.
|
|
67
|
-
*
|
|
68
|
-
* @typeParam Params - the structure of the AdapterRequest's body
|
|
69
|
-
* @typeParam Result - the structure of the AdapterResponse's body
|
|
70
|
-
* @typeParam CustomSettings - custom settings for the Adapter, or the default SettingsMap
|
|
71
|
-
*/
|
|
72
|
-
export interface MetaTransport<Params, Result, CustomSettings extends SettingsMap> extends Transport<Params, Result, CustomSettings> {
|
|
73
|
-
transports: {
|
|
74
|
-
[key: string]: Transport<unknown, unknown, CustomSettings>;
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
export declare type BackgroundStoredResultType = {
|
|
78
|
-
result: unknown;
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Helper method to build cache entries to set after getting a bunch of responses from a DP.
|
|
82
|
-
*
|
|
83
|
-
* @param results - a list of results coming from a DataProvider
|
|
84
|
-
* @param context - context for the Adapter
|
|
85
|
-
* @returns a list of CacheEntries of AdapterResponses
|
|
86
|
-
*/
|
|
87
|
-
export declare const buildCacheEntriesFromResults: <Params, CustomSettings extends SettingsMap>(results: ProviderResult<Params>[], context: AdapterContext<CustomSettings>) => CacheEntry<AdapterResponse<BackgroundStoredResultType>>[];
|
package/transports/index.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.buildCacheEntriesFromResults = void 0;
|
|
18
|
-
const cache_1 = require("../cache");
|
|
19
|
-
__exportStar(require("./batch-warming"), exports);
|
|
20
|
-
__exportStar(require("./rest"), exports);
|
|
21
|
-
__exportStar(require("./sse"), exports);
|
|
22
|
-
__exportStar(require("./websocket"), exports);
|
|
23
|
-
/**
|
|
24
|
-
* Helper method to build cache entries to set after getting a bunch of responses from a DP.
|
|
25
|
-
*
|
|
26
|
-
* @param results - a list of results coming from a DataProvider
|
|
27
|
-
* @param context - context for the Adapter
|
|
28
|
-
* @returns a list of CacheEntries of AdapterResponses
|
|
29
|
-
*/
|
|
30
|
-
const buildCacheEntriesFromResults = (results, context) => results.map((r) => {
|
|
31
|
-
const cacheEntry = {
|
|
32
|
-
key: (0, cache_1.calculateCacheKey)(context, r.params),
|
|
33
|
-
value: {
|
|
34
|
-
result: r.value,
|
|
35
|
-
statusCode: 200,
|
|
36
|
-
data: {
|
|
37
|
-
result: r.value,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
if (context.adapterConfig.METRICS_ENABLED &&
|
|
42
|
-
context.adapterConfig.EXPERIMENTAL_METRICS_ENABLED) {
|
|
43
|
-
const metrics = {
|
|
44
|
-
maxAge: Date.now() + context.adapterConfig.CACHE_MAX_AGE,
|
|
45
|
-
meta: {
|
|
46
|
-
metrics: {
|
|
47
|
-
feedId: (0, cache_1.calculateFeedId)(context, r.params),
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
cacheEntry.value = { ...cacheEntry.value, ...metrics };
|
|
52
|
-
}
|
|
53
|
-
return cacheEntry;
|
|
54
|
-
});
|
|
55
|
-
exports.buildCacheEntriesFromResults = buildCacheEntriesFromResults;
|
|
56
|
-
//# sourceMappingURL=index.js.map
|
package/transports/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/transports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,oCAAgF;AAIhF,kDAA+B;AAC/B,yCAAsB;AACtB,wCAAqB;AACrB,8CAA2B;AA2F3B;;;;;;GAMG;AACI,MAAM,4BAA4B,GAAG,CAC1C,OAAiC,EACjC,OAAuC,EACoB,EAAE,CAC7D,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;IAChB,MAAM,UAAU,GAAG;QACjB,GAAG,EAAE,IAAA,yBAAiB,EAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QACzC,KAAK,EAAE;YACL,MAAM,EAAE,CAAC,CAAC,KAAK;YACf,UAAU,EAAE,GAAG;YACf,IAAI,EAAE;gBACJ,MAAM,EAAE,CAAC,CAAC,KAAK;aAChB;SACF;KACF,CAAA;IAED,IACE,OAAO,CAAC,aAAa,CAAC,eAAe;QACrC,OAAO,CAAC,aAAa,CAAC,4BAA4B,EAClD;QACA,MAAM,OAAO,GAAG;YACd,MAAM,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa;YACxD,IAAI,EAAE;gBACJ,OAAO,EAAE;oBACP,MAAM,EAAE,IAAA,uBAAe,EAAC,OAAyB,EAAE,CAAC,CAAC,MAAM,CAAC;iBAC7D;aACF;SACF,CAAA;QACD,UAAU,CAAC,KAAK,GAAG,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,GAAG,OAAO,EAAE,CAAA;KACvD;IACD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAC,CAAA;AA/BS,QAAA,4BAA4B,gCA+BrC"}
|
package/transports/metrics.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as client from 'prom-client';
|
|
2
|
-
import { AdapterContext } from '../adapter';
|
|
3
|
-
import { SettingsMap } from '../config';
|
|
4
|
-
export declare const dataProviderMetricsLabel: (providerStatusCode?: number, method?: string) => {
|
|
5
|
-
provider_status_code: number | undefined;
|
|
6
|
-
method: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const dataProviderRequests: client.Counter<"method" | "provider_status_code">;
|
|
9
|
-
export declare const dataProviderRequestDurationSeconds: client.Histogram<string>;
|
|
10
|
-
export declare const connectionErrorLabels: (message: string) => {
|
|
11
|
-
message: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const messageSubsLabels: (feed_id: string, cache_key: string) => {
|
|
14
|
-
feed_id: string;
|
|
15
|
-
subscription_key: string;
|
|
16
|
-
};
|
|
17
|
-
export declare const recordWsMessageMetrics: <AdapterParams, CustomSettings extends SettingsMap>(context: AdapterContext<CustomSettings>, subscribes: AdapterParams[], unsubscrices: AdapterParams[]) => void;
|
|
18
|
-
export declare const wsConnectionActive: client.Gauge<"url">;
|
|
19
|
-
export declare const wsConnectionErrors: client.Counter<"message" | "url">;
|
|
20
|
-
export declare const wsSubscriptionActive: client.Gauge<"feed_id" | "connection_url" | "subscription_key">;
|
|
21
|
-
export declare const wsSubscriptionTotal: client.Counter<"feed_id" | "connection_url" | "subscription_key">;
|
|
22
|
-
export declare const wsMessageTotal: client.Counter<"feed_id" | "subscription_key">;
|
|
23
|
-
export declare const bgExecuteSubscriptionSetCount: client.Gauge<"endpoint" | "transport_type">;
|
|
24
|
-
export declare const transportPollingFailureCount: client.Counter<"endpoint">;
|
|
25
|
-
export declare const transportPollingDurationSeconds: client.Gauge<"succeeded" | "endpoint">;
|
package/transports/metrics.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.transportPollingDurationSeconds = exports.transportPollingFailureCount = exports.bgExecuteSubscriptionSetCount = exports.wsMessageTotal = exports.wsSubscriptionTotal = exports.wsSubscriptionActive = exports.wsConnectionErrors = exports.wsConnectionActive = exports.recordWsMessageMetrics = exports.messageSubsLabels = exports.connectionErrorLabels = exports.dataProviderRequestDurationSeconds = exports.dataProviderRequests = exports.dataProviderMetricsLabel = void 0;
|
|
27
|
-
const client = __importStar(require("prom-client"));
|
|
28
|
-
const cache_1 = require("../cache");
|
|
29
|
-
const constants_1 = require("../metrics/constants");
|
|
30
|
-
// Data Provider Metrics
|
|
31
|
-
const dataProviderMetricsLabel = (providerStatusCode, method = 'get') => ({
|
|
32
|
-
provider_status_code: providerStatusCode,
|
|
33
|
-
method: method.toUpperCase(),
|
|
34
|
-
});
|
|
35
|
-
exports.dataProviderMetricsLabel = dataProviderMetricsLabel;
|
|
36
|
-
exports.dataProviderRequests = new client.Counter({
|
|
37
|
-
name: 'data_provider_requests',
|
|
38
|
-
help: 'The number of http requests that are made to a data provider',
|
|
39
|
-
labelNames: ['method', 'provider_status_code'],
|
|
40
|
-
});
|
|
41
|
-
exports.dataProviderRequestDurationSeconds = new client.Histogram({
|
|
42
|
-
name: 'data_provider_request_duration_seconds',
|
|
43
|
-
help: 'A histogram bucket of the distribution of data provider request durations',
|
|
44
|
-
buckets: constants_1.requestDurationBuckets,
|
|
45
|
-
});
|
|
46
|
-
// Websocket Metrics
|
|
47
|
-
const connectionErrorLabels = (message) => ({
|
|
48
|
-
// Key,
|
|
49
|
-
message,
|
|
50
|
-
});
|
|
51
|
-
exports.connectionErrorLabels = connectionErrorLabels;
|
|
52
|
-
const messageSubsLabels = (feed_id, cache_key) => ({
|
|
53
|
-
feed_id,
|
|
54
|
-
subscription_key: cache_key,
|
|
55
|
-
});
|
|
56
|
-
exports.messageSubsLabels = messageSubsLabels;
|
|
57
|
-
// Record WS message and subscription metrics
|
|
58
|
-
// Recalculate cacheKey and feedId for metrics
|
|
59
|
-
// since avoiding storing extra info in expiring sorted set
|
|
60
|
-
const recordWsMessageMetrics = (context, subscribes, unsubscrices) => {
|
|
61
|
-
subscribes.forEach((param) => {
|
|
62
|
-
const feedId = (0, cache_1.calculateFeedId)(context, param);
|
|
63
|
-
const cacheKey = (0, cache_1.calculateCacheKey)(context, param);
|
|
64
|
-
// Record total number of ws messages sent
|
|
65
|
-
exports.wsMessageTotal.labels((0, exports.messageSubsLabels)(feedId, cacheKey)).inc();
|
|
66
|
-
// Record total number of subscriptions made
|
|
67
|
-
exports.wsSubscriptionTotal.labels((0, exports.messageSubsLabels)(feedId, cacheKey)).inc();
|
|
68
|
-
// Record number of active ws subscriptions
|
|
69
|
-
exports.wsSubscriptionActive.labels((0, exports.messageSubsLabels)(feedId, cacheKey)).inc();
|
|
70
|
-
});
|
|
71
|
-
unsubscrices.forEach((param) => {
|
|
72
|
-
const feedId = (0, cache_1.calculateFeedId)(context, param);
|
|
73
|
-
const cacheKey = (0, cache_1.calculateCacheKey)(context, param);
|
|
74
|
-
// Record total number of ws messages sent
|
|
75
|
-
exports.wsMessageTotal.labels((0, exports.messageSubsLabels)(feedId, cacheKey)).inc();
|
|
76
|
-
// Record number of active ws subscriptions
|
|
77
|
-
exports.wsSubscriptionActive.labels((0, exports.messageSubsLabels)(feedId, cacheKey)).dec();
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
exports.recordWsMessageMetrics = recordWsMessageMetrics;
|
|
81
|
-
exports.wsConnectionActive = new client.Gauge({
|
|
82
|
-
name: 'ws_connection_active',
|
|
83
|
-
help: 'The number of active connections',
|
|
84
|
-
labelNames: ['url'],
|
|
85
|
-
});
|
|
86
|
-
exports.wsConnectionErrors = new client.Counter({
|
|
87
|
-
name: 'ws_connection_errors',
|
|
88
|
-
help: 'The number of connection errors',
|
|
89
|
-
labelNames: ['url', 'message'],
|
|
90
|
-
});
|
|
91
|
-
exports.wsSubscriptionActive = new client.Gauge({
|
|
92
|
-
name: 'ws_subscription_active',
|
|
93
|
-
help: 'The number of currently active subscriptions',
|
|
94
|
-
labelNames: ['connection_url', 'feed_id', 'subscription_key'],
|
|
95
|
-
});
|
|
96
|
-
exports.wsSubscriptionTotal = new client.Counter({
|
|
97
|
-
name: 'ws_subscription_total',
|
|
98
|
-
help: 'The number of subscriptions opened in total',
|
|
99
|
-
labelNames: ['connection_url', 'feed_id', 'subscription_key'],
|
|
100
|
-
});
|
|
101
|
-
exports.wsMessageTotal = new client.Counter({
|
|
102
|
-
name: 'ws_message_total',
|
|
103
|
-
help: 'The number of messages received in total',
|
|
104
|
-
labelNames: ['feed_id', 'subscription_key'],
|
|
105
|
-
});
|
|
106
|
-
// V3 specific metrics
|
|
107
|
-
exports.bgExecuteSubscriptionSetCount = new client.Gauge({
|
|
108
|
-
name: 'bg_execute_subscription_set_count',
|
|
109
|
-
help: 'The number of active subscriptions in background execute',
|
|
110
|
-
labelNames: ['endpoint', 'transport_type'],
|
|
111
|
-
});
|
|
112
|
-
exports.transportPollingFailureCount = new client.Counter({
|
|
113
|
-
name: 'transport_polling_failure_count',
|
|
114
|
-
help: 'The number of times the polling mechanism ran out of attempts and failed to return a response',
|
|
115
|
-
labelNames: ['endpoint'],
|
|
116
|
-
});
|
|
117
|
-
exports.transportPollingDurationSeconds = new client.Gauge({
|
|
118
|
-
name: 'transport_polling_duration_seconds',
|
|
119
|
-
help: 'A histogram bucket of the distribution of transport polling idle time durations',
|
|
120
|
-
labelNames: ['endpoint', 'succeeded'],
|
|
121
|
-
});
|
|
122
|
-
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/transports/metrics.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AAErC,oCAA6D;AAE7D,oDAA6D;AAE7D,wBAAwB;AACjB,MAAM,wBAAwB,GAAG,CAAC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AAC;IACnD,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE,8CAA8C;IACpD,UAAU,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,kBAAkB,CAAU;CACvE,CAAC,CAAA;AAEW,QAAA,mBAAmB,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC;IACpD,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,6CAA6C;IACnD,UAAU,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,kBAAkB,CAAU;CACvE,CAAC,CAAA;AAEW,QAAA,cAAc,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC;IAC/C,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,0CAA0C;IAChD,UAAU,EAAE,CAAC,SAAS,EAAE,kBAAkB,CAAU;CACrD,CAAC,CAAA;AAEF,sBAAsB;AACT,QAAA,6BAA6B,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC;IAC5D,IAAI,EAAE,mCAAmC;IACzC,IAAI,EAAE,0DAA0D;IAChE,UAAU,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAU;CACpD,CAAC,CAAA;AAEW,QAAA,4BAA4B,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC;IAC7D,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE,+FAA+F;IACrG,UAAU,EAAE,CAAC,UAAU,CAAU;CAClC,CAAC,CAAA;AAEW,QAAA,+BAA+B,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC;IAC9D,IAAI,EAAE,oCAAoC;IAC1C,IAAI,EAAE,iFAAiF;IACvF,UAAU,EAAE,CAAC,UAAU,EAAE,WAAW,CAAU;CAC/C,CAAC,CAAA"}
|
package/transports/rest.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { AdapterRequest, AdapterResponse } from '../util/request';
|
|
2
|
-
import { Transport } from './';
|
|
3
|
-
import { Cache } from '../cache';
|
|
4
|
-
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
5
|
-
import { AdapterConfig, SettingsMap } from '../config';
|
|
6
|
-
import { RequestRateLimiter } from '../rate-limiting';
|
|
7
|
-
import { AdapterDependencies } from '../adapter';
|
|
8
|
-
export { AxiosRequestConfig as HttpRequestConfig, AxiosResponse as HttpResponse };
|
|
9
|
-
/**
|
|
10
|
-
* Transport implementation that takes incoming requests, transforms them into a DataProvider request,
|
|
11
|
-
* and executes that request returning the response immediately from the `setup` function.
|
|
12
|
-
* Optionally, setting the `coalescing` option to `true` will make it so once a request is in flight,
|
|
13
|
-
* new adapter requests for the same feed will not trigger a new one, but return an empty promise from
|
|
14
|
-
* the setup instead so the normal cache polling mechanism is used.
|
|
15
|
-
*
|
|
16
|
-
* @typeParam AdapterParams - interface for the adapter request body
|
|
17
|
-
* @typeParam ProviderRequestBody - interface for the body of the request to the Data Provider
|
|
18
|
-
* @typeParam ProviderResponseBody - interface for the body of the Data Provider's response
|
|
19
|
-
*/
|
|
20
|
-
export declare class RestTransport<AdapterParams, ProviderRequestBody, ProviderResponseBody, CustomSettings extends SettingsMap> implements Transport<AdapterParams, ProviderResponseBody, CustomSettings> {
|
|
21
|
-
protected config: {
|
|
22
|
-
prepareRequest: (req: AdapterRequest<AdapterParams>, config: AdapterConfig<CustomSettings>) => AxiosRequestConfig<ProviderRequestBody> | Promise<AxiosRequestConfig<ProviderRequestBody>>;
|
|
23
|
-
parseResponse: (req: AdapterRequest<AdapterParams>, res: AxiosResponse<ProviderResponseBody>, config: AdapterConfig<CustomSettings>) => AdapterResponse<ProviderResponseBody> | Promise<AdapterResponse<ProviderResponseBody>>;
|
|
24
|
-
options: {
|
|
25
|
-
requestCoalescing: {
|
|
26
|
-
enabled: boolean;
|
|
27
|
-
entropyMax?: number;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
inFlightPrefix: string;
|
|
32
|
-
cache: Cache<AdapterResponse<ProviderResponseBody>>;
|
|
33
|
-
inFlightCache: Cache<boolean>;
|
|
34
|
-
rateLimiter: RequestRateLimiter;
|
|
35
|
-
constructor(config: {
|
|
36
|
-
prepareRequest: (req: AdapterRequest<AdapterParams>, config: AdapterConfig<CustomSettings>) => AxiosRequestConfig<ProviderRequestBody> | Promise<AxiosRequestConfig<ProviderRequestBody>>;
|
|
37
|
-
parseResponse: (req: AdapterRequest<AdapterParams>, res: AxiosResponse<ProviderResponseBody>, config: AdapterConfig<CustomSettings>) => AdapterResponse<ProviderResponseBody> | Promise<AdapterResponse<ProviderResponseBody>>;
|
|
38
|
-
options: {
|
|
39
|
-
requestCoalescing: {
|
|
40
|
-
enabled: boolean;
|
|
41
|
-
entropyMax?: number;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
initialize(dependencies: AdapterDependencies, config: AdapterConfig<CustomSettings>): Promise<void>;
|
|
46
|
-
protected waitUntilUnderRateLimit(options: {
|
|
47
|
-
maxRetries: number;
|
|
48
|
-
msBetweenRetries: number;
|
|
49
|
-
}, retry?: number): Promise<void>;
|
|
50
|
-
foregroundExecute(req: AdapterRequest<AdapterParams>, config: AdapterConfig<CustomSettings>): Promise<AdapterResponse<ProviderResponseBody> | undefined>;
|
|
51
|
-
}
|
package/transports/rest.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.RestTransport = void 0;
|
|
27
|
-
const util_1 = require("../util");
|
|
28
|
-
const error_1 = require("../validation/error");
|
|
29
|
-
const util_2 = require("./util");
|
|
30
|
-
const rateLimitMetrics = __importStar(require("../rate-limiting/metrics"));
|
|
31
|
-
const IN_FLIGHT_PREFIX = 'InFlight';
|
|
32
|
-
const logger = (0, util_1.makeLogger)('RestTransport');
|
|
33
|
-
/**
|
|
34
|
-
* Transport implementation that takes incoming requests, transforms them into a DataProvider request,
|
|
35
|
-
* and executes that request returning the response immediately from the `setup` function.
|
|
36
|
-
* Optionally, setting the `coalescing` option to `true` will make it so once a request is in flight,
|
|
37
|
-
* new adapter requests for the same feed will not trigger a new one, but return an empty promise from
|
|
38
|
-
* the setup instead so the normal cache polling mechanism is used.
|
|
39
|
-
*
|
|
40
|
-
* @typeParam AdapterParams - interface for the adapter request body
|
|
41
|
-
* @typeParam ProviderRequestBody - interface for the body of the request to the Data Provider
|
|
42
|
-
* @typeParam ProviderResponseBody - interface for the body of the Data Provider's response
|
|
43
|
-
*/
|
|
44
|
-
class RestTransport {
|
|
45
|
-
constructor(config) {
|
|
46
|
-
this.config = config;
|
|
47
|
-
}
|
|
48
|
-
async initialize(dependencies, config) {
|
|
49
|
-
this.inFlightPrefix = `${IN_FLIGHT_PREFIX}-`;
|
|
50
|
-
this.cache = dependencies.cache;
|
|
51
|
-
this.inFlightCache = dependencies.cache;
|
|
52
|
-
this.rateLimiter = dependencies.requestRateLimiter;
|
|
53
|
-
// Allow enabling/disabling request coalescing through env var
|
|
54
|
-
this.config.options.requestCoalescing.enabled = config.REQUEST_COALESCING_ENABLED;
|
|
55
|
-
this.config.options.requestCoalescing.entropyMax = config.REQUEST_COALESCING_ENTROPY_MAX;
|
|
56
|
-
}
|
|
57
|
-
async waitUntilUnderRateLimit(options, retry = 0) {
|
|
58
|
-
if (this.rateLimiter.isUnderLimits()) {
|
|
59
|
-
logger.trace('Incoming request would not be under limits, moving on');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
if (retry >= options.maxRetries) {
|
|
63
|
-
throw new error_1.AdapterError({
|
|
64
|
-
statusCode: 504,
|
|
65
|
-
message: `REST Transport timed out while waiting for rate limit availability (max retries: ${options.maxRetries})`,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
logger.debug(`Request would be over rate limits, sleeping for ${options.msBetweenRetries}`);
|
|
69
|
-
await (0, util_1.sleep)(options.msBetweenRetries);
|
|
70
|
-
await this.waitUntilUnderRateLimit(options, retry + 1);
|
|
71
|
-
}
|
|
72
|
-
async foregroundExecute(req, config) {
|
|
73
|
-
// Add some entropy here because of possible scenario where the key won't be set before multiple
|
|
74
|
-
// other instances in a burst request try to access the coalescing key.
|
|
75
|
-
const randomMs = Math.random() * (this.config.options.requestCoalescing.entropyMax || 0);
|
|
76
|
-
await (0, util_1.sleep)(randomMs);
|
|
77
|
-
// Check if request is in flight if coalescing is enabled
|
|
78
|
-
const inFlight = this.config.options.requestCoalescing.enabled &&
|
|
79
|
-
(await this.cache.get(this.inFlightPrefix + req.requestContext.cacheKey));
|
|
80
|
-
if (inFlight) {
|
|
81
|
-
logger.debug('Request is in flight, transport has been set up');
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
else if (this.config.options.requestCoalescing.enabled) {
|
|
85
|
-
// If it wasn't in flight and coalescing is disabled, register it as in flight
|
|
86
|
-
const ttl = config.REST_TRANSPORT_MAX_RATE_LIMIT_RETRIES *
|
|
87
|
-
config.REST_TRANSPORT_MS_BETWEEN_RATE_LIMIT_RETRIES;
|
|
88
|
-
logger.debug('Setting up rest transport, setting request in flight in cache');
|
|
89
|
-
await this.inFlightCache.set(this.inFlightPrefix + req.requestContext.cacheKey, true, ttl + 100); // Can't use Infinity for things like Redis
|
|
90
|
-
}
|
|
91
|
-
const request = await this.config.prepareRequest(req, config);
|
|
92
|
-
logger.trace('Check if we are under rate limits to perform request');
|
|
93
|
-
await this.waitUntilUnderRateLimit({
|
|
94
|
-
maxRetries: config.REST_TRANSPORT_MAX_RATE_LIMIT_RETRIES,
|
|
95
|
-
msBetweenRetries: config.REST_TRANSPORT_MS_BETWEEN_RATE_LIMIT_RETRIES,
|
|
96
|
-
});
|
|
97
|
-
logger.trace('Sending request to data provider...');
|
|
98
|
-
const providerResponse = await (0, util_2.axiosRequest)(request, config);
|
|
99
|
-
logger.debug(`Got response from provider, parsing (raw body: ${providerResponse.data})`);
|
|
100
|
-
const parsedResponse = await this.config.parseResponse(req, providerResponse, config);
|
|
101
|
-
if (config.API_VERBOSE) {
|
|
102
|
-
parsedResponse.data = providerResponse.data;
|
|
103
|
-
}
|
|
104
|
-
if (config.METRICS_ENABLED && config.EXPERIMENTAL_METRICS_ENABLED) {
|
|
105
|
-
parsedResponse.maxAge = Date.now() + config.CACHE_MAX_AGE;
|
|
106
|
-
parsedResponse.meta = {
|
|
107
|
-
metrics: { feedId: req.requestContext.meta?.metrics?.feedId || 'N/A' },
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
logger.debug('Setting provider response in cache');
|
|
111
|
-
await this.cache.set(req.requestContext.cacheKey, parsedResponse, config.CACHE_MAX_AGE);
|
|
112
|
-
// Record cost of data provider call
|
|
113
|
-
const cost = rateLimitMetrics.retrieveCost(providerResponse.data);
|
|
114
|
-
rateLimitMetrics.rateLimitCreditsSpentTotal
|
|
115
|
-
.labels({
|
|
116
|
-
feed_id: req.requestContext.meta?.metrics?.feedId || 'N/A',
|
|
117
|
-
participant_id: req.requestContext.cacheKey,
|
|
118
|
-
})
|
|
119
|
-
.inc(cost);
|
|
120
|
-
// Update cacheHit flag in request meta for metrics use
|
|
121
|
-
req.requestContext.meta = {
|
|
122
|
-
...req.requestContext.meta,
|
|
123
|
-
metrics: { ...req.requestContext.meta?.metrics, cacheHit: false },
|
|
124
|
-
};
|
|
125
|
-
if (this.config.options.requestCoalescing.enabled) {
|
|
126
|
-
logger.debug('Set provider response in cache, removing in flight from cache');
|
|
127
|
-
await this.cache.delete(this.inFlightPrefix);
|
|
128
|
-
}
|
|
129
|
-
return parsedResponse;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
exports.RestTransport = RestTransport;
|
|
133
|
-
//# sourceMappingURL=rest.js.map
|
package/transports/rest.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../../src/transports/rest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,kCAA2C;AAG3C,+CAAkD;AAClD,iCAAqC;AACrC,2EAA4D;AAK5D,MAAM,gBAAgB,GAAG,UAAU,CAAA;AAEnC,MAAM,MAAM,GAAG,IAAA,iBAAU,EAAC,eAAe,CAAC,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IAYxB,YACY,MAkBT;QAlBS,WAAM,GAAN,MAAM,CAkBf;IACA,CAAC;IAEJ,KAAK,CAAC,UAAU,CACd,YAAiC,EACjC,MAAqC;QAErC,IAAI,CAAC,cAAc,GAAG,GAAG,gBAAgB,GAAG,CAAA;QAC5C,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,KAAqD,CAAA;QAC/E,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,KAAuB,CAAA;QACzD,IAAI,CAAC,WAAW,GAA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