Skip to content

Commit

Permalink
Update to .NET 9 SDK + 1.10 OTel SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejgordon committed Nov 13, 2024
1 parent 365270f commit 8aa1524
Show file tree
Hide file tree
Showing 32 changed files with 221 additions and 152 deletions.
3 changes: 2 additions & 1 deletion .github/.github.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>False</IsPackable>
</PropertyGroup>

Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/bootstrap/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ runs:
with:
global-json-file: ./global.json

- name: Install Aspire workload
shell: bash
run: dotnet workload install aspire

- id: dotnet
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MinVer" Version="5.0.0" PrivateAssets="all" />
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="all" />
</ItemGroup>
</Project>
36 changes: 19 additions & 17 deletions build/build.fsproj
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
<NoWarn>$(NoWarn);NU1701</NoWarn>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Argu" Version="6.1.4"/>
<PackageReference Include="Bullseye" Version="4.2.1"/>
<PackageReference Include="Argu" Version="6.1.4" />
<PackageReference Include="Bullseye" Version="4.2.1" />
<PackageReference Include="Octokit" Version="13.0.1" />
<PackageReference Include="Proc.Fs" Version="0.8.1"/>
<PackageReference Include="Fake.Tools.Git" Version="5.20.3"/>
<PackageReference Remove="FSharp.Core"/>
<PackageReference Include="FSharp.Core" Version="8.0.101"/>
<PackageReference Include="Proc.Fs" Version="0.8.1" />
<PackageReference Include="Fake.Tools.Git" Version="5.20.3" />
<PackageReference Remove="FSharp.Core" />
<PackageReference Include="FSharp.Core" Version="8.0.101" />
</ItemGroup>

<ItemGroup>
<None Include="..\*" LinkBase="_root"/>
<None Include="..\*" LinkBase="_root" />
</ItemGroup>

<ItemGroup>
<Compile Include="scripts\BuildInformation.fs"/>
<Compile Include="scripts\CommandLine.fs"/>
<Compile Include="scripts\BuildInformation.fs" />
<Compile Include="scripts\CommandLine.fs" />
<Compile Include="scripts\Packaging.fs" />
<Compile Include="scripts\Targets.fs"/>
<Compile Include="scripts\Program.fs"/>
<None Include="**\*"/>
<None Remove="bin\**"/>
<None Remove="obj\**"/>
<None Remove="scripts\**"/>
<None Remove="output\**"/>
<Compile Include="scripts\Targets.fs" />
<Compile Include="scripts\Program.fs" />
<None Include="**\*" />
<None Remove="bin\**" />
<None Remove="obj\**" />
<None Remove="scripts\**" />
<None Remove="output\**" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions build/scripts/Targets.fs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ let private runTests suite _ =


