Files
discord-decomp/sources/modules/monitoring/MonitoringAgent.tsx
T
2026-07-27 16:20:00 +03:00

141 lines
6.9 KiB
TypeScript

/* Metro module 4826; source: modules/monitoring/MonitoringAgent.tsx; dependencies: [6, 7, 661, 477, 4827, 4828, 27, 4829, 4830, 507, 2] */
function _fun42085(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#42085, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:6, offset: 0x0112fce4, size: 248 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = (require(661) /* metro dependency 661: Constants */).Endpoints;
const Set = global.Set;
let set = new Set(['darwin', 'linux', 'win32', 'ios', 'android']);
set = _fun42086();
set = new set();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/monitoring/MonitoringAgent.tsx');
exports.default = set;
exports.MetricType = {COUNT: 'count', DISTRIBUTION: 'distribution'};
}
function _fun42086() { // fn#42086, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:274, offset: 0x0112fddc, size: 124 bytes, params: 1, frame: 15
return env0_3(MonitoringAgent, [{key: '_getMetricWithDefaults', value: value_42090}, {key: 'increment',
value: value_42092}, {key: 'distribution', value: value_42093}, {key: '_flush', value: value_42094}]);
}
function MonitoringAgent() { // fn#42087, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:295, offset: 0x0112fe58, size: 212 bytes, params: 1, frame: 17
var environment;
const value = environment.__proto__;
env1_2(this, MonitoringAgent);
this._metrics = [];
this._intervalId = global.setInterval(_fun42088, 120000);
const {NativeModules, NativeEventEmitter} = require(27) /* metro dependency 27 */;
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
const r2 = platformUtilsModule.isAndroid() ? (require(4829) /* metro dependency 4829: NativeMetricMonitorModule */).default : NativeModules.MetricMonitor;
new NativeEventEmitter().addListener('logMetric', _fun42089);
}
function value_42090({name, tags}, a1) { // fn#42090, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:625, offset: 0x0112ff5d, size: 358 bytes, params: 3, frame: 17
var r8;
var r5;
var platformName;
var binding;
var ALL;
const object2 = {name: name, type: a1};
object2.tags = (require(4830) /* metro dependency 4830: MonitoringAgentUtils */).getGlobalTagsArray();
if (tags != null) {
tags.forEach(_fun42091);
}
if ((require(477) /* metro dependency 477: PlatformUtils */).isWeb()) {
r8 = 'web';
} else {
platformName = (require(477) /* metro dependency 477: PlatformUtils */).getPlatformName();
binding = env1_5;
r8 = binding.has(platformName) ? platformName : null;
}
if (r8 != null) {
object2.tags.push('platform:' + r8);
}
const CurrentReleaseChannel = (require(4827) /* metro dependency 4827: ReleaseChannelUtilsNative */).CurrentReleaseChannel;
if (CurrentReleaseChannel != null) {
ALL = (require(4828) /* metro dependency 4828: ReleaseChannels */).ReleaseChannelsSets.ALL;
r5 = ALL.has(CurrentReleaseChannel) ? CurrentReleaseChannel : null;
} else {
r5 = null;
}
if (r5 != null) {
object2.tags.push('release_channel:' + r5);
}
return object2;
}
function value_42092(a0) { // fn#42092, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:1126, offset: 0x011300e1, size: 94 bytes, params: 2, frame: 15
let value = a1;
let r1 = value !== undefined ? value : false;
const _getMetricWithDefaults = this._getMetricWithDefaults;
value = environment.__proto__;
const COUNT = env1_6.COUNT;
this._metrics.push(Reflect.apply(_getMetricWithDefaults, this, [a0, COUNT]));
r1 = !r1 ? this._metrics.length >= 100 : r1;
if (r1) {
this._flush();
}
}
function value_42093(a0, a1) { // fn#42093, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:1284, offset: 0x0113013f, size: 115 bytes, params: 3, frame: 16
let value = a2;
let r1 = value !== undefined ? value : false;
const object2 = {};
const _getMetricWithDefaults = this._getMetricWithDefaults;
value = environment.__proto__;
const DISTRIBUTION = env1_6.DISTRIBUTION;
copyDataProperties(object2, Reflect.apply(_getMetricWithDefaults, this, [a0, DISTRIBUTION]), _getMetricWithDefaults);
object2['value'] = a1;
this._metrics.push(object2);
r1 = !r1 ? this._metrics.length >= 100 : r1;
if (r1) {
this._flush();
}
}
function value_42094() { // fn#42094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:1458, offset: 0x011301b2, size: 183 bytes, params: 1, frame: 17
var environment;
var items2;
var value;
let _metrics = this._metrics;
if (_metrics.length > 0) {
_metrics = this._metrics;
items2 = [];
arraySpread(items2, _metrics, 0, items2);
value = environment.__proto__;
value = (require(507) /* metro dependency 507: HTTPUtils */).HTTP.post({url: Endpoints.METRICS_V2,
body: {metrics: items2, client_info: {'built_at': '1782519704961', 'build_number': '5867'}}, retries: 1,
rejectWithError: true});
value.catch(_fun42095);
}
this._metrics = [];
}
function _fun42088() { // fn#42088, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:393, offset: 0x0112ff2c, size: 21 bytes, params: 1, frame: 9
env0_0._flush();
}
function _fun42089(a0) { // fn#42089, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:558, offset: 0x0112ff41, size: 28 bytes, params: 2, frame: 13
env0_0.increment(a0, false);
}
function _fun42091(a0) { // fn#42091, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:733, offset: 0x011300c3, size: 30 bytes, params: 2, frame: 11
env0_0.tags.push(a0);
}
function _fun42095() { // fn#42095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5004:1671, offset: 0x01130269, size: 82 bytes, params: 1, frame: 15
var binding;
var items2;
let _metrics = env0_0._metrics;
if (_metrics.length + env0_1.length < 100) {
binding = env0_0;
_metrics = binding._metrics;
items2 = [];
arraySpread(items2, env0_1, arraySpread(items2, _metrics, 0, undefined), undefined);
binding._metrics = items2;
}
}