From d5044a020bf592b9a15431e8b9572238326f83fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Mon, 14 Aug 2023 09:06:13 +0200 Subject: [PATCH 01/14] .NET Getting started - based on roll dice service and Automatic Instrumentation --- .../instrumentation/net/getting-started.md | 552 +++++++----------- static/refcache.json | 16 + 2 files changed, 240 insertions(+), 328 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index 540b4657694e..97546c446854 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -1,206 +1,257 @@ --- title: Getting Started +description: Get telemetry for your app in less than 5 minutes! +cSpell:ignore: ASPNETCORE rolldice weight: 10 -cSpell:ignore: KHTML loglevel nameof --- -OpenTelemetry for .NET is unique among OpenTelemetry implementations, as it is -integrated with the .NET `System.Diagnostics` library. At a high level, you can -think of OpenTelemetry for .NET as a bridge between the telemetry available -through `System.Diagnostics` and the greater OpenTelemetry ecosystem, such as -OpenTelemetry Protocol (OTLP) and the OpenTelemetry Collector. +This page will show you how to get started with OpenTelemetry in .NET. -## ASP.NET Core +You will learn how you can instrument a simple .NET application automatically, +in such a way that [traces][], [metrics][] and [logs][] are emitted to the +console. -The following example demonstrates using Instrumentation Libraries and manual -instrumentation via an ASP.NET Core app. +## Prerequisites -First, create your basic ASP.NET Core site: +Ensure that you have the following installed locally: -```shell -dotnet new mvc -``` +- [.NET SDK](https://dotnet.microsoft.com/download/dotnet) 6+ -Next, Add the Core OpenTelemetry packages +## Example Application -```shell -dotnet add package OpenTelemetry.Exporter.Console -dotnet add package OpenTelemetry.Extensions.Hosting -``` +The following example uses a basic +[Minimal API with ASP.NET Core](https://learn.microsoft.com/aspnet/core/tutorials/min-web-api) +application. If you are not using ASP.NET Core, that's OK — you can still use +OpenTelemetry .NET Automatic Instrumentation. -Now let's add the instrumentation packages for ASP.NET Core. This will give us -some automatic spans for each HTTP request to our app. +For more elaborate examples, see +[examples](/docs/instrumentation/net/examples/). -```shell -dotnet add package OpenTelemetry.Instrumentation.AspNetCore --prerelease -``` +### Dependencies -_Note that as the Semantic Conventions for attribute names are not currently -stable the instrumentation package is currently not in a released state. That -doesn't mean that the functionality itself is not stable. This means that you -need to use the `--prerelease` flag, or install a specific version of the -package_ +To begin, set up an environment in a new directory called `dotnet-simple`. +Within that directory, execute following command: -### Setup +```sh +dotnet new web +``` -Next, we need to add OpenTelemetry to our Service Collection in `Program.cs` so -that its listening correctly. +### Create and launch an HTTP Server + +In that same directory, modify a file called `Program.cs` and replace existing +content by the following code: ```csharp -using System.Diagnostics; -using OpenTelemetry.Resources; -using OpenTelemetry.Trace; +using System.Globalization; var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); -// .. other setup +var logger = app.Logger; +var random = new Random(); -builder.Services.AddOpenTelemetry() - .WithTracing(tracerProviderBuilder => - tracerProviderBuilder - .AddSource(DiagnosticsConfig.ActivitySource.Name) - .ConfigureResource(resource => resource - .AddService(DiagnosticsConfig.ServiceName)) - .AddAspNetCoreInstrumentation() - .AddConsoleExporter()); +app.MapGet("/rolldice/{player?}", HandleRollDice); -// ... other setup +app.Run(); +return; -public static class DiagnosticsConfig +int RollDice() { - public const string ServiceName = "MyService"; - public static ActivitySource ActivitySource = new ActivitySource(ServiceName); + return random.Next(1, 7); } -``` -At this stage, you should be able to run your site, and see a Console output -similar to this: +string HandleRollDice(string? player) +{ + var result = RollDice(); -Note: an `Activity` in .NET is analogous to a Span in OpenTelemetry terminology + if (string.IsNullOrEmpty(player)) + { + logger.LogInformation("Anonymous player is rolling the dice: {result}", result); + } + else + { + logger.LogInformation("{player} is rolling the dice: {result}", player, result); + } -
-View example output + return result.ToString(CultureInfo.InvariantCulture); +} -```properties -Activity.TraceId: 54d084eba205a7a39398df4642be8f4a -Activity.SpanId: aca5e39a86a17d59 -Activity.TraceFlags: Recorded -Activity.ActivitySourceName: Microsoft.AspNetCore -Activity.DisplayName: / -Activity.Kind: Server -Activity.StartTime: 2023-02-21T12:19:28.2499974Z -Activity.Duration: 00:00:00.3106744 -Activity.Tags: - net.host.name: localhost - net.host.port: 5123 - http.method: GET - http.scheme: http - http.target: / - http.url: http://localhost:5123/ - http.flavor: 1.1 - http.user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50 - http.status_code: 200 -Resource associated with Activity: - service.name: MyService - service.instance.id: 2c7ca153-e460-4643-b550-7c08487a4c0c ``` -
- -### Manual Instrumentation - -Next, add [tracing](/docs/concepts/signals/traces/) via the `System.Diagnostics` -API. +In the `Properties` subdirectory, modify a file called `launchSettings.json` and +replace existing content by the following code: -Paste the following code into your `HomeController`'s `Index` action: - -```csharp -public IActionResult Index() +```json { - // Track work inside of the request - using var activity = DiagnosticsConfig.ActivitySource.StartActivity("SayHello"); - activity?.SetTag("foo", 1); - activity?.SetTag("bar", "Hello, World!"); - activity?.SetTag("baz", new int[] { 1, 2, 3 }); - - return View(); + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:8080", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } } ``` -When you run the app and navigate to the `/` route, you'll see output about -[spans](/docs/concepts/signals/traces/#spans) similar to the following: +Build and run the application with the following command, then open + in your web browser to ensure it is working. -
-View example output +```sh +dotnet build +dotnet run +``` -```text -Activity.TraceId: 47d25efc8b5e9184ce57e692f5f65465 -Activity.SpanId: bb864adcf4592f54 +## Instrumentation + +Next, you'll use a [OpenTelemetry .NET Automatic Instrumentation](../automatic) +to instrument the application at launch time. While you can [configure .NET +Automatic Instrumentation][] in a number of ways, the steps below uses shell +scripts. + +1. Download [otel-dotnet-auto-install.sh][] from [Releases][] of the + `opentelemetry-dotnet-instrumentation/releases` repository. The file contains + the script which detect system and download appropriate instrumentation + version: + + ```sh + curl -L -O https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh + ``` + +2. Execute `otel-dotnet-auto-install.sh` script to download automatic + instrumentation: + + ```sh + ./otel-dotnet-auto-install.sh + ``` + +3. Set and export variables that specify a [console exporter][], then execute + shell script configuring other necessary environmental variables using a + notation suitable for your shell/terminal environment — we illustrate a + notation for bash-like shells: + + ```sh + export OTEL_TRACES_EXPORTER=none \ + OTEL_METRICS_EXPORTER=none \ + OTEL_LOGS_EXPORTER=none \ + OTEL_DOTNET_AUTO_TRACES_CONSOLE_EXPORTER_ENABLED=true \ + OTEL_DOTNET_AUTO_METRICS_CONSOLE_EXPORTER_ENABLED=true \ + OTEL_DOTNET_AUTO_LOGS_CONSOLE_EXPORTER_ENABLED=true + . $HOME/.otel-dotnet-auto/instrument.sh + ``` + +4. Run your **application** once again: + + ```sh + dotnet run + ``` + + Note the output from the `dotnet run`. + +5. From _another_ terminal, send a request using `curl`: + + ```sh + curl localhost:8080/rolldice + ``` + +6. Stop the server process. + +At step 6, you should have seen trace & log output from the server and client +that looks something like this (trace output is line-wrapped for convenience): + +```log +LogRecord.Timestamp: 2023-08-14T06:44:53.9279186Z +LogRecord.TraceId: 3961d22b5f90bf7662ad4933318743fe +LogRecord.SpanId: 93d5fcea422ff0ac +LogRecord.TraceFlags: Recorded +LogRecord.CategoryName: simple-dotnet +LogRecord.LogLevel: Information +LogRecord.StateValues (Key:Value): + result: 1 + OriginalFormat (a.k.a Body): Anonymous player is rolling the dice: {result} + +Resource associated with LogRecord: +service.name: simple-dotnet +telemetry.auto.version: 0.7.0 +telemetry.sdk.name: opentelemetry +telemetry.sdk.language: dotnet +telemetry.sdk.version: 1.4.0.802 + +LogRecord.Timestamp: 2023-08-14T06:44:53.9279186Z +LogRecord.TraceId: 3961d22b5f90bf7662ad4933318743fe +LogRecord.SpanId: 93d5fcea422ff0ac +LogRecord.TraceFlags: Recorded +LogRecord.CategoryName: simple-dotnet +LogRecord.LogLevel: Information +LogRecord.StateValues (Key:Value): + result: 1 + OriginalFormat (a.k.a Body): Anonymous player is rolling the dice: {result} + +Resource associated with LogRecord: +service.name: simple-dotnet +telemetry.auto.version: 0.7.0 +telemetry.sdk.name: opentelemetry +telemetry.sdk.language: dotnet +telemetry.sdk.version: 1.4.0.802 + +info: simple-dotnet[0] + Anonymous player is rolling the dice: 1 +Activity.TraceId: 3961d22b5f90bf7662ad4933318743fe +Activity.SpanId: 93d5fcea422ff0ac Activity.TraceFlags: Recorded -Activity.ParentSpanId: acbff23f5ad721ff -Activity.ActivitySourceName: MyService -Activity.DisplayName: SayHello -Activity.Kind: Internal -Activity.StartTime: 2023-02-21T12:27:41.9596458Z -Activity.Duration: 00:00:00.0005683 +Activity.ActivitySourceName: OpenTelemetry.Instrumentation.AspNetCore +Activity.DisplayName: /rolldice +Activity.Kind: Server +Activity.StartTime: 2023-08-14T06:44:53.9278162Z +Activity.Duration: 00:00:00.0049754 Activity.Tags: - foo: 1 - bar: Hello, World! - baz: [1,2,3] + net.host.name: localhost + net.host.port: 8080 + http.method: GET + http.scheme: http + http.target: /rolldice + http.url: http://localhost:8080/rolldice + http.flavor: 1.1 + http.user_agent: curl/8.0.1 + http.status_code: 200 Resource associated with Activity: - service.name: MyService - service.instance.id: 2b07a9ca-29c4-4e01-b0ed-929184b32192 + service.name: simple-dotnet + telemetry.auto.version: 0.7.0 + telemetry.sdk.name: opentelemetry + telemetry.sdk.language: dotnet + telemetry.sdk.version: 1.4.0.802 ``` -
- -You'll notice the `Activity` objects from ASP.NET Core alongside the `Activity` -we created manually in our controller action. +At step 6, when stopping the server, you should see an output of all the metrics +collected (metrics output is shortened for convenience): -### Metrics +```log +Export process.runtime.dotnet.gc.collections.count, Number of garbage collections that have occurred since process start., Meter: OpenTelemetry.Instrumentation.Runtime/1.1.0.2 +(2023-08-14T06:12:05.8500776Z, 2023-08-14T06:12:23.7750288Z] generation: gen2 LongSum +Value: 2 +(2023-08-14T06:12:05.8500776Z, 2023-08-14T06:12:23.7750288Z] generation: gen1 LongSum +Value: 2 +(2023-08-14T06:12:05.8500776Z, 2023-08-14T06:12:23.7750288Z] generation: gen0 LongSum +Value: 6 -Next we'll add the ASP.NET Core automatically generated metrics to the app. +... -```csharp -using OpenTelemetry.Resources; -using OpenTelemetry.Trace; -using OpenTelemetry.Metrics; - -var builder = WebApplication.CreateBuilder(args); - -// .. other setup - -builder.Services.AddOpenTelemetry() - .WithTracing(/* .. tracing setup */ ) - .WithMetrics(metricsProviderBuilder => - metricsProviderBuilder - .ConfigureResource(resource => resource - .AddService(DiagnosticsConfig.ServiceName)) - .AddAspNetCoreInstrumentation() - .AddConsoleExporter()); - -// .. other setup -``` - -If you run your application now, you'll see a series of metrics output to the -console. like this. - -
-View example output - -```text -Export http.server.duration, Measures the duration of inbound HTTP requests., Unit: ms, Meter: OpenTelemetry.Instrumentation.AspNetCore/1.0.0.0 -(2023-02-21T12:38:57.0187781Z, 2023-02-21T12:44:16.9651349Z] http.flavor: 1.1 http.method: GET http.route: {controller=Home}/{action=Index}/{id?} http.scheme: http http.status_code: 200 net.host.name: localhost net.host.port: 5123 Histogram -Value: Sum: 373.4504 Count: 1 Min: 373.4504 Max: 373.4504 +Export http.client.duration, Measures the duration of outbound HTTP requests., Unit: ms, Meter: OpenTelemetry.Instrumentation.Http/1.0.0.0 +(2023-08-14T06:12:06.2661140Z, 2023-08-14T06:12:23.7750388Z] http.flavor: 1.1 http.method: POST http.scheme: https http.status_code: 200 net.peer.name: dc.services.visualstudio.com Histogram +Value: Sum: 1330.4766000000002 Count: 5 Min: 50.0333 Max: 465.7936 (-Infinity,0]:0 (0,5]:0 (5,10]:0 (10,25]:0 (25,50]:0 -(50,75]:0 +(50,75]:2 (75,100]:0 (100,250]:0 -(250,500]:1 +(250,500]:3 (500,750]:0 (750,1000]:0 (1000,2500]:0 @@ -208,184 +259,29 @@ Value: Sum: 373.4504 Count: 1 Min: 373.4504 Max: 373.4504 (5000,7500]:0 (7500,10000]:0 (10000,+Infinity]:0 - ``` -
- -### Manual Metrics - -Next, add some manual metrics to the app. This will initialize a -[Meter](/docs/concepts/signals/metrics) to create a counter in code. - -```csharp -var builder = WebApplication.CreateBuilder(args); - -// .. other setup - -builder.Services.AddOpenTelemetry() - .WithTracing(/* .. tracing setup */ ) - .WithMetrics(metricsProviderBuilder => - metricsProviderBuilder - .AddMeter(DiagnosticsConfig.Meter.Name) - // .. more metrics - ); - -public static class DiagnosticsConfig -{ - public const string ServiceName = "MyService"; - - // .. other config - - public static Meter Meter = new(ServiceName); - public static Counter RequestCounter = - Meter.CreateCounter("app.request_counter"); -} - -``` - -Now we can increment the counter in our `Index` action. - -```csharp - public IActionResult Index() - { - // do other stuff - - DiagnosticsConfig.RequestCounter.Add(1, - new("Action", nameof(Index)), - new("Controller", nameof(HomeController))); - - return View(); - } -``` - -You'll notice here that we're also adding Tags (OpenTelemetry Attributes) to our -request counter that distinguishes it from other requests. You should now see an -output like this. - -
-View example output - -```text -Export app.request_counter, Meter: MyService -(2023-02-21T13:11:28.7265324Z, 2023-02-21T13:11:48.7074259Z] Action: Index Controller: HomeController LongSum -Value: 1 -``` - -
- -Tip: if you comment out the `.AddAspNetCoreInstrumentation()` line in -`Program.cs` you'll be able to see the output better. - -## Send data to a collector - -The [OpenTelemetry Collector](/docs/collector/getting-started/) is a vital -component of most production deployments. A collector is most beneficial in the -following situations, among others: - -- A single telemetry sink shared by multiple services, to reduce overhead of - switching exporters -- Aggregate traces across multiple services, running on multiple hosts -- A central place to process traces prior to exporting them to a backend - -### Configure and run a local collector - -First, save the following collector configuration code to a file in the `/tmp/` -directory: - -```yaml -# /tmp/otel-collector-config.yaml -receivers: - otlp: - protocols: - http: - grpc: -exporters: - logging: - loglevel: debug -processors: - batch: -service: - pipelines: - traces: - receivers: [otlp] - exporters: [logging] - processors: [batch] - metrics: - receivers: [otlp] - exporters: [logging] - processors: [batch] -``` - -Then run the docker command to acquire and run the collector based on this -configuration: - -```shell -docker run -p 4317:4317 \ - -v /tmp/otel-collector-config.yaml:/etc/otel-collector-config.yaml \ - otel/opentelemetry-collector:latest \ - --config=/etc/otel-collector-config.yaml -``` - -You will now have an collector instance running locally. - -### Modify the code to export spans via OTLP - -The next step is to modify the code to send spans to the collector via OTLP -instead of the console. - -First, add the following package: - -```shell -dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol -``` - -Next, using the ASP.NET Core code from earlier, replace the console exporter -with an OTLP exporter: - -```csharp -builder.Services.AddOpenTelemetry() - .WithTracing(tracerProviderBuilder => - tracerProviderBuilder - // .. other config - .AddOtlpExporter()) - .WithMetrics(metricsProviderBuilder => - metricsProviderBuilder - // .. other config - .AddOtlpExporter()); -``` - -By default, it will send spans to `localhost:4317`, which is what the collector -is listening on if you've followed the step above. - -### Run the application - -Run the application like before: - -```shell -dotnet run -``` - -Now, telemetry will be output by the collector process. - -## Next steps - -To ensure you're getting the most data as easily as possible, install -[instrumentation libraries](/docs/instrumentation/net/libraries) to generate -observability data. - -Additionally, enriching your codebase with -[manual instrumentation](/docs/instrumentation/net/manual) gives you customized -observability data. - -You'll also want to configure an appropriate exporter to -[export your telemetry data](/docs/instrumentation/net/exporters) to one or more -telemetry backends. - -You can also check the -[automatic instrumentation for .NET](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation), -which is currently in beta. - -If you'd like to explore a more complex example, take a look at the -[OpenTelemetry Demo](/docs/demo/), which includes the .NET based -[Cart Service](/docs/demo/services/cart/). +## What next? + +For more: + +- Run this example with another [exporter][] for telemetry data. +- Try [automatic instrumentation](../automatic/) on one of your own apps. +- Learn about [manual instrumentation][] and try out more + [examples](/docs/instrumentation/java/examples/). +- Take a look at the [OpenTelemetry Demo](/docs/demo/), which includes .NET + based [Cart Service](/docs/demo/services/cart/). + +[traces]: /docs/concepts/signals/traces/ +[metrics]: /docs/concepts/signals/metrics/ +[logs]: /docs/concepts/signals/logs/ +[configure .NET Automatic Instrumentation]: ../automatic +[console exporter]: + https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/config.md#internal-logs +[exporter]: + https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/config.md#exporters +[manual instrumentation]: ../manual +[otel-dotnet-auto-install.sh]: + https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh +[releases]: + https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases diff --git a/static/refcache.json b/static/refcache.json index 8f557b1157b7..9f22ba4f60b7 100644 --- a/static/refcache.json +++ b/static/refcache.json @@ -1271,6 +1271,10 @@ "StatusCode": 200, "LastSeen": "2023-06-29T15:46:44.824874-04:00" }, + "https://dotnet.microsoft.com/download": { + "StatusCode": 200, + "LastSeen": "2023-08-14T07:27:50.575755318Z" + }, "https://dotnet.microsoft.com/download/dotnet": { "StatusCode": 200, "LastSeen": "2023-08-01T12:16:39.990619752Z" @@ -2427,10 +2431,18 @@ "StatusCode": 200, "LastSeen": "2023-06-30T09:25:10.121533-04:00" }, + "https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases": { + "StatusCode": 200, + "LastSeen": "2023-08-14T07:27:52.35566079Z" + }, "https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest": { "StatusCode": 200, "LastSeen": "2023-06-30T08:44:58.585689-04:00" }, + "https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh": { + "StatusCode": 206, + "LastSeen": "2023-08-14T07:27:51.68749521Z" + }, "https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/tag/v0.1.0-beta.1": { "StatusCode": 200, "LastSeen": "2023-06-30T09:25:04.874497-04:00" @@ -3559,6 +3571,10 @@ "StatusCode": 206, "LastSeen": "2023-06-29T16:21:28.969704-04:00" }, + "https://learn.microsoft.com/aspnet/core/tutorials/min-web-api": { + "StatusCode": 200, + "LastSeen": "2023-08-14T07:27:51.174082501Z" + }, "https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id": { "StatusCode": 200, "LastSeen": "2023-06-30T09:16:26.155249-04:00" From 0506b58b2de2fd3dac7dac7b11ffd896e040739b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Wed, 16 Aug 2023 08:23:51 +0200 Subject: [PATCH 02/14] Apply suggestions from code review Co-authored-by: Patrice Chalin --- .../instrumentation/net/getting-started.md | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index 97546c446854..d206be2ece77 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -3,6 +3,7 @@ title: Getting Started description: Get telemetry for your app in less than 5 minutes! cSpell:ignore: ASPNETCORE rolldice weight: 10 +dotnet-auto-install-URL: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh --- This page will show you how to get started with OpenTelemetry in .NET. @@ -38,8 +39,7 @@ dotnet new web ### Create and launch an HTTP Server -In that same directory, modify a file called `Program.cs` and replace existing -content by the following code: +In the same directory, replace the content of `Program.cs` with the following code: ```csharp using System.Globalization; @@ -78,8 +78,7 @@ string HandleRollDice(string? player) ``` -In the `Properties` subdirectory, modify a file called `launchSettings.json` and -replace existing content by the following code: +In the `Properties` subdirectory, replace the content of `launchSettings.json` with the following: ```json { @@ -113,17 +112,15 @@ to instrument the application at launch time. While you can [configure .NET Automatic Instrumentation][] in a number of ways, the steps below uses shell scripts. -1. Download [otel-dotnet-auto-install.sh][] from [Releases][] of the - `opentelemetry-dotnet-instrumentation/releases` repository. The file contains - the script which detect system and download appropriate instrumentation - version: +1. Download [otel-dotnet-auto-install.sh]({{% _param dotnet-auto-install-URL + %}}) from [Releases][] of the `opentelemetry-dotnet-instrumentation` repository: ```sh - curl -L -O https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh + curl -L -O {{% _param dotnet-auto-install-URL %}} ``` 2. Execute `otel-dotnet-auto-install.sh` script to download automatic - instrumentation: + instrumentation for your development environment: ```sh ./otel-dotnet-auto-install.sh @@ -160,8 +157,8 @@ scripts. 6. Stop the server process. -At step 6, you should have seen trace & log output from the server and client -that looks something like this (trace output is line-wrapped for convenience): +At step 6, you should have seen trace and log output from the server and client +that looks something like this (output is line-wrapped for readability): ```log LogRecord.Timestamp: 2023-08-14T06:44:53.9279186Z @@ -226,8 +223,8 @@ Resource associated with Activity: telemetry.sdk.version: 1.4.0.802 ``` -At step 6, when stopping the server, you should see an output of all the metrics -collected (metrics output is shortened for convenience): +Also when stopping the server, you should see an output of all the metrics +collected (sample excerpt shown): ```log Export process.runtime.dotnet.gc.collections.count, Number of garbage collections that have occurred since process start., Meter: OpenTelemetry.Instrumentation.Runtime/1.1.0.2 @@ -268,7 +265,7 @@ For more: - Run this example with another [exporter][] for telemetry data. - Try [automatic instrumentation](../automatic/) on one of your own apps. - Learn about [manual instrumentation][] and try out more - [examples](/docs/instrumentation/java/examples/). + [examples](/docs/instrumentation/net/examples/). - Take a look at the [OpenTelemetry Demo](/docs/demo/), which includes .NET based [Cart Service](/docs/demo/services/cart/). @@ -281,7 +278,5 @@ For more: [exporter]: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/docs/config.md#exporters [manual instrumentation]: ../manual -[otel-dotnet-auto-install.sh]: - https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh [releases]: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases From 323f3cd22e67bbe176e7fc41242d075236bf37c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Wed, 16 Aug 2023 08:30:47 +0200 Subject: [PATCH 03/14] remove dependencies section --- content/en/docs/instrumentation/net/getting-started.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index d206be2ece77..287749a19580 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -28,7 +28,7 @@ OpenTelemetry .NET Automatic Instrumentation. For more elaborate examples, see [examples](/docs/instrumentation/net/examples/). -### Dependencies +### Create and launch an HTTP Server To begin, set up an environment in a new directory called `dotnet-simple`. Within that directory, execute following command: @@ -37,8 +37,6 @@ Within that directory, execute following command: dotnet new web ``` -### Create and launch an HTTP Server - In the same directory, replace the content of `Program.cs` with the following code: ```csharp From c8693f4f3d7da9affbc4d69fc5bc9abedaf92f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Wed, 16 Aug 2023 17:20:19 +0200 Subject: [PATCH 04/14] Apply suggestions from code review Co-authored-by: Patrice Chalin --- content/en/docs/instrumentation/net/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index 287749a19580..fbb216751419 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -153,9 +153,9 @@ scripts. curl localhost:8080/rolldice ``` -6. Stop the server process. +6. After about 30 sec, stop the server process. -At step 6, you should have seen trace and log output from the server and client +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): ```log From be16fd18ded37b5bc9291026e0d10b627d360659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Wed, 16 Aug 2023 17:27:29 +0200 Subject: [PATCH 05/14] collapsible logs --- content/en/docs/instrumentation/net/getting-started.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index fbb216751419..6d1ffc310c30 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -158,6 +158,9 @@ scripts. 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): +
+Traces and logs + ```log LogRecord.Timestamp: 2023-08-14T06:44:53.9279186Z LogRecord.TraceId: 3961d22b5f90bf7662ad4933318743fe @@ -221,9 +224,14 @@ Resource associated with Activity: telemetry.sdk.version: 1.4.0.802 ``` +
+ Also when stopping the server, you should see an output of all the metrics collected (sample excerpt shown): +
+Metrics + ```log Export process.runtime.dotnet.gc.collections.count, Number of garbage collections that have occurred since process start., Meter: OpenTelemetry.Instrumentation.Runtime/1.1.0.2 (2023-08-14T06:12:05.8500776Z, 2023-08-14T06:12:23.7750288Z] generation: gen2 LongSum @@ -256,6 +264,8 @@ Value: Sum: 1330.4766000000002 Count: 5 Min: 50.0333 Max: 465.7936 (10000,+Infinity]:0 ``` +
+ ## What next? For more: From c67c1c9b3ec7d07bdece6d4ce244900df3234662 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 18 Aug 2023 09:57:17 +0200 Subject: [PATCH 06/14] Add powershell script --- content-modules/opentelemetry-go | 1 + .../instrumentation/net/getting-started.md | 60 ++++++++++++++++--- 2 files changed, 52 insertions(+), 9 deletions(-) create mode 160000 content-modules/opentelemetry-go diff --git a/content-modules/opentelemetry-go b/content-modules/opentelemetry-go new file mode 160000 index 000000000000..fadd3d6a63fe --- /dev/null +++ b/content-modules/opentelemetry-go @@ -0,0 +1 @@ +Subproject commit fadd3d6a63fe622bc3d5f08fba090e9abeb8db2e diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index d94465664e09..a28e5ae77263 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -3,7 +3,8 @@ title: Getting Started description: Get telemetry for your app in less than 5 minutes! cSpell:ignore: ASPNETCORE rolldice weight: 10 -dotnet-auto-install-URL: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh +dotnet-auto-install-sh-URL: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh +dotnet-auto-install-ps-URL: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/OpenTelemetry.DotNet.Auto.psm1 --- This page will show you how to get started with OpenTelemetry in .NET. @@ -108,27 +109,53 @@ dotnet run Next, you'll use a [OpenTelemetry .NET Automatic Instrumentation](../automatic) to instrument the application at launch time. While you can [configure .NET -Automatic Instrumentation][] in a number of ways, the steps below uses shell -scripts. +Automatic Instrumentation][] in a number of ways, the steps below uses Unix-shell +or PowerShell scripts. -1. Download [otel-dotnet-auto-install.sh]({{% _param dotnet-auto-install-URL - %}}) from [Releases][] of the `opentelemetry-dotnet-instrumentation` repository: +> **Note**: PowerShell commands require elevated (administrator) privileges. + +1. Download installation scripts from [Releases][] of the `opentelemetry-dotnet-instrumentation` repository: + + {{< tabpane text=true >}} {{% tab Unix-shell %}} ```sh - curl -L -O {{% _param dotnet-auto-install-URL %}} + curl -L -O {{% _param dotnet-auto-install-sh-URL %}} + ``` + + {{% /tab %}} {{% tab PowerShell (Windows) %}} + + ```powershell + $module_url = "{{% _param dotnet-auto-install-ps-URL %}}" + $download_path = Join-Path $env:temp "OpenTelemetry.DotNet.Auto.psm1" + Invoke-WebRequest -Uri $module_url -OutFile $download_path -UseBasicParsing ``` -2. Execute `otel-dotnet-auto-install.sh` script to download automatic + {% /tab %}} {{< /tabpane >}} + +2. Execute following script to download automatic instrumentation for your development environment: + {{< tabpane text=true >}} {{% tab Unix-shell %}} + ```sh ./otel-dotnet-auto-install.sh ``` + {{% /tab %}} {{% tab PowerShell (Windows) %}} + + ```powershell + Import-Module $download_path + Install-OpenTelemetryCore + ``` + + {% /tab %}} {{< /tabpane >}} + 3. Set and export variables that specify a [console exporter][], then execute - shell script configuring other necessary environmental variables using a + script configuring other necessary environmental variables using a notation suitable for your shell/terminal environment — we illustrate a - notation for bash-like shells: + notation for bash-like shells and PowerShell: + + {{< tabpane text=true >}} {{% tab Unix-shell %}} ```sh export OTEL_TRACES_EXPORTER=none \ @@ -137,9 +164,24 @@ scripts. OTEL_DOTNET_AUTO_TRACES_CONSOLE_EXPORTER_ENABLED=true \ OTEL_DOTNET_AUTO_METRICS_CONSOLE_EXPORTER_ENABLED=true \ OTEL_DOTNET_AUTO_LOGS_CONSOLE_EXPORTER_ENABLED=true + OTEL_SERVICE_NAME=RollDiceService . $HOME/.otel-dotnet-auto/instrument.sh ``` + {{% /tab %}} {{% tab PowerShell (Windows) %}} + + ```powershell + $env:OTEL_TRACES_EXPORTER="none" + $env:OTEL_METRICS_EXPORTER="none" + $env:OTEL_LOGS_EXPORTER="none" + $env:OTEL_DOTNET_AUTO_TRACES_CONSOLE_EXPORTER_ENABLED="true" + $env:OTEL_DOTNET_AUTO_METRICS_CONSOLE_EXPORTER_ENABLED="true" + $env:OTEL_DOTNET_AUTO_LOGS_CONSOLE_EXPORTER_ENABLED="true" + Register-OpenTelemetryForCurrentSession -OTelServiceName "RollDiceService" + ``` + + {% /tab %}} {{< /tabpane >}} + 4. Run your **application** once again: ```sh From 43c4d6b8214852bd635d69a4b24ce7e785a430d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 18 Aug 2023 09:58:20 +0200 Subject: [PATCH 07/14] reorganize code --- content/en/docs/instrumentation/net/getting-started.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index a28e5ae77263..36673a35703a 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -50,11 +50,6 @@ var app = builder.Build(); var logger = app.Logger; var random = new Random(); -app.MapGet("/rolldice/{player?}", HandleRollDice); - -app.Run(); -return; - int RollDice() { return random.Next(1, 7); @@ -75,6 +70,10 @@ string HandleRollDice(string? player) return result.ToString(CultureInfo.InvariantCulture); } + +app.MapGet("/rolldice/{player?}", HandleRollDice); + +app.Run(); ``` In the `Properties` subdirectory, replace the content of `launchSettings.json` From dc3503fc9ea502b56f3a882798360b4ddffc0024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 18 Aug 2023 10:02:13 +0200 Subject: [PATCH 08/14] npm run format --- .../docs/instrumentation/net/getting-started.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index 36673a35703a..14615f703ce6 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -108,12 +108,13 @@ dotnet run Next, you'll use a [OpenTelemetry .NET Automatic Instrumentation](../automatic) to instrument the application at launch time. While you can [configure .NET -Automatic Instrumentation][] in a number of ways, the steps below uses Unix-shell -or PowerShell scripts. +Automatic Instrumentation][] in a number of ways, the steps below uses +Unix-shell or PowerShell scripts. > **Note**: PowerShell commands require elevated (administrator) privileges. -1. Download installation scripts from [Releases][] of the `opentelemetry-dotnet-instrumentation` repository: +1. Download installation scripts from [Releases][] of the + `opentelemetry-dotnet-instrumentation` repository: {{< tabpane text=true >}} {{% tab Unix-shell %}} @@ -131,8 +132,8 @@ or PowerShell scripts. {% /tab %}} {{< /tabpane >}} -2. Execute following script to download automatic - instrumentation for your development environment: +2. Execute following script to download automatic instrumentation for your + development environment: {{< tabpane text=true >}} {{% tab Unix-shell %}} @@ -150,9 +151,9 @@ or PowerShell scripts. {% /tab %}} {{< /tabpane >}} 3. Set and export variables that specify a [console exporter][], then execute - script configuring other necessary environmental variables using a - notation suitable for your shell/terminal environment — we illustrate a - notation for bash-like shells and PowerShell: + script configuring other necessary environmental variables using a notation + suitable for your shell/terminal environment — we illustrate a notation + for bash-like shells and PowerShell: {{< tabpane text=true >}} {{% tab Unix-shell %}} From 12fc0c12dcc73327e9654f51022ce2521bb95aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 18 Aug 2023 11:18:10 +0200 Subject: [PATCH 09/14] fixup! Add powershell script --- content-modules/opentelemetry-go | 1 - 1 file changed, 1 deletion(-) delete mode 160000 content-modules/opentelemetry-go diff --git a/content-modules/opentelemetry-go b/content-modules/opentelemetry-go deleted file mode 160000 index fadd3d6a63fe..000000000000 --- a/content-modules/opentelemetry-go +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fadd3d6a63fe622bc3d5f08fba090e9abeb8db2e From 333d4e59b084c2b16f6573b0830264e4915a4c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 18 Aug 2023 11:33:52 +0200 Subject: [PATCH 10/14] fix tab names --- content/en/docs/instrumentation/net/getting-started.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index 14615f703ce6..ac710f2452d7 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -122,7 +122,7 @@ Unix-shell or PowerShell scripts. curl -L -O {{% _param dotnet-auto-install-sh-URL %}} ``` - {{% /tab %}} {{% tab PowerShell (Windows) %}} + {{% /tab %}} {{% tab PowerShell - Windows %}} ```powershell $module_url = "{{% _param dotnet-auto-install-ps-URL %}}" @@ -141,7 +141,7 @@ Unix-shell or PowerShell scripts. ./otel-dotnet-auto-install.sh ``` - {{% /tab %}} {{% tab PowerShell (Windows) %}} + {{% /tab %}} {{% tab PowerShell - Windows %}} ```powershell Import-Module $download_path @@ -168,7 +168,7 @@ Unix-shell or PowerShell scripts. . $HOME/.otel-dotnet-auto/instrument.sh ``` - {{% /tab %}} {{% tab PowerShell (Windows) %}} + {{% /tab %}} {{% tab PowerShell - Windows %}} ```powershell $env:OTEL_TRACES_EXPORTER="none" From fb798a9e674b2672ce8cb082a54934798bcc623f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 18 Aug 2023 11:37:11 +0200 Subject: [PATCH 11/14] fix closing tab --- content/en/docs/instrumentation/net/getting-started.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index ac710f2452d7..c8528f9cf6e0 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -130,7 +130,7 @@ Unix-shell or PowerShell scripts. Invoke-WebRequest -Uri $module_url -OutFile $download_path -UseBasicParsing ``` - {% /tab %}} {{< /tabpane >}} + {{% /tab %}} {{< /tabpane >}} 2. Execute following script to download automatic instrumentation for your development environment: @@ -148,7 +148,7 @@ Unix-shell or PowerShell scripts. Install-OpenTelemetryCore ``` - {% /tab %}} {{< /tabpane >}} + {{% /tab %}} {{< /tabpane >}} 3. Set and export variables that specify a [console exporter][], then execute script configuring other necessary environmental variables using a notation @@ -180,7 +180,7 @@ Unix-shell or PowerShell scripts. Register-OpenTelemetryForCurrentSession -OTelServiceName "RollDiceService" ``` - {% /tab %}} {{< /tabpane >}} + {{% /tab %}} {{< /tabpane >}} 4. Run your **application** once again: From 1f1231166784281c70b4f5b394703cbbb37f86de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 18 Aug 2023 14:07:22 +0200 Subject: [PATCH 12/14] remove duplicated log entry --- .../docs/instrumentation/net/getting-started.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index c8528f9cf6e0..e2cd3fb22df3 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -222,23 +222,6 @@ telemetry.sdk.name: opentelemetry telemetry.sdk.language: dotnet telemetry.sdk.version: 1.4.0.802 -LogRecord.Timestamp: 2023-08-14T06:44:53.9279186Z -LogRecord.TraceId: 3961d22b5f90bf7662ad4933318743fe -LogRecord.SpanId: 93d5fcea422ff0ac -LogRecord.TraceFlags: Recorded -LogRecord.CategoryName: simple-dotnet -LogRecord.LogLevel: Information -LogRecord.StateValues (Key:Value): - result: 1 - OriginalFormat (a.k.a Body): Anonymous player is rolling the dice: {result} - -Resource associated with LogRecord: -service.name: simple-dotnet -telemetry.auto.version: 0.7.0 -telemetry.sdk.name: opentelemetry -telemetry.sdk.language: dotnet -telemetry.sdk.version: 1.4.0.802 - info: simple-dotnet[0] Anonymous player is rolling the dice: 1 Activity.TraceId: 3961d22b5f90bf7662ad4933318743fe From 84c26e2f1983510fd40bc5b9df32ff59099e6185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Fri, 18 Aug 2023 14:08:24 +0200 Subject: [PATCH 13/14] typo fix --- content/en/docs/instrumentation/net/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index e2cd3fb22df3..bb8d4f7d41ad 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -108,8 +108,8 @@ dotnet run Next, you'll use a [OpenTelemetry .NET Automatic Instrumentation](../automatic) to instrument the application at launch time. While you can [configure .NET -Automatic Instrumentation][] in a number of ways, the steps below uses -Unix-shell or PowerShell scripts. +Automatic Instrumentation][] in a number of ways, the steps below use Unix-shell +or PowerShell scripts. > **Note**: PowerShell commands require elevated (administrator) privileges. From 6d132a9c28c0e47f2284a76868b9a0d0f22f1422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Mon, 21 Aug 2023 06:45:11 +0200 Subject: [PATCH 14/14] PR feedback --- .../en/docs/instrumentation/net/getting-started.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/content/en/docs/instrumentation/net/getting-started.md b/content/en/docs/instrumentation/net/getting-started.md index bb8d4f7d41ad..7bb388bfef4f 100644 --- a/content/en/docs/instrumentation/net/getting-started.md +++ b/content/en/docs/instrumentation/net/getting-started.md @@ -3,8 +3,6 @@ title: Getting Started description: Get telemetry for your app in less than 5 minutes! cSpell:ignore: ASPNETCORE rolldice weight: 10 -dotnet-auto-install-sh-URL: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh -dotnet-auto-install-ps-URL: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/OpenTelemetry.DotNet.Auto.psm1 --- This page will show you how to get started with OpenTelemetry in .NET. @@ -48,11 +46,10 @@ var builder = WebApplication.CreateBuilder(args); var app = builder.Build(); var logger = app.Logger; -var random = new Random(); int RollDice() { - return random.Next(1, 7); + return Random.Shared.Next(1, 7); } string HandleRollDice(string? player) @@ -119,13 +116,13 @@ or PowerShell scripts. {{< tabpane text=true >}} {{% tab Unix-shell %}} ```sh - curl -L -O {{% _param dotnet-auto-install-sh-URL %}} + curl -L -O https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/otel-dotnet-auto-install.sh ``` {{% /tab %}} {{% tab PowerShell - Windows %}} ```powershell - $module_url = "{{% _param dotnet-auto-install-ps-URL %}}" + $module_url = "https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest/download/OpenTelemetry.DotNet.Auto.psm1" $download_path = Join-Path $env:temp "OpenTelemetry.DotNet.Auto.psm1" Invoke-WebRequest -Uri $module_url -OutFile $download_path -UseBasicParsing ``` @@ -151,7 +148,7 @@ or PowerShell scripts. {{% /tab %}} {{< /tabpane >}} 3. Set and export variables that specify a [console exporter][], then execute - script configuring other necessary environmental variables using a notation + script configuring other necessary environment variables using a notation suitable for your shell/terminal environment — we illustrate a notation for bash-like shells and PowerShell: @@ -202,7 +199,7 @@ 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):
-Traces and logs +Traces and Logs ```log LogRecord.Timestamp: 2023-08-14T06:44:53.9279186Z