let settingsArg = ["-s"; "tests/.runsettings"]
let tfmArgs = if OS.Current = OS.Windows then [] else ["-f"; "net8.0"]
let tfmArgs = if OS.Current = OS.Windows then [] else ["-f"; "net9.0"]
exec {
env (Map ["TEST_SUITE", suite.SuitName])
run "dotnet" (
Expand Down Expand Up @@ -128,13 +128,13 @@ let private generateApiChanges _ =
nugetPackages
|> Seq.iter(fun p ->
let outputFile = Path.Combine(output, $"breaking-changes-%s{p}.md")
let tfm = "net8.0"
let tfm = "net9.0"
let args =
[
"assembly-differ"
$"previous-nuget|%s{p}|%s{currentVersion}|%s{tfm}";
//$"directory|.artifacts/bin/%s{p}/release/%s{tfm}";
$"directory|.artifacts/bin/%s{p}/release_net8.0";
$"directory|.artifacts/bin/%s{p}/release_net9.0";
"-a"; "true"; "--target"; p; "-f"; "github-comment"; "--output"; outputFile
]
exec { run "dotnet" args }
Expand Down
2 changes: 1 addition & 1 deletion dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"minver-cli": {
"version": "5.0.0",
"version": "6.0.0",
"commands": [
"minver"
]
Expand Down
6 changes: 4 additions & 2 deletions examples/AppHost/AppHost.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.2.0" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 4 additions & 3 deletions examples/AppHost/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15114",
"applicationUrl": "https://localhost:15114",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:16161"
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:16161",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22052"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/Example.AspNetCore.Mvc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj", "examples/Example.AspNetCore.Mvc/"]
Expand Down
4 changes: 2 additions & 2 deletions examples/Example.AspNetCore.Mvc/Example.AspNetCore.Mvc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand Down
13 changes: 6 additions & 7 deletions examples/Example.AutoInstrumentation/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG OTEL_VERSION=1.7.0
ARG OTEL_VERSION=1.9.0
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
ARG TARGETPLATFORM
ARG TARGETARCH
Expand All @@ -18,7 +18,6 @@ ADD https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/relea
RUN chmod +x otel-dotnet-auto-install.sh
RUN OTEL_DOTNET_AUTO_HOME="/app/otel" sh otel-dotnet-auto-install.sh


FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build_example
ENV _PROJECT="Example.AutoInstrumentation"
ENV _PROJECTPATH="${_PROJECT}/${_PROJECT}.csproj"
Expand All @@ -33,7 +32,7 @@ RUN dotnet build "${_PROJECT}.csproj" -c Release -o /app/build_example
FROM build_example AS publish_example
RUN dotnet publish "Example.AutoInstrumentation.csproj" -c Release -o /app/example /p:UseAppHost=false

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build_distro
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build_distro
ENV _PROJECT="Elastic.OpenTelemetry"
ENV _PROJECTPATH="${_PROJECT}/${_PROJECT}.csproj"
WORKDIR /work
Expand All @@ -49,24 +48,24 @@ ARG TARGETARCH
ARG TARGETVARIANT
WORKDIR /app
COPY --from=publish_example /app/example /app/example
COPY --from=build_distro /work/.artifacts/bin/Elastic.OpenTelemetry/release_netstandard2.1/Elastic.OpenTelemetry.dll /app/otel/net/
COPY --from=build_distro /work/.artifacts/bin/Elastic.OpenTelemetry/release_netstandard2.1/Elastic.OpenTelemetry.pdb /app/otel/net/
COPY --from=build_distro /work/.artifacts/bin/Elastic.OpenTelemetry/release_net8.0/Elastic.OpenTelemetry.dll /app/otel/net/
COPY --from=build_distro /work/.artifacts/bin/Elastic.OpenTelemetry/release_net8.0/Elastic.OpenTelemetry.pdb /app/otel/net/

ENV CORECLR_ENABLE_PROFILING="1"
ENV CORECLR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}"
ENV CORECLR_PROFILER_PATH="/app/otel/linux-${TARGETARCH}/OpenTelemetry.AutoInstrumentation.Native.so"
ENV OTEL_DOTNET_AUTO_PLUGINS="Elastic.OpenTelemetry.AutoInstrumentationPlugin, Elastic.OpenTelemetry, Version=1.0.0.0, Culture=neutral, PublicKeyToken=069ca2728db333c1"

ENV OTEL_TRACES_EXPORTER=none
ENV OTEL_METRICS_EXPORTER=none
ENV OTEL_LOGS_EXPORTER=none
ENV OTEL_SERVICE_NAME=ExampleInstrumentation

ENV OTEL_LOG_LEVEL=debug
ENV OTEL_DOTNET_AUTO_LOG_DIRECTORY=/app/logs
ENV ELASTIC_OTEL_LOG_TARGETS=stdout

ENV OTEL_DOTNET_AUTO_HOME="/app/otel"
ENV OTEL_DOTNET_AUTO_LOGGER="console"
ENV DOTNET_ADDITIONAL_DEPS="/app/otel/AdditionalDeps"
ENV DOTNET_SHARED_STORE="/app/otel/store"
ENV DOTNET_STARTUP_HOOKS="/app/otel/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Can't update to 9.0 yet as the autoinstrumentation store doesn't yet include a net9.0 directory -->
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<Content Include="..\..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\.dockerignore">
<Link>.dockerignore</Link>
</Content>
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions examples/Example.AutoInstrumentation/distribution.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG OTEL_VERSION=1.7.0
ARG OTEL_VERSION=1.9.0
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG TARGETPLATFORM
ARG TARGETARCH
Expand All @@ -19,7 +19,6 @@ COPY examples/${_PROJECT} examples/${_PROJECT}
WORKDIR "/work/examples/${_PROJECT}"
RUN dotnet publish "${_PROJECT}.csproj" -c Release -a $TARGETARCH --no-restore -o /app/example


FROM build AS final

COPY ".artifacts/elastic-distribution" /distro/elastic
Expand Down
26 changes: 13 additions & 13 deletions examples/Example.Console/Example.Console.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.0.0-rc9.15" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.9.0-beta.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Elastic.OpenTelemetry\Elastic.OpenTelemetry.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Elastic.OpenTelemetry\Elastic.OpenTelemetry.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion examples/Example.MinimalApi/Example.MinimalApi.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions examples/Example.WorkerService/Example.WorkerService.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-Example.Elastic.OpenTelemetry.Worker-3a9724de-5d6b-4e68-a21e-b90c655cc721</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.9.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.10.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 3 additions & 1 deletion examples/ServiceDefaults/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
using OpenTelemetry.Trace;

// ReSharper disable once CheckNamespace
#pragma warning disable IDE0130 // Namespace does not match folder structure
namespace Microsoft.Extensions.Hosting;
#pragma warning restore IDE0130 // Namespace does not match folder structure

public static class Extensions
{
Expand All @@ -30,7 +32,7 @@ public static IHostApplicationBuilder AddServiceDefaults(this IHostApplicationBu
http.AddStandardResilienceHandler();

// Turn on service discovery by default
http.UseServiceDiscovery();
http.AddServiceDiscovery();
});

return builder;
Expand Down
10 changes: 5 additions & 5 deletions examples/ServiceDefaults/ServiceDefaults.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireSharedProject>true</IsAspireSharedProject>
Expand All @@ -10,10 +10,10 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />

<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.2.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="8.0.0-preview.4.24156.9" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="9.0.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.9.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.100",
"rollForward": "latestMajor",
"allowPrerelease": false
}
Expand Down
Loading

0 comments on commit 8aa1524

Please sign in to comment.