Skip to content

CactusSoft/Cactus.Metrics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cactus.Metrics

Middleware for collecting metrics:

  1. Proceed request time
  2. Response status code counts

Based on Prometheus and Grafana

Repository contains a project for middleware and tools script

How to use

  1. Install prometheus-net.AspNetCore. It is needed to expose metric endpoint
  2. Install NuGet package
  3. In Startup.cs add middleware into core pipeline:
app.UseMetricServer(); // Prometheus exstension to expose metric endpoint
app.UseCactusMetric();
  1. Clone ToolsScript folder to your machine
  2. Edit configs to match for your project
  3. Use docker-compose.metrics.yml to start tools

Configuration

Metric middleware

Use MetricMiddlewareConfig object to change standart behavior:

  • ExcludeStatusCodeMetric - set true to exclude status code metric
  • ProceedRequestTimeBuckets - proceed request time buckets upper levels (milliseconds). Affect performance (fewer - better performance) Default: {50.0, 100, 200, 500, 1000, 1500, 2000} Details here

Prometheus

In ToolScripts/prometheus there are two config files:

  • alert.rules - contains rules for Prometheus alerting Details here
  • prometheus.yml - contains Prometheus config Details here Add servers to monitor in scrape_configs section

Alertmanager

In ToolScripts/alertmanager there is config.yml for alerting configuration Details here

Grafana

In Grafana included two dashboards:

  • Docker (actually not perfect without swarm)
  • General - shows proceed request times, response status code counts, CPU/memory usage, uptime You can add your own dashboards in ToolScriptsgrafana/provisioning/dashboards folder

To update preconfigured dashboards, export it and import back in Grafana (Details here)

Credentials

For the first login, after that Grafana suggests changing password

Login: admin

Password: admin

OR you can set admin password in ToolsScripts/grafana/config.monitoring file in GF_SECURITY_ADMIN_PASSWORD parameter

docker-compose.metrics.yml

You should change networks sections and path in volumes sections (if you changed docker-compose.metrics.yml path)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages