Skip to content

Commit 968a66a

Browse files
author
Aditya Abhishek
committed
add doc
1 parent c5e418f commit 968a66a

1 file changed

Lines changed: 61 additions & 2 deletions

File tree

website/docs/guides/0221-usage-extensions.md

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,9 @@ and requirements.
471471
* [Geekbench Workload Metrics](https://microsoft.github.io/VirtualClient/docs/workloads/geekbench/)
472472

473473
Virtual Client provides a facility for script-based automation to emit metrics for capture as well. To enable metrics capture, scripts emit the metrics to a single/central file on the file
474-
system. The file should be named ```test-metrics.json``` and should exist in the same directory as the script that generated it. The file contents should be a simple JSON-formatted structure
475-
as illustrated below. Virtual Client will read this file and upload the metrics defined within alongside any out-of-box metrics already captured.
474+
system. The file should be named ```test-metrics.json``` and should exist in the same directory as the script that generated it. There are two acceptable formats for test-metrics.json.
475+
476+
* The file contents are a simple JSON-formatted structure as illustrated below. Virtual Client will read this file and upload the metrics defined within, alongside any out-of-box metrics already captured.
476477

477478
``` json
478479
# Example contents of the 'test-metrics.json' file. Simple key/value pairs. This file should
@@ -489,6 +490,64 @@ and requirements.
489490
}
490491
```
491492

493+
* The file contents are formatted as a JSON array as illustrated below. Virtual Client will read this file and upload the metrics defined within, alongside any out-of-box metrics already captured.
494+
495+
``` json
496+
# Example contents of the 'test-metrics.json' file. JSON Array based structure. This file should
497+
# be written to the same directory where the script that generated it exists. Here, 'metricName' and 'metricValue' are mandatory fields, while 'metricUnit' and 'metricMetadata' are optional. The field 'metricMetadata' can be used to provide additional information about the metric, such as the source of the metric or any other relevant context. It is a key-value pair structure.
498+
#
499+
# e.g.
500+
# Given a script /any.script.extensions.1.0.0/linux-x64/install.py, the file should be
501+
# written to /any.script.extensions.1.0.0/linux-x64/test-metrics.json
502+
503+
[
504+
{
505+
"metricName": "metric1",
506+
"metricValue": 0,
507+
"metricUnit": "unit1",
508+
"metricMetadata": {
509+
"metadata1": "m1",
510+
"metadata2": "m2"
511+
}
512+
},
513+
{
514+
"metricName": "metric2",
515+
"metricValue": -1,
516+
"metricUnit": "unit2",
517+
"metricMetadata": {
518+
"metadata1": "m3",
519+
"metadata2": "m4"
520+
}
521+
},
522+
{
523+
"metricName": "metric3",
524+
"metricValue": 1.2,
525+
"metricUnit": "unit3",
526+
"metricMetadata": {
527+
"metadata1": "m5",
528+
"metadata2": "m6"
529+
}
530+
},
531+
{
532+
"metricName": "metric4",
533+
"metricValue": 1.0,
534+
"metricMetadata": {
535+
"metadata1": "m7",
536+
"metadata2": "m8"
537+
}
538+
},
539+
{
540+
"metricName": "metric5",
541+
"metricValue": "1.24",
542+
"metricUnit": "unit5"
543+
},
544+
{
545+
"metricName": "metric6",
546+
"metricValue": "-5.8"
547+
}
548+
]
549+
```
550+
492551
### Out-of-Box Components for Execution of Script-Based Automation
493552
The following section provides examples of how scripts can be integrated into the Virtual Client using out-of-box features to integrate script-based
494553
extensions.

0 commit comments

Comments
 (0)