Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add README for dotnet examples #233

Merged
merged 2 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions examples/dotnet/3.1/fast-slow/Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions examples/dotnet/3.1/fast-slow/example/Example.csproj

This file was deleted.

13 changes: 0 additions & 13 deletions examples/dotnet/3.1/web/Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions examples/dotnet/3.1/web/example/Example.csproj

This file was deleted.

13 changes: 0 additions & 13 deletions examples/dotnet/5.0/fast-slow/docker-compose.yml

This file was deleted.

38 changes: 0 additions & 38 deletions examples/dotnet/5.0/fast-slow/example/Program.cs

This file was deleted.

17 changes: 0 additions & 17 deletions examples/dotnet/5.0/web/docker-compose.yml

This file was deleted.

27 changes: 0 additions & 27 deletions examples/dotnet/5.0/web/example/Program.cs

This file was deleted.

39 changes: 39 additions & 0 deletions examples/dotnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# .NET Examples

The directory contains examples of how to run Pyroscop to profile .NET applications in Docker containers.

### Fast-slow

The example is a simple single-thread application similar to examples for other spies.

The code is pretty self-explanatory: `Slow.Work` should take 80% of CPU time and remaining 20% to be consumed by
`Fast.Work`. You may ask why `Fast` and `Slow` classes are defined in separate namespaces. The fact is that Pyroscope
colors frames depending on the namespaces (for .NET traces), so they are defined in this way just for sake of demo ;)

In this example, the program is built as an executable (`/dotnet/example`), therefore `-spy-name dotnetspy` argument is
required to tell Pyroscope how to deal with the process:
> CMD ["pyroscope", "exec", "-spy-name", "dotnetspy", "/dotnet/example"]

To run the example execute the following commands:

```shell
# cd examples/dotnet/fast-slow
# docker-compose up
```

### Web

The example is a simple ASP.NET Core web app that enables you to observe how consumed CPU time is changed by making
HTTP requests to [http://localhost:5000](http://localhost:5000).

In contrast to the previous example, the application is built as a dynamic library (`/dotnet/example.dll`) and
runs with dotnet. This allows Pyroscope to automatically detect which kind of spy to use, making `-spy-name` option
unnecessary:
> CMD ["pyroscope", "exec", "dotnet", "/dotnet/example.dll"]

To run the example execute the following commands:

```shell
# cd examples/dotnet/web
# docker-compose up
```
File renamed without changes.