Skip to content

User/saweb/listen for kestrel events #55

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

3 changes: 3 additions & 0 deletions examples/AspNetCoreExample/AspNetCoreExample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<LangVersion>8</LangVersion>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat, was not aware of these properties!

</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\prometheus-net.DotNetRuntime\prometheus-net.DotNetRuntime.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="prometheus-net.AspNetCore" Version="4.0.0" />
<PackageReference Include="prometheus-net" Version="4.1.1" />
</ItemGroup>
Expand Down
24 changes: 17 additions & 7 deletions examples/AspNetCoreExample/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
#FROM mcr.microsoft.com/dotnet/core/sdk:3.1.406 AS build
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["examples/AspNetCoreExample/AspNetCoreExample.csproj", "examples/AspNetCoreExample/"]
COPY ["src/prometheus-net.DotNetRuntime/prometheus-net.DotNetRuntime.csproj", "src/prometheus-net.DotNetRuntime/"]
RUN dotnet restore "examples/AspNetCoreExample/AspNetCoreExample.csproj"
COPY . .
RUN dotnet publish "examples/AspNetCoreExample" -c Release -o /app
WORKDIR "/src/examples/AspNetCoreExample"
RUN dotnet build "AspNetCoreExample.csproj" -c Release -o /app/build
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no need for an explicit restore or build- publish does all these things implicitly.


FROM build AS publish
RUN dotnet publish "AspNetCoreExample.csproj" -c Release -o /app/publish

#FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.3 AS final
#FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.10 AS final
FROM mcr.microsoft.com/dotnet/aspnet:5.0 as final
FROM base AS final
WORKDIR /app
COPY --from=build /app /app
ENTRYPOINT ["dotnet", "AspNetCoreExample.dll"]
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "AspNetCoreExample.dll"]
13 changes: 13 additions & 0 deletions examples/AspNetCoreExample/OriginalDockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# FROM mcr.microsoft.com/dotnet/core/sdk:3.1.201 AS build
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should delete this if it's no longer in use. I haven't yet checked out your branch but I still do want to support building the docker image via docker-compose up.

#FROM mcr.microsoft.com/dotnet/core/sdk:3.1.406 AS build
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish "examples/AspNetCoreExample" -c Release -o /app

#FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.3 AS final
#FROM mcr.microsoft.com/dotnet/core/aspnet:3.1.10 AS final
FROM mcr.microsoft.com/dotnet/aspnet:5.0 as final
WORKDIR /app
COPY --from=build /app /app
ENTRYPOINT ["dotnet", "AspNetCoreExample.dll"]
16 changes: 11 additions & 5 deletions examples/AspNetCoreExample/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"AspNetCoreExample": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "metrics",
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"Example__UseDefaultMetrics": "true",
"Example__UseDebuggingMetrics": "true",
"Example__UseDefaultMetrics": "true"
}
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/metrics",
"publishAllPorts": true
}
}
}
3 changes: 2 additions & 1 deletion examples/AspNetCoreExample/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public static IDisposable CreateCollector()
.WithGcStats(CaptureLevel.Verbose)
.WithThreadPoolStats(CaptureLevel.Informational)
.WithExceptionStats(CaptureLevel.Errors)
.WithJitStats();
.WithJitStats()
.WithKestrelStats(CaptureLevel.Informational);
}

builder
Expand Down
Loading