[Example/WorkerService] enable analysis (#6220)
Co-authored-by: Rajkumar Rangaraj <rajrang@microsoft.com>
This commit is contained in:
parent
aa73ce3aaf
commit
ff009146a9
|
@ -40,10 +40,7 @@ public sealed class MessageReceiver : IDisposable
|
|||
|
||||
public void ReceiveMessage(BasicDeliverEventArgs ea)
|
||||
{
|
||||
if (ea == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(ea));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(ea);
|
||||
|
||||
// Extract the PropagationContext of the upstream parent from the message headers.
|
||||
var parentContext = Propagator.Extract(default, ea.BasicProperties, this.ExtractTraceContextFromBasicProperties);
|
||||
|
|
|
@ -28,10 +28,7 @@ public static class RabbitMqHelper
|
|||
|
||||
public static IModel CreateModelAndDeclareTestQueue(IConnection connection)
|
||||
{
|
||||
if (connection == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(connection));
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(connection);
|
||||
|
||||
var channel = connection.CreateModel();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>$(DefaultTargetFrameworkForExampleApps)</TargetFramework>
|
||||
<AnalysisLevel>latest-all</AnalysisLevel>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
ARG SDK_VERSION=8.0
|
||||
|
||||
ARG SDK_VERSION=9.0
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0.407@sha256:2d7f935b8c7fe032cd3d36b5ce9c82c24413881e6dad1b4fbdf36cf369e4244f AS dotnet-sdk-8.0
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0.202@sha256:d7f4691d11f610d9b94bb75517c9e78ac5799447b5b3e82af9e4625d8c8d1d53 AS dotnet-sdk-9.0
|
||||
|
||||
FROM dotnet-sdk-${SDK_VERSION} AS build
|
||||
ARG PUBLISH_CONFIGURATION=Release
|
||||
ARG PUBLISH_FRAMEWORK=net8.0
|
||||
ARG PUBLISH_FRAMEWORK=net9.0
|
||||
WORKDIR /app
|
||||
COPY . ./
|
||||
RUN dotnet publish ./examples/MicroserviceExample/WebApi -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /out -p:IntegrationBuild=true
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" />
|
||||
<PackageReference Include="RabbitMQ.Client" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
ARG SDK_VERSION=8.0
|
||||
ARG SDK_VERSION=9.0
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0.407@sha256:2d7f935b8c7fe032cd3d36b5ce9c82c24413881e6dad1b4fbdf36cf369e4244f AS dotnet-sdk-8.0
|
||||
FROM mcr.microsoft.com/dotnet/sdk:9.0.202@sha256:d7f4691d11f610d9b94bb75517c9e78ac5799447b5b3e82af9e4625d8c8d1d53 AS dotnet-sdk-9.0
|
||||
|
||||
FROM dotnet-sdk-${SDK_VERSION} AS build
|
||||
ARG PUBLISH_CONFIGURATION=Release
|
||||
ARG PUBLISH_FRAMEWORK=net8.0
|
||||
ARG PUBLISH_FRAMEWORK=net9.0
|
||||
WORKDIR /app
|
||||
COPY . ./
|
||||
RUN dotnet publish ./examples/MicroserviceExample/WorkerService -c "${PUBLISH_CONFIGURATION}" -f "${PUBLISH_FRAMEWORK}" -o /out -p:IntegrationBuild=true
|
||||
|
|
|
@ -6,7 +6,7 @@ using Utils.Messaging;
|
|||
|
||||
namespace WorkerService;
|
||||
|
||||
public class Program
|
||||
internal static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@ using Utils.Messaging;
|
|||
|
||||
namespace WorkerService;
|
||||
|
||||
public partial class Worker : BackgroundService
|
||||
internal sealed class Worker : BackgroundService
|
||||
{
|
||||
private readonly MessageReceiver messageReceiver;
|
||||
|
||||
|
@ -14,16 +14,6 @@ public partial class Worker : BackgroundService
|
|||
this.messageReceiver = messageReceiver;
|
||||
}
|
||||
|
||||
public override Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
return base.StartAsync(cancellationToken);
|
||||
}
|
||||
|
||||
public override async Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await base.StopAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
stoppingToken.ThrowIfCancellationRequested();
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Worker">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>$(DefaultTargetFrameworkForExampleApps)</TargetFramework>
|
||||
<AnalysisLevel>latest-all</AnalysisLevel>
|
||||
<NoWarn>$(NoWarn);CA1812</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" />
|
||||
<PackageReference Include="RabbitMQ.Client" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry\OpenTelemetry.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Zipkin\OpenTelemetry.Exporter.Zipkin.csproj" />
|
||||
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Hosting\OpenTelemetry.Extensions.Hosting.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in New Issue