@splitsoftware/splitio-commons
Version:
Split JavaScript SDK common components
58 lines (57 loc) • 2.31 kB
JavaScript
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 = _this.prefix + ".telemetry.latencies";
_this.exceptionPrefix = _this.prefix + ".telemetry.exceptions";
_this.initPrefix = _this.prefix + ".telemetry.init";
_this.versionablePrefix = metadata.s + "/" + metadata.n + "/" + metadata.i;
return _this;
}
KeyBuilderSS.prototype.buildRegisteredSegmentsKey = function () {
return this.prefix + ".segments.registered";
};
KeyBuilderSS.prototype.buildImpressionsKey = function () {
return this.prefix + ".impressions";
};
KeyBuilderSS.prototype.buildImpressionsCountKey = function () {
return this.prefix + ".impressions.count";
};
KeyBuilderSS.prototype.buildUniqueKeysKey = function () {
return this.prefix + ".uniquekeys";
};
KeyBuilderSS.prototype.buildEventsKey = function () {
return this.prefix + ".events";
};
KeyBuilderSS.prototype.searchPatternForSplitKeys = function () {
return this.buildSplitKeyPrefix() + "*";
};
KeyBuilderSS.prototype.searchPatternForRBSegmentKeys = function () {
return this.buildRBSegmentKeyPrefix() + "*";
};
/* Telemetry keys */
KeyBuilderSS.prototype.buildLatencyKey = function (method, bucket) {
return this.latencyPrefix + "::" + this.versionablePrefix + "/" + METHOD_NAMES[method] + "/" + bucket;
};
KeyBuilderSS.prototype.buildExceptionKey = function (method) {
return this.exceptionPrefix + "::" + this.versionablePrefix + "/" + METHOD_NAMES[method];
};
KeyBuilderSS.prototype.buildInitKey = function () {
return this.initPrefix + "::" + this.versionablePrefix;
};
return KeyBuilderSS;
}(KeyBuilder));
export { KeyBuilderSS };