Skip to content

Commit

Permalink
Update cart.md (#2607)
Browse files Browse the repository at this point in the history
  • Loading branch information
julianocosta89 authored Apr 16, 2023
1 parent d72ba3a commit 8561087
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions content/en/docs/demo/services/cart.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ exporters, and set other options. Configuration of the exporter and resource
attributes is performed through environment variables.

```cs
services.AddOpenTelemetry().WithTracing(builder => builder
.ConfigureResource(r => r
Action<ResourceBuilder> appResourceBuilder =
resource => resource
.AddTelemetrySdk()
.AddEnvironmentVariableDetector()
.AddDetector(new DockerResourceDetector())
)
.AddRedisInstrumentation(
cartStore.GetConnection(),
options => options.SetVerboseDatabaseStatements = true)
.AddAspNetCoreInstrumentation()
.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation()
.AddOtlpExporter());
.AddDetector(new ContainerResourceDetector());

builder.Services.AddOpenTelemetry()
.ConfigureResource(appResourceBuilder)
.WithTracing(builder => builder
.AddRedisInstrumentation(
cartStore.GetConnection(),
options => options.SetVerboseDatabaseStatements = true)
.AddAspNetCoreInstrumentation()
.AddGrpcClientInstrumentation()
.AddHttpClientInstrumentation()
.AddOtlpExporter());
```

### Add attributes to auto-instrumented spans
Expand Down Expand Up @@ -76,15 +79,18 @@ call to `AddOpenTelemetry()`. This builder configures desired instrumentation
libraries, exporters, etc.

```cs
services.AddOpenTelemetry().WithMetrics(builder => builder
.ConfigureResource(r => r
Action<ResourceBuilder> appResourceBuilder =
resource => resource
.AddTelemetrySdk()
.AddEnvironmentVariableDetector()
.AddDetector(new DockerResourceDetector())
)
.AddRuntimeInstrumentation()
.AddAspNetCoreInstrumentation()
.AddOtlpExporter());
.AddDetector(new ContainerResourceDetector());

builder.Services.AddOpenTelemetry()
.ConfigureResource(appResourceBuilder)
.WithMetrics(builder => builder
.AddRuntimeInstrumentation()
.AddAspNetCoreInstrumentation()
.AddOtlpExporter());
```

## Logs
Expand Down

0 comments on commit 8561087

Please sign in to comment.