initial modifications, needs testing

This commit is contained in:
2023-07-09 15:22:26 -07:00
parent fbf6ce98b2
commit 31ffadf1b1
47 changed files with 1726 additions and 299 deletions

View File

@@ -0,0 +1,86 @@
/* Code generated by cmd/cgo; DO NOT EDIT. */
/* package main */
#line 1 "cgo-builtin-export-prolog"
#include <stddef.h> /* for ptrdiff_t below */
#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
#endif
#endif
/* Start of preamble from import "C" comments. */
#line 3 "arma.go"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "extensionCallback.h"
#line 1 "cgo-generated-wrapper"
/* End of preamble from import "C" comments. */
/* Start of boilerplate cgo prologue. */
#line 1 "cgo-gcc-export-header-prolog"
#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H
typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef __SIZE_TYPE__ GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
/*
static assertion to make sure the file is being used on architecture
at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
#endif
/* End of boilerplate cgo prologue. */
#ifdef __cplusplus
extern "C" {
#endif
extern __declspec(dllexport) void goRVExtensionVersion(char* output, size_t outputsize);
extern __declspec(dllexport) void goRVExtensionArgs(char* output, size_t outputsize, char* input, char** argv, int argc);
extern __declspec(dllexport) void goRVExtension(char* output, size_t outputsize, char* input);
extern __declspec(dllexport) void goRVExtensionRegisterCallback(extensionCallback fnc);
#ifdef __cplusplus
}
#endif

View File

@@ -70,11 +70,9 @@ class CfgFunctions {
class postInit { postInit = 1; };
class captureLoop {};
class log {};
class queue {};
class send {};
class sendClientPoll {};
class startServerPoll {};
class classHandlers {};
class initCapture {};
};
class helpers {

View File

@@ -30,14 +30,6 @@ try {
switch (_function) do {
case "deinitExtension": {
// Our first call is deinitExtension. When we received a single "true" value, we can then run init processes for the extension connections.
if ((_response select 0) isEqualTo true) then {
"RangerMetrics" callExtension "initExtension";
} else {
_response call RangerMetrics_fnc_log;
};
};
case "loadSettingsJSON": {
[_function, _response] call RangerMetrics_callback_fnc_loadSettings;
};

View File

@@ -38,7 +38,7 @@ switch (_data select 0) do {
"Setting loaded: %1",
_data
],
"INFO"
"DEBUG"
] call RangerMetrics_fnc_log;
};
@@ -46,7 +46,7 @@ switch (_data select 0) do {
default {
[
_data select 0,
"INFO"
"DEBUG"
] call RangerMetrics_fnc_log;
};
};

View File

@@ -41,7 +41,7 @@ private _allPlayers = call BIS_fnc_listPlayers;
(_x isKindOf "WeaponHolderSimulated")
} count _vehicles]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
// Number of local units
[
@@ -73,7 +73,7 @@ private _allPlayers = call BIS_fnc_listPlayers;
(_x isKindOf "WeaponHolderSimulated")
} count _vehicles]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
// Number of global units - only track on server
if (isServer) then {
@@ -109,7 +109,7 @@ private _allPlayers = call BIS_fnc_listPlayers;
!alive _x
} count _allPlayers]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
};
} forEach [east, west, independent, civilian];
@@ -129,5 +129,5 @@ if (isServer) then {
} else {false}
} count _allPlayers]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
};

View File

@@ -161,7 +161,7 @@ private _propertyValues = createHashMap;
["category", _measurementCategory]
],
_fieldsWithType
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
} forEach _propertyValues;

View File

@@ -80,4 +80,4 @@ if (_roleDescription isNotEqualTo "") then {
],
_fields,
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -20,6 +20,6 @@ private _settings = RangerMetrics_recordingSettings get "playerPerformance";
["float", "desync", _desync]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
} forEach (allUsers apply {getUserInfo _x});

View File

@@ -15,4 +15,4 @@ private _settings = RangerMetrics_recordingSettings get "playerStatus";
["string", "profileName", _profileName]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -25,4 +25,4 @@ private _settings = RangerMetrics_recordingSettings get "runningMission";
],
["profile", "server", "world"] // context
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -17,4 +17,4 @@ private _settings = RangerMetrics_recordingSettings get "runningScripts";
} else {0}
]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -8,4 +8,4 @@ private _settings = RangerMetrics_recordingSettings get "serverPerformance";
nil, [
["float", "fps_avg", diag_fps toFixed 2],
["float", "fps_min", diag_fpsMin toFixed 2]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;

View File

@@ -12,4 +12,4 @@ private _settings = RangerMetrics_recordingSettings get "serverTime";
["float", "timeMultiplier", timeMultiplier toFixed 2],
["float", "accTime", accTime toFixed 2]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -51,7 +51,7 @@ if (_unitId isEqualTo -1) exitWith {false};
],
_classItemCounts,
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
// prep displayName by fetching from configs
_displayItemCounts = [];
@@ -91,7 +91,7 @@ _displayItemCounts = [];
],
_displayItemCounts,
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
true;
@@ -186,7 +186,7 @@ true;
// ],
// _x,
// ["server"]
// ] call RangerMetrics_fnc_queue;
// ] call RangerMetrics_fnc_send;
// } forEach [
// _primaryWeapon,
// _secondaryWeapon,

View File

