Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
Signed-off-by: svrnm <[email protected]>
  • Loading branch information
svrnm committed Nov 8, 2023
1 parent 70d2249 commit 3f2e3dc
Showing 1 changed file with 37 additions and 36 deletions.
73 changes: 37 additions & 36 deletions content/en/docs/instrumentation/net/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,56 +103,57 @@ that will generate the telemetry, and set them up.

1. Add the packages

```shell
dotnet add package OpenTelemetry.Extensions.Hosting
dotnet add package OpenTelemetry.Instrumentation.AspNetCore --prerelease
dotnet add package OpenTelemetry.Exporter.Console
```

1. Setup the OpenTelemetry code

```csharp
var builder = WebApplication.CreateBuilder(args);
const string serviceName = "roll-dice";
builder.Logging.AddOpenTelemetry(options =>
{
options
.SetResourceBuilder(
ResourceBuilder.CreateDefault()
.AddService(serviceName))
.AddConsoleExporter();
});
builder.Services.AddOpenTelemetry()
.ConfigureResource(resource => resource.AddService(serviceName))
.WithTracing(tracing => tracing
.AddAspNetCoreInstrumentation()
.AddConsoleExporter())
.WithMetrics(metrics => metrics
.AddAspNetCoreInstrumentation()
.AddConsoleExporter());
```sh
dotnet add package OpenTelemetry.Extensions.Hosting
dotnet add package OpenTelemetry.Instrumentation.AspNetCore --prerelease
dotnet add package OpenTelemetry.Exporter.Console
```

var app = builder.Build();
```
2. Setup the OpenTelemetry code

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

const string serviceName = "roll-dice";

builder.Logging.AddOpenTelemetry(options =>
{
options
.SetResourceBuilder(
ResourceBuilder.CreateDefault()
.AddService(serviceName))
.AddConsoleExporter();
});
builder.Services.AddOpenTelemetry()
.ConfigureResource(resource => resource.AddService(serviceName))
.WithTracing(tracing => tracing
.AddAspNetCoreInstrumentation()
.AddConsoleExporter())
.WithMetrics(metrics => metrics
.AddAspNetCoreInstrumentation()
.AddConsoleExporter());

var app = builder.Build();
```

1. Run your **application** once again:
3. Run your **application** once again:

```sh
dotnet run
```

Note the output from the `dotnet run`.

1. From _another_ terminal, send a request using `curl`:
4. From _another_ terminal, send a request using `curl`:

```sh
curl localhost:8080/rolldice
```

1. After about 30 sec, stop the server process. At this point, you should see
trace and log output from the server and client that looks something like
this (output is line-wrapped for readability):
5. After about 30 sec, stop the server process.

At this point, you should see trace and log output from the server and client
that looks something like this (output is line-wrapped for readability):

<details>
<summary>Traces and Logs</summary>
Expand Down

0 comments on commit 3f2e3dc

Please sign in to comment.