Skip to content

Commit 4b66499

Browse files
Kielektheletterfcartermpmviitane
authored
[demo/cartservice] Add support for logs (#3213)
Co-authored-by: Fabrizio Ferri-Benedetti <[email protected]> Co-authored-by: Phillip Carter <[email protected]> Co-authored-by: Mikko Viitanen <[email protected]>
1 parent 7aa2911 commit 4b66499

File tree

1 file changed

+18
-10
lines changed
  • content/en/docs/demo/services

1 file changed

+18
-10
lines changed

content/en/docs/demo/services/cart.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ with a Redis caching service for fast access to shopping cart data.
99

1010
[Cart service source](https://github.com/open-telemetry/opentelemetry-demo/blob/main/src/cartservice/)
1111

12-
> **Note** OpenTelemetry for .NET uses the `System.Diagnostic` library as its
13-
> API in lieu of the standard OpenTelemetry API.
12+
> **Note** OpenTelemetry for .NET uses the `System.Diagnostic.DiagnosticSource`
13+
> library as its API instead of the standard OpenTelemetry API for Traces and
14+
> Metrics. `Microsoft.Extensions.Logging.Abstractions` library is used for Logs.
1415
1516
## Traces
1617

1718
### Initializing Tracing
1819

19-
OpenTelemetry is configured in the .NET DI container. The `AddOpenTelemetry()`
20-
builder method is used to configure desired instrumentation libraries, add
21-
exporters, and set other options. Configuration of the exporter and resource
22-
attributes is performed through environment variables.
20+
OpenTelemetry is configured in the .NET dependency injection container. The
21+
`AddOpenTelemetry()` builder method is used to configure desired instrumentation
22+
libraries, add exporters, and set other options. Configuration of the exporter
23+
and resource attributes is performed through environment variables.
2324

2425
```cs
2526
Action<ResourceBuilder> appResourceBuilder =
@@ -72,9 +73,9 @@ activity?.AddEvent(new("Fetch cart"));
7273

7374
### Initializing Metrics
7475

75-
Similar to configuring OpenTelemetry Traces, the .NET DI container requires a
76-
call to `AddOpenTelemetry()`. This builder configures desired instrumentation
77-
libraries, exporters, etc.
76+
Similar to configuring OpenTelemetry Traces, the .NET dependency injection
77+
container requires a call to `AddOpenTelemetry()`. This builder configures
78+
desired instrumentation libraries, exporters, etc.
7879

7980
```cs
8081
Action<ResourceBuilder> appResourceBuilder =
@@ -91,4 +92,11 @@ builder.Services.AddOpenTelemetry()
9192

9293
## Logs
9394

94-
TBD
95+
Logs are configured in the .NET dependency injection container on
96+
`LoggingBuilder` level by calling `AddOpenTelemetry()`. This builder configures
97+
desired options, exporters, etc.
98+
99+
```cs
100+
builder.Logging
101+
.AddOpenTelemetry(options => options.AddOtlpExporter());
102+
```

0 commit comments

Comments
 (0)