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
- Host: GitHub
- URL: https://github.com/StartAutomating/PSMetrics
- Owner: StartAutomating
- License: mit
- Created: 2023-04-25T20:09:13.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-07T02:00:23.000Z (almost 2 years ago)
- Last Synced: 2024-11-24T07:32:25.541Z (5 months ago)
- Language: PowerShell
- Size: 235 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - StartAutomating/PSMetrics - A Module for Metrics in PowerShell (PowerShell)
README
![]()
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.