Skip to content
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

[DOC] Update Jaeger tutorial to use OTLP Exporter #3940

Merged
merged 7 commits into from
Nov 30, 2022
Merged
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
7 changes: 7 additions & 0 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry.Exporter.Open
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTelemetry.Exporter.Console.Tests", "test\OpenTelemetry.Exporter.Console.Tests\OpenTelemetry.Exporter.Console.Tests.csproj", "{011E70E1-152A-47BB-AF83-12DD12B125ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "getting-started-jaeger", "docs\trace\getting-started-jaeger\getting-started-jaeger.csproj", "{329AD438-6D15-4432-99BE-B0E85F00B3CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -498,6 +500,10 @@ Global
{011E70E1-152A-47BB-AF83-12DD12B125ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{011E70E1-152A-47BB-AF83-12DD12B125ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{011E70E1-152A-47BB-AF83-12DD12B125ED}.Release|Any CPU.Build.0 = Release|Any CPU
{329AD438-6D15-4432-99BE-B0E85F00B3CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{329AD438-6D15-4432-99BE-B0E85F00B3CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{329AD438-6D15-4432-99BE-B0E85F00B3CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{329AD438-6D15-4432-99BE-B0E85F00B3CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -535,6 +541,7 @@ Global
{9A07D215-90AC-4BAF-BCDB-73D74FD3A5C5} = {3862190B-E2C5-418E-AFDC-DB281FB5C705}
{5FDAF679-DE5A-4C73-A49B-8ABCF2399229} = {77C7929A-2EED-4AA6-8705-B5C443C8AA0F}
{A2DF46DE-50D7-4887-8C9D-4BD79CA19FAA} = {3862190B-E2C5-418E-AFDC-DB281FB5C705}
{329AD438-6D15-4432-99BE-B0E85F00B3CB} = {5B7FB835-3FFF-4BC2-99C5-A5B5FAE3C818}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {55639B5C-0770-4A22-AB56-859604650521}
Expand Down
3 changes: 2 additions & 1 deletion docs/trace/getting-started-jaeger/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System.Net.Http;
using System.Threading.Tasks;
using OpenTelemetry;
using OpenTelemetry.Exporter;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;

Expand All @@ -37,7 +38,7 @@ public static async Task Main()
.AddSource("OpenTelemetry.Demo.Jaeger")
.AddHttpClientInstrumentation()
.AddConsoleExporter()
.AddJaegerExporter()
.AddOtlpExporter()
.Build();

using var parent = MyActivitySource.StartActivity("JaegerDemo");
Expand Down
36 changes: 18 additions & 18 deletions docs/trace/getting-started-jaeger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ dotnet run
```

Add reference to [Console
Exporter](../../../src/OpenTelemetry.Exporter.Console/README.md), [Jaeger
Exporter](../../../src/OpenTelemetry.Exporter.Jaeger/README.md) and [HttpClient
Instrumentation](../../../src/OpenTelemetry.Instrumentation.Http/README.md):
Exporter](../../../src/OpenTelemetry.Exporter.Console/README.md), [OTLP
Exporter](../../../src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md) and
[HttpClient Instrumentation](../../../src/OpenTelemetry.Instrumentation.Http/README.md):

```sh
dotnet add package OpenTelemetry.Exporter.Console
dotnet add package OpenTelemetry.Exporter.Jaeger
dotnet add package OpenTelemetry.Instrumentation.Http
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
dotnet add package OpenTelemetry.Instrumentation.Http --prerelease
```

Now copy the code from [Program.cs](./Program.cs).
Expand Down Expand Up @@ -67,15 +67,15 @@ Note that we have configured two exporters in the code:
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
...
.AddConsoleExporter()
.AddJaegerExporter()
.AddOtlpExporter()
.Build();
```

When we run the application, the `ConsoleExporter` was printing the traces on
console, and the `JaegerExporter` was attempting to send the traces to Jaeger
Agent via the default endpoint `udp://localhost:6831`.
console, and the `OtlpExporter` was attempting to send the traces to Jaeger
Agent via the default endpoint `http://localhost:4317`.

Since we didn't have Jaeger running, the traces received by `JaegerExporter`
Since we didn't have Jaeger running, the traces received by `OtlpExporter`
were simply dropped on the floor. In the next step, we are going to learn about
how to use Jaeger to collect and visualize the traces.

Expand All @@ -87,7 +87,7 @@ subgraph SDK
SimpleExportProcessor["SimpleExportProcessor < Activity >"]
BatchExportProcessor["BatchExportProcessor < Activity >"]
ConsoleExporter
JaegerExporter
OtlpExporter
end

subgraph API
Expand All @@ -98,7 +98,7 @@ ActivitySource --> | System.Diagnostics.Activity | TracerProvider

TracerProvider --> | System.Diagnostics.Activity | SimpleExportProcessor --> | Batch | ConsoleExporter

TracerProvider --> | System.Diagnostics.Activity | BatchExportProcessor --> | Batch | JaegerExporter
TracerProvider --> | System.Diagnostics.Activity | BatchExportProcessor --> | Batch | OtlpExporter
```

## Collect and visualize traces using Jaeger
Expand All @@ -112,7 +112,7 @@ After finished downloading, extract it to a local location that's easy to
access. Run the `jaeger-all-in-one(.exe)` executable:

```sh
./jaeger-all-in-one
./jaeger-all-in-one --collector.otlp.enabled
```

Now we should be able to see the Jaeger UI at
Expand All @@ -133,7 +133,7 @@ Chart](https://en.wikipedia.org/wiki/Gantt_chart):
```mermaid
graph TD

JaegerExporter["JaegerExporter"] --> |udp://localhost:6831| Jaeger
OtlpExporter["OtlpExporter"] --> |http://localhost:4317| Jaeger
Jaeger -->|http://localhost:16686/| JaegerUI["Browser<br/>(Jaeger UI)"]
```

Expand All @@ -147,7 +147,7 @@ using var tracerProvider = Sdk.CreateTracerProviderBuilder()
...
// Remove Console Exporter from the final application
// .AddConsoleExporter()
.AddJaegerExporter()
.AddOtlpExporter()
.Build();
```

Expand All @@ -161,7 +161,7 @@ graph LR
subgraph SDK
TracerProvider
BatchExportProcessor["BatchExportProcessor < Activity >"]
JaegerExporter
OtlpExporter
end

subgraph API
Expand All @@ -170,11 +170,11 @@ end

ActivitySource --> | System.Diagnostics.Activity | TracerProvider --> | System.Diagnostics.Activity | BatchExportProcessor

BatchExportProcessor --> | Batch | JaegerExporter
BatchExportProcessor --> | Batch | OtlpExporter
```

## Learn more

- [Jaeger Tracing](https://www.jaegertracing.io/)
- [Jaeger Exporter for OpenTelemetry
.NET](../../../src/OpenTelemetry.Exporter.Jaeger/README.md)
- [OTLP Exporter for OpenTelemetry
.NET](../../../src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md)
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Console\OpenTelemetry.Exporter.Console.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.Jaeger\OpenTelemetry.Exporter.Jaeger.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Exporter.OpenTelemetryProtocol\OpenTelemetry.Exporter.OpenTelemetryProtocol.csproj" />
<ProjectReference Include="$(RepoRoot)\src\OpenTelemetry.Instrumentation.Http\OpenTelemetry.Instrumentation.Http.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Net.Http" Version="4.3.4" Condition="$(TargetFramework) == 'net472' or $(TargetFramework) == 'net48'" />
Copy link
Member

Choose a reason for hiding this comment

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

@alanwest @utpilla This change piqued my interest. We don't specify targets explicitly. When I build this project locally I get output for net7.0, net6.0, net462, net47, net471, net472, & net48. It is interesting that net462, net47, & net471 don't also need this reference 🤔 But it raises a question: Should we specify targets on these docs projects?

Copy link
Member

Choose a reason for hiding this comment

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

</ItemGroup>
</Project>