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

docs(dotnet): update examples #1993

Merged
merged 1 commit into from
Jul 11, 2023
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
18 changes: 14 additions & 4 deletions examples/dotnet/fast-slow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0

WORKDIR /dotnet

COPY --from=pyroscope/pyroscope:latest /usr/bin/pyroscope /usr/bin/pyroscope
COPY --from=pyroscope/pyroscope-dotnet:0.8.7-glibc /Pyroscope.Profiler.Native.so ./Pyroscope.Profiler.Native.so
COPY --from=pyroscope/pyroscope-dotnet:0.8.7-glibc /Pyroscope.Linux.ApiWrapper.x64.so ./Pyroscope.Linux.ApiWrapper.x64.so

ADD example .

RUN dotnet publish -o . -r $(dotnet --info | grep RID | cut -b 6- | tr -d ' ')

ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={BD1A650D-AC5D-4896-B64F-D6FA25D6B26A}
ENV CORECLR_PROFILER_PATH=/dotnet/Pyroscope.Profiler.Native.so
ENV LD_PRELOAD=/dotnet/Pyroscope.Linux.ApiWrapper.x64.so


ENV PYROSCOPE_APPLICATION_NAME=fast-slow.dotnet.app
ENV PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040/
ENV PYROSCOPE_LOG_LEVEL=debug
ENV PYROSCOPE_PROFILING_ENABLED=1
ENV PYROSCOPE_PROFILING_ALLOCATION_ENABLED=true
ENV PYROSCOPE_PROFILING_CONTENTION_ENABLED=true
ENV PYROSCOPE_PROFILING_EXCEPTION_ENABLED=true

RUN adduser --disabled-password --gecos --quiet pyroscope
USER pyroscope

CMD ["pyroscope", "exec", "-spy-name", "dotnetspy", "/dotnet/example"]
CMD ["/dotnet/example"]
10 changes: 8 additions & 2 deletions examples/dotnet/fast-slow/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ services:
- '4040:4040'
command:
- 'server'
app:
build: ''
app-glibc:
build:
context: .
dockerfile: Dockerfile
app-musl:
build:
context: .
dockerfile: musl.Dockerfile
27 changes: 27 additions & 0 deletions examples/dotnet/fast-slow/musl.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine

WORKDIR /dotnet

COPY --from=pyroscope/pyroscope-dotnet:0.8.7-musl /Pyroscope.Profiler.Native.so ./Pyroscope.Profiler.Native.so
COPY --from=pyroscope/pyroscope-dotnet:0.8.7-musl /Pyroscope.Linux.ApiWrapper.x64.so ./Pyroscope.Linux.ApiWrapper.x64.so

ADD example .

RUN dotnet publish -o . -r $(dotnet --info | grep RID | cut -b 6- | tr -d ' ')

ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={BD1A650D-AC5D-4896-B64F-D6FA25D6B26A}
ENV CORECLR_PROFILER_PATH=/dotnet/Pyroscope.Profiler.Native.so
ENV LD_PRELOAD=/dotnet/Pyroscope.Linux.ApiWrapper.x64.so


ENV PYROSCOPE_APPLICATION_NAME=fast-slow.dotnet.app
ENV PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040/
ENV PYROSCOPE_LOG_LEVEL=debug
ENV PYROSCOPE_PROFILING_ENABLED=1
ENV PYROSCOPE_PROFILING_ALLOCATION_ENABLED=true
ENV PYROSCOPE_PROFILING_CONTENTION_ENABLED=true
ENV PYROSCOPE_PROFILING_EXCEPTION_ENABLED=true


CMD ["/dotnet/example"]
11 changes: 5 additions & 6 deletions examples/dotnet/rideshare/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:6.0
# FROM --platform=linux/amd64 mcr.microsoft.com/dotnet/sdk:6.0-alpine
FROM mcr.microsoft.com/dotnet/sdk:6.0

WORKDIR /dotnet

RUN wget -qO- https://github.com/grafana/pyroscope-dotnet/releases/download/v0.8.3-pyroscope/pyroscope.glibc.tar.gz \
| tar xvz
# RUN wget -qO- https://github.com/grafana/pyroscope-dotnet/releases/download/v0.8.3-pyroscope/pyroscope.musl.tar.gz \
# | tar xvz
COPY --from=pyroscope/pyroscope-dotnet:0.8.7-glibc /Pyroscope.Profiler.Native.so ./Pyroscope.Profiler.Native.so
COPY --from=pyroscope/pyroscope-dotnet:0.8.7-glibc /Pyroscope.Linux.ApiWrapper.x64.so ./Pyroscope.Linux.ApiWrapper.x64.so


ADD example .

RUN dotnet publish -o . -r $(dotnet --info | grep RID | cut -b 6- | tr -d ' ')
Expand Down
13 changes: 13 additions & 0 deletions examples/dotnet/rideshare/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ services:
build:
context: .

ap-south-alpine:
ports:
- 5000
environment:
- REGION=ap-south
- PYROSCOPE_LABELS=region:ap-south-alpine
- PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040
- ASPNETCORE_URLS=http://*:5000
build:
context: .
dockerfile: musl.Dockerfile


pyroscope:
image: pyroscope/pyroscope:latest
environment:
Expand Down
27 changes: 27 additions & 0 deletions examples/dotnet/rideshare/musl.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine

WORKDIR /dotnet

COPY --from=pyroscope/pyroscope-dotnet:0.8.7-musl /Pyroscope.Profiler.Native.so ./Pyroscope.Profiler.Native.so
COPY --from=pyroscope/pyroscope-dotnet:0.8.7-musl /Pyroscope.Linux.ApiWrapper.x64.so ./Pyroscope.Linux.ApiWrapper.x64.so


ADD example .

RUN dotnet publish -o . -r $(dotnet --info | grep RID | cut -b 6- | tr -d ' ')

ENV CORECLR_ENABLE_PROFILING=1
ENV CORECLR_PROFILER={BD1A650D-AC5D-4896-B64F-D6FA25D6B26A}
ENV CORECLR_PROFILER_PATH=/dotnet/Pyroscope.Profiler.Native.so
ENV LD_PRELOAD=/dotnet/Pyroscope.Linux.ApiWrapper.x64.so

ENV PYROSCOPE_APPLICATION_NAME=rideshare.dotnet.app
ENV PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040
ENV PYROSCOPE_LOG_LEVEL=debug
ENV PYROSCOPE_PROFILING_ENABLED=1
ENV PYROSCOPE_PROFILING_ALLOCATION_ENABLED=true
ENV PYROSCOPE_PROFILING_CONTENTION_ENABLED=true
ENV PYROSCOPE_PROFILING_EXCEPTION_ENABLED=true


CMD ["dotnet", "/dotnet/example.dll"]
17 changes: 0 additions & 17 deletions examples/dotnet/web/Dockerfile

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

This file was deleted.

Loading