Skip to content

Commit

Permalink
Small docs fixes (#189)
Browse files Browse the repository at this point in the history
This PR, if applied will
- Fix the links from the primary readme to the docs
- Fix the indentation in the code blocks in `get-started.md`
  • Loading branch information
aeons authored Dec 3, 2024
1 parent f6d53da commit 4ad44d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ NuGet package to your project. This can be achieved by adding the package refere
## Read the docs

* [Get started](./get-started.md)
* [Configuration](./configure.md)
* [Get started](./docs/get-started.md)
* [Configuration](./docs/configure.md)

<!-- ## Getting started
Expand Down
34 changes: 17 additions & 17 deletions docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,28 @@ host-based applications like [worker services](https://learn.microsoft.com/en-us
1. Inside the `Program.cs` file of the ASP.NET Core application, add the following two `using` directives:

```csharp
using OpenTelemetry;
using OpenTelemetry.Trace;
using OpenTelemetry;
using OpenTelemetry.Trace;
```

The OpenTelemetry SDK provides extension methods on the `IServiceCollection` to enable the providers and configure the SDK. EDOT .NET overrides the default OpenTelemetry SDK registration, adding several opinionated defaults.

1. In the minimal API template, the `WebApplicationBuilder` exposes a `Services` property that can be used to register services with the dependency injection container. To enable tracing and metrics collection, ensure that the OpenTelemetry SDK is registered:

```csharp
var builder = WebApplication.CreateBuilder(args);

builder.Services
// The `AddHttpClient` method registers the `IHttpClientFactory` service with
// the dependency injection container. This is NOT required to enable OpenTelemetry,
// but the example endpoint will use it to send an HTTP request.
.AddHttpClient()
// The `AddOpenTelemetry` method registers the OpenTelemetry SDK with the
// dependency injection container. When available, EDOT .NET will override
// this to add opinionated defaults.
.AddOpenTelemetry()
// Configure tracing to instrument requests handled by ASP.NET Core.
.WithTracing(t => t.AddAspNetCoreInstrumentation());
var builder = WebApplication.CreateBuilder(args);

builder.Services
// The `AddHttpClient` method registers the `IHttpClientFactory` service with
// the dependency injection container. This is NOT required to enable OpenTelemetry,
// but the example endpoint will use it to send an HTTP request.
.AddHttpClient()
// The `AddOpenTelemetry` method registers the OpenTelemetry SDK with the
// dependency injection container. When available, EDOT .NET will override
// this to add opinionated defaults.
.AddOpenTelemetry()
// Configure tracing to instrument requests handled by ASP.NET Core.
.WithTracing(t => t.AddAspNetCoreInstrumentation());
```

With these limited changes to the `Program.cs` file, the application is now configured to use the
Expand Down Expand Up @@ -211,8 +211,8 @@ You can find the values of these variables in Kibana's APM tutorial. In Kibana:
For example:

```sh
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer P....l"
export OTEL_EXPORTER_OTLP_ENDPOINT=https://my-deployment.apm.us-west1.gcp.cloud.es.io
export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer P....l"
```
1. Configure environment variables for the application either in `launchSettings.json` or in the environment where the application is running.
1. Once configured, run the application and make a request to the root endpoint. A trace will be generated and exported to the OTLP endpoint.
Expand Down

0 comments on commit 4ad44d0

Please sign in to comment.