MicroService example to depend on project reference. (#1031)

This commit is contained in:
Cijo Thomas 2020-08-10 10:36:25 -07:00 committed by GitHub
parent bd738f0447
commit 6e53eb2056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 15 deletions

View File

@ -57,7 +57,7 @@ namespace Utils.Messaging
public void ReceiveMessage(BasicDeliverEventArgs ea)
{
// Extract the ActivityContext of the upstream parent from the message headers.
var parentContext = TextFormat.Extract(ea.BasicProperties, this.ExtractTraceContextFromBasicProperties);
var parentContext = TextFormat.Extract(default, ea.BasicProperties, this.ExtractTraceContextFromBasicProperties);
// Start an activity with a name following the semantic convention of the OpenTelemetry messaging specification.
// https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/semantic_conventions/messaging.md#span-name

View File

@ -5,7 +5,11 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.6" />
<PackageReference Include="OpenTelemetry" Version="0.4.0-beta.2" />
<PackageReference Include="RabbitMQ.Client" Version="6.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Api\OpenTelemetry.Api.csproj" />
</ItemGroup>
</Project>

View File

@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /app
COPY . ./
RUN dotnet publish WebApi -c Release -o /out
RUN dotnet publish ./examples/MicroserviceExample/WebApi -c Release -o /out -p:IntegrationBuild=true
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS runtime
WORKDIR /app

View File

@ -4,12 +4,15 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="0.4.0-beta.2" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="0.4.0-beta.2" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="0.4.0-beta.2" />
<PackageReference Include="RabbitMQ.Client" Version="6.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.AspNetCore\OpenTelemetry.Instrumentation.AspNetCore.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Zipkin\OpenTelemetry.Exporter.Zipkin.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Extensions.Hosting\OpenTelemetry.Extensions.Hosting.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Utils\Utils.csproj" />
</ItemGroup>

View File

@ -2,7 +2,7 @@ FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /app
COPY . ./
RUN dotnet publish WorkerService -c Release -o /out
RUN dotnet publish ./examples/MicroserviceExample/WorkerService -c Release -o /out -p:IntegrationBuild=true
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS runtime
WORKDIR /app

View File

@ -5,12 +5,15 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="3.1.6" />
<PackageReference Include="OpenTelemetry" Version="0.4.0-beta.2" />
<PackageReference Include="OpenTelemetry.Exporter.Zipkin" Version="0.4.0-beta.2" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="0.4.0-beta.2" />
<PackageReference Include="RabbitMQ.Client" Version="6.1.0" />
</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>
<ItemGroup>
<ProjectReference Include="..\Utils\Utils.csproj" />
</ItemGroup>

View File

@ -5,7 +5,7 @@ services:
image: openzipkin/zipkin
ports:
- 9411:9411
rabbitmq:
image: rabbitmq:3-management-alpine
environment:
@ -17,8 +17,8 @@ services:
webapi:
build:
context: .
dockerfile: ./WebApi/Dockerfile
context: ../..
dockerfile: ./examples/MicroserviceExample/WebApi/Dockerfile
image: opentelemetry-example-webapi
environment:
- ASPNETCORE_ENVIRONMENT=Development
@ -34,8 +34,8 @@ services:
workerservice:
build:
context: .
dockerfile: ./WorkerService/Dockerfile
context: ../..
dockerfile: ./examples/MicroserviceExample/WorkerService/Dockerfile
image: opentelemetry-example-workerservice
environment:
- DOTNET_ENVIRONMENT=Development