Skip to content

Commit

Permalink
add OpenTelemetry .NET Elastic's distribution (#20)
Browse files Browse the repository at this point in the history
* feat: add .NET Elastic Otel distribution

* docs: add .NET distribution blog url
  • Loading branch information
rogercoll authored Jun 13, 2024
1 parent 4b42c76 commit 79af6a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
The following guide describes how to setup the OpenTelemetry demo with Elastic Observability using [Docker compose](#docker-compose) or [Kubernetes](#kubernetes). This fork introduces several changes to the agents used in the demo:

- The Java agent within the [Ad](../src/adservice/Dockerfile.elastic) and [Fraud Detection](../src/frauddetectionservice/Dockerfile.elastic) services have been replaced with the Elastic distribution of the OpenTelemetry Java Agent. You can find more information about the Elastic distribution in [this blog post](https://www.elastic.co/observability-labs/blog/elastic-distribution-opentelemetry-java-agent).
- The .NET agent within the [Cart service](../src/cartservice/src/Directory.Build.props) has been replaced with the Elastic distribution of the OpenTelemetry .NET Agent. You can find more information about the Elastic distribution in [this blog post](https://www.elastic.co/observability-labs/blog/elastic-opentelemetry-distribution-dotnet-applications).

## Docker compose

Expand Down
5 changes: 5 additions & 0 deletions src/cartservice/src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<ItemGroup>
<PackageReference Include="Elastic.OpenTelemetry" Version="1.0.0-alpha.3" />
</ItemGroup>
</Project>
12 changes: 3 additions & 9 deletions src/cartservice/src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Microsoft.Extensions.Logging;
using OpenTelemetry.Instrumentation.StackExchangeRedis;
using OpenTelemetry.Logs;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.ResourceDetectors.Container;
using OpenTelemetry.ResourceDetectors.Host;
Expand All @@ -30,7 +31,6 @@
}

builder.Logging
.AddOpenTelemetry(options => options.AddOtlpExporter())
.AddConsole();

builder.Services.AddSingleton<ICartStore>(x=>
Expand Down Expand Up @@ -65,15 +65,9 @@
.WithTracing(tracerBuilder => tracerBuilder
.AddRedisInstrumentation(
options => options.SetVerboseDatabaseStatements = true)
.AddAspNetCoreInstrumentation()
.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation()
.AddOtlpExporter())
.AddAspNetCoreInstrumentation())
.WithMetrics(meterBuilder => meterBuilder
.AddProcessInstrumentation()
.AddRuntimeInstrumentation()
.AddAspNetCoreInstrumentation()
.AddOtlpExporter());
.AddAspNetCoreInstrumentation());
OpenFeature.Api.Instance.AddHooks(new TracingHook());
builder.Services.AddGrpc();
builder.Services.AddGrpcHealthChecks()
Expand Down

0 comments on commit 79af6a1

Please sign in to comment.