https://github.com/rafaelpadovezi/dotnet-diagnostics-lab
Aspnet app with diagnostics samples
https://github.com/rafaelpadovezi/dotnet-diagnostics-lab
aspnet diagnostics dotnet-monitor grafana samples
Last synced: about 2 months ago
JSON representation
Aspnet app with diagnostics samples
- Host: GitHub
- URL: https://github.com/rafaelpadovezi/dotnet-diagnostics-lab
- Owner: rafaelpadovezi
- Created: 2024-01-06T23:38:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-14T00:18:12.000Z (over 1 year ago)
- Last Synced: 2024-01-14T06:59:34.505Z (over 1 year ago)
- Topics: aspnet, diagnostics, dotnet-monitor, grafana, samples
- Language: C#
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# .NET diagnostics lab
Aspnet app with diagnostics samples using:
- [`dotnet-counters`](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-counters)
- [`dotnet-stack`](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-stack)
- [`hey`](https://github.com/rakyll/hey)
- [`dotnet-monitor`](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-monitor)
- [`prometheus`](https://prometheus.io/)
- [`grafana`](https://grafana.com/docs/grafana/latest/)## Step by step - dotnet-monitor + prometheus + grafana
Running the app will start a container with `dotnet-monitor`. This container is setup to get diagnostic commands from the app container through a [diagnostic port](https://learn.microsoft.com/en-us/dotnet/core/diagnostics/diagnostic-port). Dotnet monitor exposes endpoints with usefull information:
- http://localhost:52323/info
- http://localhost:52323/processes
- http://localhost:52325/metricsA full list can be seem here: https://github.com/dotnet/dotnet-monitor/blob/main/documentation/api/README.md.
The metrics endpoint captures metrics in the Prometheus exposition format.
To start grafana use the command bellow:
```
docker compose up grafana
```The compose provisions grafana with prometheus datasource and the community provided [dotnet-monitor dashboard](https://grafana.com/grafana/dashboards/19297-dotnet-monitor-dashboard/). Once is started up go to http://localhost:3000/dashboards (user: `admin`, password: `admin`)
## Load tests
Run the load test:
```sh
docker compose -f docker-compose.yml -f compose.tests.yml run --rm send-load-sync
docker compose -f docker-compose.yml -f compose.tests.yml run --rm send-load-async
docker compose -f docker-compose.yml -f compose.tests.yml run --rm send-load-enumeration
docker compose -f docker-compose.yml -f compose.tests.yml run --rm send-load-multiple-enumeration
```## Egress configuration
dotnet-monitor allows setting the egress to export artifacts like dumps. By default it's used the filesystem.
Configuration to use AWS S3
```yml
DOTNETMONITOR_Egress__S3Storage__monitorS3Blob__bucketName: bucketname
DOTNETMONITOR_Egress__S3Storage__monitorS3Blob__accessKeyId: accesskeyid
DOTNETMONITOR_Egress__S3Storage__monitorS3Blob__secretAccessKey: secretaccesskey
DOTNETMONITOR_Egress__S3Storage__monitorS3Blob__regionName: us-east-1
```And the parameter `egressProvider` should be `monitorS3Blob`.
```sh
curl -X 'GET' \
'http://localhost:52323/dump?egressProvider=monitorS3Blob' \
-H 'accept: application/octet-stream'
```[Docs](https://github.com/dotnet/dotnet-monitor/blob/407ddc545b08fce1eb245c8c16ca46316fb8af78/documentation/configuration/egress-configuration.md)