mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-19 14:51:27 +00:00
* CI change * world.dm * .dme world.dm * subsystem renaming * .dme for subsystems * ai_laws.dm * armor.dm * emote.dm * logging.dm * spell.dm * air_alarm.dm * crew.dm * decal.dm * emissive_blocker.dm * footstep.dm * spawner.dm * fire.dm * carbon.dm * living.dm * mob.dm * movement.dm * thermal_drill.dm * plasmamen.dm * lavaland.dm * chaplain.dm * lightning.dm * magnet.dm * mimic.dm * wizard.dm * morph.dm * vampire.dm * click.dm * self.dm * radiation_storm.dm * airlock.dm * autolathe.dm * mulebot.dm * nuclearbomb.dm * particle_accelerator.dm * smartfridge.dm * syndicatebomb.dm * vending.dm * wires.dm * sound.dm * mining.dm * syndicate_space_base.dm * monkey.dm * guardian.dm * bomb.dm * standard.dm * nuclear.dm * pinpointer.dm * access.dm * departments.dm * job.dm * science.dm * buttons.dm * cloning.dm * igniter.dm * wishgranter.dm * atmos_control.dm * message.dm * power_monitor.dm * mecha.dm * combat.dm * mining_tools.dm * meteors.dm * spiders.dm * contraband.dm * aliens.dm * uplinks.dm * voice.dm * intercom.dm * lights.dm * robot_items.dm * mineral.dm * dice.dm * extinguisher.dm * paint.dm * signs.dm * staff.dm * smokebomb.dm * boxes.dm * random.dm * janicart.dm * statue.dm * cargo.dm * asteroid.dm * headslug.dm * fulton.dm * atmospherics.dm * pump.dm * corpse.dm * oldstation.dm * gps.dm * preferences.dm * clothing.dm * ears.dm * glasses.dm * boxing.dm * color.dm * renames ninja gear files * recipes.dm * error_handler.dm * anomaly.dm * floorcluwne.dm * undead.dm * overmind.dm * shield.dm * bottle.dm * organ.dm * piano.dm * plasma_fist.dm * language.dm * mob_defines.dm * mob_helpers.dm * damage_procs.dm * _defines.dm * empress.dm and queen.dm * brain.dm * organ file renaming * subsystems.dm * constructs.dm * bot.dm * pet.dm * nature.dm * magic.dm * colors.dm * drugs.dm * medicine.dm * toxins.dm * shuttle.dm * surgery.dm * moves a bunch of define files * traits.dm * names.dm * other_mobs.dm * flags.dm * some final define files * well turns out contractor_pinpointer.dm was taken * I forgot to remove this file * how in the hell did this get unticked * I DID INCLUDE IT, but there was a "w" there * swaps the world definitions * camera renamed to SScamera * examine -> alien_examine
49 lines
2.0 KiB
Plaintext
49 lines
2.0 KiB
Plaintext
SUBSYSTEM_DEF(metrics)
|
|
name = "Metrics"
|
|
wait = 30 SECONDS
|
|
offline_implications = "Server metrics will no longer be ingested into monitoring systems. No immediate action is needed."
|
|
runlevels = RUNLEVEL_LOBBY | RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME // ALL THE LEVELS
|
|
flags = SS_KEEP_TIMING // This needs to ingest every 30 IRL seconds, not ingame seconds.
|
|
cpu_display = SS_CPUDISPLAY_LOW
|
|
/// The real time of day the server started. Used to calculate time drift
|
|
var/world_init_time = 0 // Not set in here. Set in world/New()
|
|
|
|
/datum/controller/subsystem/metrics/Initialize()
|
|
if(!GLOB.configuration.metrics.enable_metrics)
|
|
flags |= SS_NO_FIRE // Disable firing to save CPU
|
|
|
|
|
|
/datum/controller/subsystem/metrics/fire(resumed)
|
|
SShttp.create_async_request(RUSTG_HTTP_METHOD_POST, GLOB.configuration.metrics.metrics_endpoint, get_metrics_json(), list(
|
|
"Authorization" = "ApiKey [GLOB.configuration.metrics.metrics_api_token]",
|
|
"Content-Type" = "application/json"
|
|
))
|
|
|
|
/datum/controller/subsystem/metrics/proc/get_metrics_json()
|
|
var/list/out = list()
|
|
out["@timestamp"] = time_stamp() // This is required by ElasticSearch, complete with this name. DO NOT REMOVE THIS.
|
|
out["cpu"] = world.cpu
|
|
out["maptick"] = world.map_cpu
|
|
out["elapsed_processed"] = world.time
|
|
out["elapsed_real"] = (REALTIMEOFDAY - world_init_time)
|
|
out["client_count"] = length(GLOB.clients)
|
|
out["round_id"] = text2num(GLOB.round_id) // This is so we can filter the metrics by a single round ID
|
|
out["server_id"] = GLOB.configuration.system.instance_id // And this is so we can filter by instance ID
|
|
|
|
// Funnel in all SS metrics
|
|
var/list/ss_data = list()
|
|
for(var/datum/controller/subsystem/SS in Master.subsystems)
|
|
ss_data[SS.ss_id] = SS.get_metrics()
|
|
|
|
out["subsystems"] = ss_data
|
|
// And send it all
|
|
return json_encode(out)
|
|
|
|
/*
|
|
|
|
// Uncomment this if you add new metrics to verify how the JSON formats
|
|
|
|
/client/verb/debugmetricts()
|
|
usr << browse(SSmetrics.get_metrics_json(), "window=aadebug")
|
|
*/
|