Skip to content

Commit 56e2a1f

Browse files
committed
Added Regex Information to custom_metrics
1 parent 2bc1c99 commit 56e2a1f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • content/en/docs/measuring/carbon

content/en/docs/measuring/carbon/sci.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ custom_metrics:
4343
calculated_prime_numbers:
4444
unit: CPN
4545
sci: True # optional. Will create an addtional metric gCO2e/CPN
46+
# regex: "^(\d{{16,19}}) {key}=(\d+)$" # You can supply a custom capture regex. By default it is a 16-19 digit timestamp followed by *metric_name*, an equal sign and a numeric value
4647

4748
flow:
4849
- name: Stress
@@ -59,6 +60,13 @@ As you can see we directly parse the output of a CLI command and the output the
5960

6061
If you have an API or similar the output might not happen on the CLI directly, but rather inside a node script or similar.
6162

63+
Custom metrics are defined under the `custom_metrics` root level key and has the following sub-keys:
64+
65+
- `metric_name` **[a-zA-Z0-9_]**: Name of the metric internally and in regex captures
66+
+ `unit` **[str]**: Name for the unit to display in frontend
67+
+ `sci` **[bool]** *(optional)*: Switch if metric should als be displayed as SCI. GMT will then divide the metric by the total carbon emissions of the run effetively returning a <custom_metric>/gCO2e
68+
+ `regex` **[regex]** *(optional)*: A catpure regex. If not supplied the default capture regex will be used: *^(\d{{16,19}}) {key}=(\d+)$* . A 16-19 digit timestamp followed by *metric_name*, an equal sign and a numeric value.
69+
6270
### Setup in config.yml
6371

6472
An [example configuration](https://github.com/green-coding-solutions/green-metrics-tool/blob/main/config.yml.example) for the `config.yml` is provided when the Green Metrics Tool is installed.

0 commit comments

Comments
 (0)