-
-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds an unimplemented metrics API to replace blackbox. --------- Co-authored-by: LordME <[email protected]>
- Loading branch information
Showing
10 changed files
with
164 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
code/modules/metric/metric.dm → code/modules/legacy_metric/metric.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Metrics | ||
|
||
In-dev feedback gathering system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
//* This file is explicitly licensed under the MIT license. *// | ||
//* Copyright (c) 2024 Citadel Station Developers *// | ||
|
||
/** | ||
* counter metric | ||
* | ||
* * numerical, can only go up through a round | ||
*/ | ||
/datum/metric/counter | ||
|
||
/** | ||
* increments a counter metric by an amount, defaulting to 1 | ||
* | ||
* * The time at which this is called does matter. The recorded metric will be at the current | ||
* time of the recording. | ||
* | ||
* This is what you can use for things like: | ||
* | ||
* * How many times an admin verb was pressed in a round | ||
* * How many times a thing happened in a round | ||
*/ | ||
/proc/metric_record_counter(datum/metric/counter/typepath, amount = 1) | ||
return | ||
|
||
/** | ||
* records a series of values at given times | ||
* | ||
* * Supports a number, string, or both. | ||
* | ||
* This is what you can use for things like: | ||
* | ||
* * Time dilation tracking | ||
*/ | ||
/datum/metric/series | ||
/// has numerical data to graph | ||
/// | ||
/// * doesn't limit the data, only determines if we try to pull a graph | ||
var/graph_exists = FALSE | ||
/// representation of numerical data in graph | ||
/// | ||
/// * valid values are ["average", "tally"] | ||
var/graph_collate = "tally" | ||
|
||
/** | ||
* records a number or a string in a series metric | ||
* | ||
* * The time at which this is called does matter. The recorded metric will be at the current | ||
* time of the recording. | ||
*/ | ||
/proc/metric_record_series(datum/metric/series/typepath, tally, comment) | ||
return | ||
|
||
/** | ||
* Records an event at a specific tile of a map | ||
* | ||
* * Supports a single tile event with annotation of number and/or string | ||
* * Supports a rectangular event with annotation of number and/or string | ||
* | ||
* This is usually used for game-map purposes, but is actually usable as an arbitrary | ||
* spatial metric if you need it for whatever reason. | ||
* | ||
* This is what you can use for things like: | ||
* | ||
* * Tracking where people died | ||
* * Tracking what explodes | ||
* * Tracking what goes wrong where | ||
*/ | ||
/datum/metric/spatial | ||
/// Whether the spatial metric corrosponds to the actual in-game map | ||
var/is_game_world = FALSE | ||
/// Don't render a tally of '1' | ||
var/elide_singular_tally = TRUE | ||
|
||
/proc/metric_record_spatial_single(datum/metric/spatial/typepath, x, y, level_id, tally, comment) | ||
return | ||
|
||
/proc/metric_record_spatial_box(datum/metric/spatial/typepath, x1, y1, x2, y2, level_id, tally, comment) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//* This file is explicitly licensed under the MIT license. *// | ||
//* Copyright (c) 2024 Citadel Station Developers *// | ||
|
||
/** | ||
* Describes a feedback variable. | ||
* | ||
* * All metrics should be well-formed and described in DM-code, as the DM | ||
* code is the root of trust for what something actually is. | ||
*/ | ||
/datum/metric | ||
/// id | ||
/// | ||
/// * must be unique; this should never change | ||
/// * changes require databaes migrations | ||
var/id | ||
/// fancy name | ||
/// | ||
/// * not recorded to database; external renders/access reserve the right to use | ||
/// their own names | ||
var/name | ||
/// category; string value. | ||
/// | ||
/// * this corrosponds to database-level enums, be careful with this | ||
var/category |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//* This file is explicitly licensed under the MIT license. *// | ||
//* Copyright (c) 2024 Citadel Station Developers *// | ||
|
||
/** | ||
* Base metrics recorded every round. | ||
* | ||
* This includes things required to display metrics data, like round ID, | ||
* server revision, and more. | ||
* | ||
* Any of these may be missing if we're unable to get the data. If round ID is | ||
* missing, we should just bail on metrics reporting, as round ID is an | ||
* identifying key in the metrics database. | ||
* | ||
* * Testmerges are intentionally not included as part of this. No metrics render solution | ||
* should be performing full testmerges in general; testmerge data can always | ||
* be recorded as a series data. | ||
*/ | ||
/datum/metric_base | ||
/// round ID as **string** | ||
var/round_id | ||
/// server revision hash | ||
/// | ||
/// * dependent on git; at time of writing this is SHA-1 | ||
var/commit_hash | ||
/// all valid metric ids, as a list | ||
/// | ||
/// * this is generated via typesof() | ||
var/list/metric_ids |