@@ -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
2526Action < 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
8081Action < 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