Skip to content

Commit

Permalink
Add README for dotnet examples (#233)
Browse files Browse the repository at this point in the history
* Add README for dotnet examples
* Remove examples for .NET Core 3.1
  • Loading branch information
kolesnikovae committed Jun 2, 2021
1 parent 9c89c4b commit 261f882
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 137 deletions.
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 261f882

Please sign in to comment.