Skip to content

App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application and reports it's health.

License

Notifications You must be signed in to change notification settings

pshrosbree/AppMetrics

 
 

Repository files navigation

App Metrics

Official Site License Coverage Status

AppVeyor Travis
Build status Build status
Package Dev Release Pre Release Latest Release
App.Metrics MyGet Status NuGet Status NuGet Status
App.Metrics.Extensions.Mvc MyGet Status NuGet Status NuGet Status
App.Metrics.Extensions.Middleware MyGet Status NuGet Status NuGet Status
App.Metrics.Formatters.Json MyGet Status NuGet Status NuGet Status

What is App Metrics?

App Metrics is an open-source and cross-platform .NET library used to record metrics within an application. App Metrics can run on .NET Core or on the full .NET framework also supporting .NET 4.5.2. App Metrics abstracts away the underlaying repository of your Metrics for example InfluxDB, Graphite, Elasticsearch etc, by sampling and aggregating in memory and providing extensibility points to flush metrics to a repository at a specified interval. For pre .NET Core web applications see AppMetrics.Owin

App Metrics provides various metric types to measure things such as the rate of requests, counting the number of user logins over time, measure the time taken to execute a database query, measure the amount of free memory and so on. Metrics types supported are Gauges, Counters, Meters, Histograms and Timers and Application Performance Indexes Apdex.

For metric reporting capabilities see the reporting repo.

App.Metrics includes an Exponentially Forward Decaying, Sliding Window and Algorithm R reservoir implementations, for additional reservoir sampling see the reservoir repo. For more details on reservoir sampling see the docs.

App Metrics also provides a health checking system allowing you to monitor the health of your application through user defined checks.

Grafana/InfluxDB Web Monitoring

Grafana/InfluxDB Generic Web Dashboard Demo

Grab the dashboard here

Grafana/InfluxDB OAuth2 Client Monitoring on a Web API

Grafana/InfluxDB Generic OAuth2 Web Dashboard Demo

Grab the dashboard here

Grafana/InfluxDB Web Application Setup

  • Download and install InfluxDB. Runs well on Windows using Bash on Windows on Ubuntu
  • Download and install Grafana, then import App.Metrics web dashboard
  • Drop in the App.Metrics.Extensions.Mvc and App.Metrics.Extensions.Reporting.InfluxDB nuget packages into your web application.
  • Create a new InfluxDB Database. Keep note of this for configuring the InfluxDB reporter in your web application
  • Add App.Metrics configuration to the Startup.cs of your web application, including the InfluxDB reporter configuration. You might want to check out the Sandbox or Sample projects if you get stuck
  • Run your app and Grafana at visit http://localhost:3000

How to build

AppVeyor and Travis CI builds are triggered on commits and PRs to dev and master branches.

See the following for build arguments and running locally.

Configuration Description Default Environment Required
BuildConfiguration The configuration to run the build, Debug or Release Release All Optional
PreReleaseSuffix The pre-release suffix for versioning nuget package artifacts e.g. beta ci All Optional
CoverWith DotCover or OpenCover to calculate and report code coverage, None to skip. When not None, a coverage file and html report will be generated at ./artifacts/coverage OpenCover Windows Only Optional
SkipCodeInspect false to run ReSharper code inspect and report results, true to skip. When true, the code inspection html report and xml output will be generated at ./artifacts/resharper-reports false Windows Only Optional
BuildNumber The build number to use for pre-release versions 0 All Optional

Windows

Run build.ps1 from the repositories root directory.

	.\build.ps1

With Arguments

	.\build.ps1 --ScriptArgs '-BuildConfiguration=Release -PreReleaseSuffix=beta -CoverWith=OpenCover -SkipCodeInspect=false -BuildNumber=1'

Linux & OSX

Run build.sh from the repositories root directory. Code Coverage reports are now supported on Linux and OSX, it will be skipped running in these environments.

	.\build.sh

With Arguments

	.\build.sh --ScriptArgs '-BuildConfiguration=Release -PreReleaseSuffix=beta -BuildNumber=1'

Nuget Packages

Nuget packages won't be generated on non-windows environments by default.

Unfortunately there is currently no way out-of-the-box to conditionally build & pack a project by framework. Because App.Metrics packages target .NET 4.5.2 as well as dotnet standard there is a work around in the build script to force dotnet standard on build but no work around for packaging on non-windows environments.

How to run benchmarks

App.Metrics includes bencmarking using BenchmarkDotNet. You can find the benchmark results here.

To run, fron the solution's root:

	cd .\benchmarks\App.Metrics.Benchmarks.Runner\
	dotnet run -c "Release"

You'll then be prompted to choose a benchmark to run which will output a markdown file with the result in directory .\benchmarks\App.Metrics.Benchmarks.Runner\BenchmarkDotNet.Artifacts\results.

Alternatively, you can run the same benchmarks from visual studio using XUnit in the benchmark project.

Contributing

See the contribution guidlines for details.

Acknowledgements

Thanks for providing free open source licensing

License

This library is release under Apache 2.0 License ( see LICENSE ) Copyright (c) 2016 Allan Hardy

See LICENSE


App Metrics is based on the Metrics.NET library, and at the moment uses the same reservoir sampling code from the original library which is a port of the Java Dropwizard Metrics library.

Metrics.NET Licensed under these terms: "Metrics.NET is release under Apache 2.0 License Copyright (c) 2014 Iulian Margarintescu" see LICENSE

Dropwizard Metrics Licensed under these terms*: "Copyright (c) 2010-2013 Coda Hale, Yammer.com Published under Apache Software License 2.0, see LICENSE"


Get more details at codescene.io.

About

App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application and reports it's health.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.0%
  • Other 1.0%