@@ -78,4 +78,4 @@ private _playerTraits = getAllUnitTraits _unit;
],
_fields,
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -10,4 +10,4 @@ private _settings = RangerMetrics_recordingSettings get "viewDistance";
["float", "objectViewDistance", getObjectViewDistance # 0],
["float", "viewDistance", viewDistance]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -20,4 +20,4 @@ private _settings = RangerMetrics_recordingSettings get "weather";
["float", "moonPhase", moonPhase date],
["float", "sunOrMoon", sunOrMoon]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -40,4 +40,4 @@ if (name _killed != "") then {
_tags,
_fields,
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -30,4 +30,4 @@ private _unitPlayerUID = _userInfo select 2;
["float", "damage", _damage]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -24,4 +24,4 @@ private _userInfo = getUserInfo _unitPlayerId;
["string", "vehicleClass", typeOf _vehicle]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -37,4 +37,4 @@ if (_playerUID isNotEqualTo "") then {
nil,
_fields,
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -27,4 +27,4 @@ if (_ownerUID isEqualTo "") exitWith {};
["string", "owner", _ownerUID]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -28,4 +28,4 @@ if (_ownerUID isEqualTo "") then {
["string", "owner", _ownerUID]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -16,5 +16,5 @@ private _markerData = _marker call BIS_fnc_markerToString;
["string", "marker", _markerData]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -17,6 +17,6 @@ if (_unitUID isEqualTo "") exitWith {false};
["float", "health", 1 - (damage _unit)],
["bool", "state", _unconscious]
]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
true;

View File

@@ -14,4 +14,4 @@ private _settings = RangerMetrics_recordingSettings get "CBAEventHandlers" get "
nil,
_fields,
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;

View File

@@ -13,7 +13,7 @@
["string", "networkId", _networkId],
["int", "clientStateNumber", _clientStateNumber],
["string", "clientState", _clientState]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;
[format ["(EventHandler) OnUserConnected fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
}],
["OnUserDisconnected", {
@@ -30,7 +30,7 @@
["string", "networkId", _networkId],
["int", "clientStateNumber", _clientStateNumber],
["string", "clientState", _clientState]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;
[format ["(EventHandler) OnUserDisconnected fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
}],
["PlayerConnected", {
@@ -48,7 +48,7 @@
["bool", "jip", _jip],
["int", "owner", _owner],
["string", "idstr", _idstr]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;
[format ["(EventHandler) PlayerConnected fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
}],
["HandleDisconnect", {
@@ -64,7 +64,7 @@
["string", "id", _id toFixed 0],
["string", "uid", _uid],
["string", "name", _name]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;
[format ["(EventHandler) HandleDisconnect fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
false;
}],
@@ -78,7 +78,7 @@
["string", "networkId", _networkId],
["int", "clientStateNumber", _clientStateNumber],
["string", "clientState", _clientState]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;
[format ["(EventHandler) OnUserClientStateChanged fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
}],
["OnUserAdminStateChanged", {
@@ -92,7 +92,7 @@
["string", "networkId", _networkId],
["bool", "loggedIn", _loggedIn],
["bool", "votedIn", _votedIn]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;
[format ["(EventHandler) OnUserAdminStateChanged fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
}],
["OnUserKicked", {
@@ -109,7 +109,7 @@
["string", "kickType", _kickType],
["string", "kickReason", _kickReason],
["string", "kickMessageIncReason", _kickMessageIncReason]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;
[format ["(EventHandler) OnUserKicked fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
}],
["HandleChatMessage", {
@@ -124,7 +124,7 @@
["server_events", "MPEnded", nil, [
["string", "winner", _winner],
["string", "reason", _reason]
]] call RangerMetrics_fnc_queue;
]] call RangerMetrics_fnc_send;
call RangerMetrics_capture_fnc_running_mission;
[format ["(EventHandler) MPEnded fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
}],
@@ -196,7 +196,7 @@
// ["bool", "autoSupply", _autoSupply]
// ],
// nil
// ] call RangerMetrics_fnc_queue;
// ] call RangerMetrics_fnc_send;
// [format["(EventHandler) Service fired: %1", _this], "DEBUG"] call RangerMetrics_fnc_log;
// }]
]

View File

@@ -69,7 +69,7 @@ if (RangerMetrics_aceMedicalPresent) then {
// ["string", "projectile", _projectile]
// ],
// ["server"]
// ] call RangerMetrics_fnc_queue;
// ] call RangerMetrics_fnc_send;
// [_unit] call RangerMetrics_capture_fnc_unit_state;
// }];
@@ -103,7 +103,7 @@ _handle = _unit addEventHandler ["GetInMan", {
["string", "turret", _turret]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
[_unit] call RangerMetrics_capture_fnc_unit_state;
}];
@@ -133,7 +133,7 @@ _handle = _unit addEventHandler ["GetOutMan", {
["string", "turret", _turret]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
[_unit] call RangerMetrics_capture_fnc_unit_state;
}];
@@ -163,7 +163,7 @@ _handle = _unit addEventHandler ["HandleScore", {
["string", "object", [configOf _object] call BIS_fnc_displayName]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
nil;
}];
@@ -192,7 +192,7 @@ _handle = _unit addEventHandler ["InventoryClosed", {
["string", "container", _container]
],
["server"]
] call RangerMetrics_fnc_queue;
] call RangerMetrics_fnc_send;
[_unit] call RangerMetrics_capture_fnc_unit_inventory;
nil;

View File

@@ -1,38 +0,0 @@
if (!isServer) exitWith {};
if (!RangerMetrics_cbaPresent) exitWith {
[
format["RangerMetrics: CBA not present, aborting class EHs."],
"WARN"
] call RangerMetrics_fnc_log;
false;
// TODO: Add non-CBA compatibility for unit handler & id application
// addMissionEventHandler ["EntityCreated", {
};
///////////////////////////////////////////////////////////////////////
// Initialize all units
///////////////////////////////////////////////////////////////////////
["Man", "InitPost", {
params ["_unit"];
[_unit] call RangerMetrics_cDefinitions_fnc_unit_handlers;
_unit setVariable [
"RangerMetrics_id",
RangerMetrics_nextID,
true
];
[_unit] call RangerMetrics_capture_fnc_unit_inventory;
[_unit] call RangerMetrics_capture_fnc_unit_state;
if (RangerMetrics_debug) then {
[
format["ID %1, Object %2 (%3)", RangerMetrics_nextID, _unit, [configOf _unit] call BIS_fnc_displayName],
"DEBUG"
] call RangerMetrics_fnc_log;
};
RangerMetrics_nextID = RangerMetrics_nextID + 1;
}, nil, nil, true] call CBA_fnc_addClassEventHandler;

View File

@@ -1,3 +1,5 @@
if (!isServer) exitWith {};
params [["_text","Log text invalid"], ["_logType","DEBUG"]];
if (typeName _this != "ARRAY") exitWith {
@@ -19,24 +21,8 @@ private _textFormatted = format [
"[%1] %2: %3",
RangerMetrics_logPrefix,
_logType,
_text];
_text
];
if(isServer) then {
diag_log text _textFormatted;
if(isMultiplayer) then {
_playerIds = [];
{
_player = _x;
_ownerId = owner _player;
if(_ownerId > 0) then {
if(getPlayerUID _player in ["76561198013533294"]) then {
_playerIds pushBack _ownerId;
};
};
} foreach allPlayers;
if(count _playerIds > 0) then {
[_textFormatted] remoteExec ["diag_log", _playerIds];
};
};
};
diag_log text _textFormatted;

View File

@@ -3,24 +3,21 @@
if (is3DEN || !isMultiplayer) exitWith {};
if (!isServer && hasInterface) exitWith {};
RangerMetrics = false call CBA_fnc_createNamespace;
RangerMetrics_cbaPresent = isClass(configFile >> "CfgPatches" >> "cba_main");
RangerMetrics_aceMedicalPresent = isClass(configFile >> "CfgPatches" >> "ace_medical_status");
RangerMetrics_logPrefix = "RangerMetrics";
RangerMetrics_debug = false;
RangerMetrics_initialized = false;
RangerMetrics_run = true;
RangerMetrics_nextID = 0;
RangerMetrics_messageQueue = createHashMap;
// for debug, view messages in queue
// RangerMetrics_messageQueue apply {[_x, count _y]};
RangerMetrics_sendBatchHandle = scriptNull;
RangerMetrics_settings = createHashMap;
RangerMetrics_recordingSettings = createHashMap;
[format ["Instance name: %1", profileName]] call RangerMetrics_fnc_log;
[format ["CBA detected: %1", RangerMetrics_cbaPresent]] call RangerMetrics_fnc_log;
["Initializing v0.0.2"] call RangerMetrics_fnc_log;
["Initializing v0.0.3"] call RangerMetrics_fnc_log;
// Create listener - extension calls are async, so we need to listen for the response
addMissionEventHandler [
@@ -29,24 +26,4 @@ addMissionEventHandler [
];
// Deinit to start fresh. See callback handler for the remainder of async init code
"RangerMetrics" callExtension "deinitExtension";
if (true) exitWith {};
[] spawn {
sleep 1;
isNil {
// set up CBA class inits if CBA loaded
call RangerMetrics_fnc_classHandlers;
};
};
"RangerMetrics" callExtension "initExtension";

View File

@@ -1,65 +0,0 @@
params [
["_bucket", "default", [""]],
"_measurement",
["_tags", [], [[], nil]],
["_fields", [], [[], nil]],
["_tagContext", ["profile", "server"], [[]]]
];
// format[
// "profile=%1,world=%2,%3",
// profileName,
// toLower worldName,
// (_tags apply {format['%1=%2', _x#0, _x#1]}) joinString ","
// ],
if (_tagContext find "profile" > -1) then {
_tags pushBack ["string", "profileName", profileName];
};
if (_tagContext find "world" > -1) then {
_tags pushBack ["string", "world", toLower worldName];
};
if (_tagContext find "server" > -1) then {
private _serverProfile = missionNamespace getVariable [
"RangerMetrics_serverProfileName",
""
];
if (_serverProfile isNotEqualTo "") then {
_tags pushBack [
"string",
"connectedServer",
_serverProfile
];
};
};
private _outTags = _tags apply {
[_x, "tag"] call RangerMetrics_fnc_toLineProtocol
} select {!isNil "_x"};
// having no tags is OK
_outTags = _outTags joinString ",";
private _outFields = _fields apply {
[_x, "field"] call RangerMetrics_fnc_toLineProtocol
} select {!isNil "_x"};
// having no fields will cause an error
if (count _outFields isEqualTo 0) exitWith {};
_outFields = _outFields joinString ",";
private _extSend = format [
"%1,%2 %3 %4",
_measurement, // metric name
_outTags,
_outFields,
call RangerMetrics_fnc_unixTimestamp
];
// add to queue
(RangerMetrics_messageQueue getOrDefault [_bucket, [], true]) pushBack _extSend;
true

View File

@@ -1,66 +1,63 @@
// send the data
// duplicate the message queue so we can clear it before sending the data
private "_extSend";
// isNil {
// _extSend = + RangerMetrics_messageQueue;
// RangerMetrics_messageQueue = createHashMap;
// };
params [
["_bucket", "default", [""]],
"_measurement",
["_tags", [], [[], nil]],
["_fields", [], [[], nil]],
["_tagContext", ["profile", "server"], [[]]]
];
// debug
if (
missionNamespace getVariable ["RangerMetrics_debug",false]
) then {
["Sending a3influx data", "DEBUG"] call RangerMetrics_fnc_log;
// format[
// "profile=%1,world=%2,%3",
// profileName,
// toLower worldName,
// (_tags apply {format['%1=%2', _x#0, _x#1]}) joinString ","
// ],
if (_tagContext find "profile" > -1) then {
_tags pushBack ["string", "profileName", profileName];
};
if (_tagContext find "world" > -1) then {
_tags pushBack ["string", "world", toLower worldName];
};
if (_tagContext find "server" > -1) then {
private _serverProfile = missionNamespace getVariable [
"RangerMetrics_serverProfileName",
""
];
if (_serverProfile isNotEqualTo "") then {
_tags pushBack [
"string",
"connectedServer",
_serverProfile
];
};
};
{
// run in direct unscheduled call
// prevents race condition accessing hashmap
isNil {
private _bucket = _x;
private _batchSize = 2000;
private _outTags = _tags apply {
[_x, "tag"] call RangerMetrics_fnc_toLineProtocol
} select {!isNil "_x"};
// having no tags is OK
// get the records for this bucket
private "_records";
private _records = RangerMetrics_messageQueue get _bucket;
_outTags = _outTags joinString ",";
// send the data in chunks
private _processing = _records select [0, (count _records -1) min _batchSize];
RangerMetrics_messageQueue set [
_bucket,
(RangerMetrics_messageQueue get _bucket) - _processing
];
private _outFields = _fields apply {
[_x, "field"] call RangerMetrics_fnc_toLineProtocol
} select {!isNil "_x"};
// having no fields will cause an error
if (count _outFields isEqualTo 0) exitWith {};
// send the data
if (
missionNamespace getVariable ["RangerMetrics_debug",false]
) then {
[format ["Bucket: %1, RecordsCount: %2", _bucket, count _processing], "DEBUG"] call RangerMetrics_fnc_log;
_outFields = _outFields joinString ",";
// get unique measurement IDs
private _measurements = [];
{
_thisMeasurement = _x splitString "," select 0;
_measurements pushBackUnique _thisMeasurement;
} forEach _processing;
private _extSend = format [
"%1,%2 %3 %4",
_measurement, // metric name
_outTags,
_outFields,
call RangerMetrics_fnc_unixTimestamp
];
// get counts of each measurement
private _measurementCounts = [];
{
private _measurement = _x;
_measurementCounts pushBack [
_measurement,
count (_measurements select {_x == _measurement})
];
} forEach _measurements;
"RangerMetrics" callExtension ["sendToInflux", [_bucket, _extSend]];
[format ["Measurements: %1", _measurementCounts], "DEBUG"] call RangerMetrics_fnc_log;
};
"RangerMetrics" callExtension ["sendToInflux", flatten [_bucket, _processing]];
};
} forEach (keys RangerMetrics_messageQueue);
true;

View File

@@ -13,40 +13,40 @@ if (_interval == 0) exitWith {
};
// run a constant scheduled loop
private _runnerVar = "RangerMetrics" + "_serverPollRunner_" + _refName;
missionNamespace setVariable [_runnerVar, scriptNull];
private _spawnParams = [_refName, _code, _interval, _runnerVar];
private _handle = _spawnParams spawn {
params ["_refName", "_code", "_interval", "_runnerVar"];
while {true} do {
if (scriptDone (
missionNamespace getVariable _runnerVar
)) then {
private _handle = [] spawn _code;
missionNamespace setVariable [
_runnerVar,
_handle
];
};
// sleep _interval;
sleep 2;
};
};
missionNamespace setVariable [
"RangerMetrics" + "_serverPoll_" + _refName,
_handle
];
// USE PFH
// private _handle = [{
// params ["_args", "_idPFH"];
// _args params ["_refName", "_code"];
// [_code] call CBA_fnc_execNextFrame;
// }, _interval, _this] call CBA_fnc_addPerFrameHandler;
// private _runnerVar = "RangerMetrics" + "_serverPollRunner_" + _refName;
// missionNamespace setVariable [_runnerVar, scriptNull];
// private _spawnParams = [_refName, _code, _interval, _runnerVar];
// private _handle = _spawnParams spawn {
// params ["_refName", "_code", "_interval", "_runnerVar"];
// while {true} do {
// if (scriptDone (
// missionNamespace getVariable _runnerVar
// )) then {
// private _handle = [] spawn _code;
// missionNamespace setVariable [
// _runnerVar,
// _handle
// ];
// };
// // sleep _interval;
// sleep 2;
// };
// };
// missionNamespace setVariable [
// "RangerMetrics" + "_serverPoll_" + _refName,
// _handle
// ];
// ];
// USE PFH
private _handle = [{
params ["_args", "_idPFH"];
_args params ["_refName", "_code"];
[_code] call CBA_fnc_execNextFrame;
}, _interval, _this] call CBA_fnc_addPerFrameHandler;
missionNamespace setVariable [
"RangerMetrics" + "_serverPoll_" + _refName,
_handle
];

View File

@@ -5,12 +5,6 @@
"token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX_AUTH_TOKEN_XXXXXXXXXXXXXXXXXXXXXXXXXXX",
"org": "ORG_NAME"
},
"timescaledb": {
"enabled": false,
"connectionUrl": "postgresql://user:pass@host.com:5432",
"databaseName": "ranger_metrics",
"description": "TimescaleDB is an open-source time-series database built on Postgres. The extension will connect to the maintenance database (postgres) first and create the database it will control with desired name, then shift connections to the newly created database to create the schema and conduct write operations."
},
"arma3": {
"refreshRateMs": 1000,
"debug": false