An open API service indexing awesome lists of open source software.

https://github.com/StartAutomating/PSMetrics

A Module for Metrics in PowerShell
https://github.com/StartAutomating/PSMetrics

Last synced: 4 months ago
JSON representation

A Module for Metrics in PowerShell

Awesome Lists containing this project

README

        


PSMetrics

PSMetrics is a module for metrics in PowerShell.

It lets us describe a metric in a simple script, named `*.metric.ps1`.

Once we've described a metric, it's easy to calculate it from any appropriate input.

Once we've calculated a metric, it's easy to format that metric any way we'd like.

PSMetrics includes formatters for [ChartJS](https://chartjs.org) and [PowerShell Universal](https://ironmansoftware.com/powershell-universal-dashboard)

## Using PSMetrics

You import metrics with Import-Metric. Once you have done this, you can use the metric a number of different ways.

~~~PowerShell
# You can run the metric directly and get back it's data
Get-ChildItem -File -Recurse | FileSizeByExtension

# You can run the metric with an emoji alias to render it as a graph
Get-ChildItem -File -Recurse | FileSizeByExtensionđź“Š

# You can provide an -OutputPath to export the HTML
Get-ChildItem -File -Recurse | FileSizeByExtensionđź“Š -OutputPath .\FileSizeByExtension.html

# You can provide an -OutputPath that is a CSV or CLIXML to export the data
Get-ChildItem -File -Recurse | FileSizeByExtensionđź“Š -OutputPath .\FileSizeByExtension.Clixml
~~~

## PSMetrics Action

You can use PSMetrics in a GitHub action. Simply create a `*.psmetrics.ps1` file and use the github action in your YAML.

~~~yaml
- name: UsePSMetrics
uses: StartAutomating/PSMetrics@main
~~~

Any files you output from the action will be checked into your repo (please make sure your github access token allows you to write to the repository)

## Example Metrics

PSMetrics comes with a few example metrics you can use out of the box.

|MetricName |Synopsis |
|-------------------|-----------------------|
|CommandsByNoun |Commands By Noun |
|CommandsByType |Commands By Type |
|CommandsByVerb |Commands By Verb |
|FilesByExtension |Gets files by extension|
|FileSizeByExtension|File Size By Extension |
|PipeScriptFactor |PipeScript Factor |
|TypesByNamespace |Gets types by namespace|

## Tools that use PSMetrics

[GitLogger](https://gitlogger.com/GitLogger-Metrics/) uses PSMetrics to standardize the data you can visualize from a repository.