UNPKG

@splitsoftware/splitio-commons

Version:
58 lines (57 loc) 2.51 kB
import { __extends } from "tslib"; import { KeyBuilder } from './KeyBuilder'; export var METHOD_NAMES = { t: 'treatment', ts: 'treatments', tc: 'treatmentWithConfig', tcs: 'treatmentsWithConfig', tf: 'treatmentsByFlagSet', tfs: 'treatmentsByFlagSets', tcf: 'treatmentsWithConfigByFlagSet', tcfs: 'treatmentsWithConfigByFlagSets', tr: 'track' }; var KeyBuilderSS = /** @class */ (function (_super) { __extends(KeyBuilderSS, _super); function KeyBuilderSS(prefix, metadata) { var _this = _super.call(this, prefix) || this; _this.latencyPrefix = "".concat(_this.prefix, ".telemetry.latencies"); _this.exceptionPrefix = "".concat(_this.prefix, ".telemetry.exceptions"); _this.initPrefix = "".concat(_this.prefix, ".telemetry.init"); _this.versionablePrefix = "".concat(metadata.s, "/").concat(metadata.n, "/").concat(metadata.i); return _this; } KeyBuilderSS.prototype.buildRegisteredSegmentsKey = function () { return "".concat(this.prefix, ".segments.registered"); }; KeyBuilderSS.prototype.buildImpressionsKey = function () { return "".concat(this.prefix, ".impressions"); }; KeyBuilderSS.prototype.buildImpressionsCountKey = function () { return "".concat(this.prefix, ".impressions.count"); }; KeyBuilderSS.prototype.buildUniqueKeysKey = function () { return "".concat(this.prefix, ".uniquekeys"); }; KeyBuilderSS.prototype.buildEventsKey = function () { return "".concat(this.prefix, ".events"); }; KeyBuilderSS.prototype.searchPatternForDefinitionKeys = function () { return "".concat(this.buildDefinitionKeyPrefix(), "*"); }; KeyBuilderSS.prototype.searchPatternForRBSegmentKeys = function () { return "".concat(this.buildRBSegmentKeyPrefix(), "*"); }; /* Telemetry keys */ KeyBuilderSS.prototype.buildLatencyKey = function (method, bucket) { return "".concat(this.latencyPrefix, "::").concat(this.versionablePrefix, "/").concat(METHOD_NAMES[method], "/").concat(bucket); }; KeyBuilderSS.prototype.buildExceptionKey = function (method) { return "".concat(this.exceptionPrefix, "::").concat(this.versionablePrefix, "/").concat(METHOD_NAMES[method]); }; KeyBuilderSS.prototype.buildInitKey = function () { return "".concat(this.initPrefix, "::").concat(this.versionablePrefix); }; return KeyBuilderSS; }(KeyBuilder)); export { KeyBuilderSS };