Skip to content

Commit c3b790c

Browse files
authored
Enable Prettier check over instrumentation/net (open-telemetry#2368)
1 parent fc0c48b commit c3b790c

File tree

10 files changed

+131
-123
lines changed

10 files changed

+131
-123
lines changed

.prettierignore

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ content/en/docs/instrumentation/cpp
2424
content/en/docs/instrumentation/erlang
2525
content/en/docs/instrumentation/go
2626
content/en/docs/instrumentation/js
27-
content/en/docs/instrumentation/net
2827
content/en/docs/instrumentation/other
2928
content/en/docs/instrumentation/php
3029
content/en/docs/instrumentation/ruby
+11-12
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
title: .NET
33
description: >
4-
<img width="35" class="img-initial"
5-
src="/img/logos/32x32/.NET.svg"
6-
alt=".NET"></img>
7-
A language-specific implementation of OpenTelemetry in .NET.
4+
<img width="35" class="img-initial" src="/img/logos/32x32/.NET.svg"
5+
alt=".NET"></img> A language-specific implementation of OpenTelemetry in .NET.
86
aliases: [/csharp, /csharp/metrics, /csharp/tracing]
97
weight: 12
108
---
@@ -17,19 +15,20 @@ stable, the [OTLP Log Exporter][] is still non-stable.
1715

1816
## Version Support
1917

20-
OpenTelemetry for .NET supports all officially supported versions of [.NET
21-
Core](https://dotnet.microsoft.com/download/dotnet-core) and [.NET
22-
Framework](https://dotnet.microsoft.com/download/dotnet-framework) except for
23-
.NET Framework 3.5 SP1.
18+
OpenTelemetry for .NET supports all officially supported versions of
19+
[.NET Core](https://dotnet.microsoft.com/download/dotnet-core) and
20+
[.NET Framework](https://dotnet.microsoft.com/download/dotnet-framework) except
21+
for .NET Framework 3.5 SP1.
2422

2523
## Repositories
2624

2725
OpenTelemetry .NET consists of the following repositories:
2826

2927
- [OpenTelemetry .NET](https://github.com/open-telemetry/opentelemetry-dotnet)
30-
- [OpenTelemetry .NET
31-
Contrib](https://github.com/open-telemetry/opentelemetry-dotnet-contrib)
28+
- [OpenTelemetry .NET Contrib](https://github.com/open-telemetry/opentelemetry-dotnet-contrib)
3229
- [OpenTelemetry .NET Automatic Instrumentation](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation)
3330

34-
[ILogger]: https://docs.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger
35-
[OTLP Log Exporter]: https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md#otlp-logs
31+
[ilogger]:
32+
https://docs.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger
33+
[otlp log exporter]:
34+
https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/README.md#otlp-logs

content/en/docs/instrumentation/net/automatic.md

+15-10
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,29 @@ linkTitle: Automatic
44
weight: 3
55
---
66

7-
You can use [automatic instrumentation](/docs/reference/specification/glossary/#automatic-instrumentation)
8-
to initialize [signal](/docs/reference/specification/glossary/#signals) providers
9-
and generate telemetry data for supported [instrumented libraries](/docs/reference/specification/glossary/#instrumented-library)
7+
You can use
8+
[automatic instrumentation](/docs/reference/specification/glossary/#automatic-instrumentation)
9+
to initialize [signal](/docs/reference/specification/glossary/#signals)
10+
providers and generate telemetry data for supported
11+
[instrumented libraries](/docs/reference/specification/glossary/#instrumented-library)
1012
without modifying the application's source code.
1113

12-
[Here][release] you can find the latest release of
13-
OpenTelemetry .NET Automatic Instrumentation.
14+
[Here][release] you can find the latest release of OpenTelemetry .NET Automatic
15+
Instrumentation.
1416

1517
You can find the documentation in the [project's repository][repo].
1618

1719
## Next steps
1820

1921
After you have set up the automatic instrumentation, you may want to add
20-
[manual instrumentation](/docs/instrumentation/net/manual)
21-
to collect custom telemetry data.
22+
[manual instrumentation](/docs/instrumentation/net/manual) to collect custom
23+
telemetry data.
2224

23-
If you do not want to rely on automatic instrumentation,
24-
which is currently in beta, you may want to use [instrumentation libraries](/docs/instrumentation/net/libraries) explicitly instead.
25+
If you do not want to rely on automatic instrumentation, which is currently in
26+
beta, you may want to use
27+
[instrumentation libraries](/docs/instrumentation/net/libraries) explicitly
28+
instead.
2529

26-
[release]: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest
30+
[release]:
31+
https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/releases/latest
2732
[repo]: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation

content/en/docs/instrumentation/net/exporters.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ weight: 4
44
---
55

66
In order to visualize and analyze your
7-
[traces](/docs/concepts/signals/traces/#tracing-in-opentelemetry) and metrics, you
8-
will need to export them to a backend.
7+
[traces](/docs/concepts/signals/traces/#tracing-in-opentelemetry) and metrics,
8+
you will need to export them to a backend.
99

1010
## Console exporter
1111

@@ -106,8 +106,9 @@ If you are using .NET 5 or higher, the previous code sample is not required.
106106

107107
### Jaeger
108108

109-
To try out the OTLP exporter, you can run [Jaeger](https://www.jaegertracing.io/)
110-
as an OTLP endpoint and for trace visualization in a docker container:
109+
To try out the OTLP exporter, you can run
110+
[Jaeger](https://www.jaegertracing.io/) as an OTLP endpoint and for trace
111+
visualization in a docker container:
111112

112113
```shell
113114
docker run -d --name jaeger \
@@ -248,13 +249,13 @@ using var tracerProvider = Sdk.CreateMeterProviderBuilder()
248249
## Next steps
249250

250251
To ensure you're getting the most data as easily as possible, install
251-
[instrumentation libraries](/docs/instrumentation/net/libraries) to
252-
generate observability data.
252+
[instrumentation libraries](/docs/instrumentation/net/libraries) to generate
253+
observability data.
253254

254255
Additionally, enriching your codebase with
255-
[manual instrumentation](/docs/instrumentation/net/manual)
256-
gives you customized observability data.
256+
[manual instrumentation](/docs/instrumentation/net/manual) gives you customized
257+
observability data.
257258

258259
You can also check the
259-
[automatic instrumentation for .NET](/docs/instrumentation/net/automatic),
260-
which is currently in beta.
260+
[automatic instrumentation for .NET](/docs/instrumentation/net/automatic), which
261+
is currently in beta.

content/en/docs/instrumentation/net/getting-started.md

+15-12
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ dotnet add package OpenTelemetry.Instrumentation.AspNetCore --prerelease
2323
dotnet add package OpenTelemetry.Instrumentation.Http --prerelease
2424
dotnet add package OpenTelemetry.Instrumentation.SqlClient --prerelease
2525
```
26-
Note that the `--prerelease` flag is required for all instrumentation packages
26+
27+
Note that the `--prerelease` flag is required for all instrumentation packages
2728
because they are all are pre-release.
2829

2930
This will also install the `OpenTelemetry` package.
@@ -195,7 +196,8 @@ app.MapGet("/hello", () =>
195196
app.Run();
196197
```
197198

198-
The output will be similar as with tracing, but now includes the request counter and periodically exports a histogram of request times for each route.
199+
The output will be similar as with tracing, but now includes the request counter
200+
and periodically exports a histogram of request times for each route.
199201

200202
<details>
201203
<summary>View example output</summary>
@@ -246,7 +248,7 @@ Export app.request-counter, Meter: MyCompany.MyProduct.MyService
246248
Value: 1
247249
248250
(2022-11-16T06:09:04.2574360Z, 2022-11-16T06:09:44.2393730Z] http.flavor: 1.1 http.host: localhost:7026 http.method: GET http.scheme: https http.status_code: 200 http.target: /hello Histogram
249-
Value: Sum: 40.041 Count: 1
251+
Value: Sum: 40.041 Count: 1
250252
(-Infinity,0]:0
251253
(0,5]:0
252254
(0,10]:0
@@ -273,10 +275,10 @@ The [OpenTelemetry Collector](/docs/collector/getting-started/) is a vital
273275
component of most production deployments. A collector is most beneficial in the
274276
following situations, among others:
275277

276-
* A single telemetry sink shared by multiple services, to reduce overhead of
278+
- A single telemetry sink shared by multiple services, to reduce overhead of
277279
switching exporters
278-
* Aggregate traces across multiple services, running on multiple hosts
279-
* A central place to process traces prior to exporting them to a backend
280+
- Aggregate traces across multiple services, running on multiple hosts
281+
- A central place to process traces prior to exporting them to a backend
280282

281283
### Configure and run a local collector
282284

@@ -421,13 +423,14 @@ To ensure you're getting the most data as easily as possible, install
421423
[instrumentation libraries](/docs/instrumentation/net/libraries) to generate
422424
observability data.
423425

424-
Additionally, enriching your codebase with [manual
425-
instrumentation](/docs/instrumentation/net/manual) gives you customized
426+
Additionally, enriching your codebase with
427+
[manual instrumentation](/docs/instrumentation/net/manual) gives you customized
426428
observability data.
427429

428-
You'll also want to configure an appropriate exporter to [export your telemetry
429-
data](/docs/instrumentation/net/exporters) to one or more telemetry backends.
430+
You'll also want to configure an appropriate exporter to
431+
[export your telemetry data](/docs/instrumentation/net/exporters) to one or more
432+
telemetry backends.
430433

431-
You can also check the [automatic instrumentation for
432-
.NET](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation),
434+
You can also check the
435+
[automatic instrumentation for .NET](https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation),
433436
which is currently in beta.

content/en/docs/instrumentation/net/libraries.md

+28-29
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@ linkTitle: Libraries
44
weight: 3
55
---
66

7-
You can use [instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library)
7+
You can use
8+
[instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library)
89
in order to generate telemetry data for a particular instrumented library.
910

10-
For example, [the instrumentation library for ASP.NET Core](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.AspNetCore)
11-
will automatically
12-
create [spans](/docs/concepts/signals/traces/#spans-in-opentelemetry)
13-
and [metrics](/docs/concepts/signals/metrics)
14-
based on the inbound HTTP requests.
11+
For example,
12+
[the instrumentation library for ASP.NET Core](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.AspNetCore)
13+
will automatically create
14+
[spans](/docs/concepts/signals/traces/#spans-in-opentelemetry) and
15+
[metrics](/docs/concepts/signals/metrics) based on the inbound HTTP requests.
1516

1617
## Setup
1718

1819
Each instrumentation library is a NuGet package, and installing them is
1920
typically done like so:
2021

21-
```console
22+
```
2223
dotnet add package OpenTelemetry.Instrumentation.{library-name-or-type}
2324
```
2425

2526
It is typically then registered at application startup time, such as when
26-
creating a
27-
[TracerProvider](/docs/concepts/signals/traces/#tracer-provider).
27+
creating a [TracerProvider](/docs/concepts/signals/traces/#tracer-provider).
2828

2929
## Example with ASP.NET Core and HttpClient
3030

31-
As an example, here's how you can instrument inbound and output
32-
requests from an ASP.NET Core app.
31+
As an example, here's how you can instrument inbound and output requests from an
32+
ASP.NET Core app.
3333

3434
First, get the appropriate packages:
3535

36-
```console
36+
```
3737
dotnet add package OpenTelemetry --prerelease
3838
dotnet add package OpenTelemetry.Extensions.Hosting --prerelease
3939
dotnet add package OpenTelemetry.Exporter.Console --prerelease
@@ -87,16 +87,14 @@ app.MapGet("/hello", async () =>
8787
app.Run();
8888
```
8989

90-
When you run this code and access the `/hello` endpoint,
91-
the instrumentation libraries will:
90+
When you run this code and access the `/hello` endpoint, the instrumentation
91+
libraries will:
9292

93-
* Start a new trace
94-
* Generate a span representing the request made to the endpoint
95-
* Generate a child span representing the HTTP GET made to
96-
`https://example.com/`
93+
- Start a new trace
94+
- Generate a span representing the request made to the endpoint
95+
- Generate a child span representing the HTTP GET made to `https://example.com/`
9796

98-
If you add more instrumentation libraries,
99-
then you get more telemetry data.
97+
If you add more instrumentation libraries, then you get more telemetry data.
10098

10199
## Available instrumentation libraries
102100

@@ -108,19 +106,20 @@ You can also find more instrumentations available in the
108106

109107
## Next steps
110108

111-
After you have set up instrumentation libraries, you may want to add [manual
112-
instrumentation](/docs/instrumentation/net/manual) to collect custom telemetry
113-
data.
109+
After you have set up instrumentation libraries, you may want to add
110+
[manual instrumentation](/docs/instrumentation/net/manual) to collect custom
111+
telemetry data.
114112

115-
If you are using .NET Framework 4.x instead of modern .NET, refer to the [.NET
116-
Framework docs](/docs/instrumentation/net/netframework) to configure
113+
If you are using .NET Framework 4.x instead of modern .NET, refer to the
114+
[.NET Framework docs](/docs/instrumentation/net/netframework) to configure
117115
OpenTelemetry and instrumentation libraries on .NET Framework.
118116

119-
You'll also want to configure an appropriate exporter to [export your telemetry
120-
data](/docs/instrumentation/net/exporters) to one or more telemetry backends.
117+
You'll also want to configure an appropriate exporter to
118+
[export your telemetry data](/docs/instrumentation/net/exporters) to one or more
119+
telemetry backends.
121120

122121
You can also check the
123-
[automatic instrumentation for .NET](/docs/instrumentation/net/automatic),
124-
which is currently in beta.
122+
[automatic instrumentation for .NET](/docs/instrumentation/net/automatic), which
123+
is currently in beta.
125124

126125
[opentelemetry-dotnet]: https://github.com/open-telemetry/opentelemetry-dotnet

content/en/docs/instrumentation/net/manual.md

+16-17
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ application.
99

1010
## A note on terminology
1111

12-
.NET is different from other languages/runtimes that support OpenTelemetry.
13-
The [Tracing API](/docs/concepts/signals/traces/#tracing-in-opentelemetry) is
12+
.NET is different from other languages/runtimes that support OpenTelemetry. The
13+
[Tracing API](/docs/concepts/signals/traces/#tracing-in-opentelemetry) is
1414
implemented by the
1515
[System.Diagnostics](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics)
1616
API, repurposing existing constructs like `ActivitySource` and `Activity` to be
@@ -21,8 +21,7 @@ developers must still know to be able to instrument their applications, which
2121
are covered here as well as the `System.Diagnostics` API.
2222

2323
If you prefer to use OpenTelemetry APIs instead of `System.Diagnostics` APIs,
24-
you can refer to the [OpenTelemetry API Shim docs for tracing]({{< relref "shim"
25-
>}}).
24+
you can refer to the [OpenTelemetry API Shim docs for tracing](../shim).
2625

2726
## Initializing tracing
2827

@@ -83,11 +82,11 @@ dotnet add package OpenTelemetry.Extensions.Hosting --prerelease
8382
dotnet add package OpenTelemetry.Exporter.Console --prerelease
8483
```
8584

86-
Note that the `--prerelease` flag is required for all instrumentation packages
85+
Note that the `--prerelease` flag is required for all instrumentation packages
8786
because they are all are pre-release.
8887

89-
Next, configure it in your ASP.NET Core startup routine where you have access
90-
to an `IServiceCollection`.
88+
Next, configure it in your ASP.NET Core startup routine where you have access to
89+
an `IServiceCollection`.
9190

9291
```csharp
9392
using OpenTelemetry;
@@ -242,8 +241,8 @@ public static void DoWork()
242241

243242
## Creating new root Activities
244243

245-
If you wish to create a new root Activity, you'll need to "de-parent" from
246-
the current activity.
244+
If you wish to create a new root Activity, you'll need to "de-parent" from the
245+
current activity.
247246

248247
```csharp
249248
public static void DoWork()
@@ -374,13 +373,13 @@ catch (Exception ex)
374373

375374
## Next steps
376375

377-
After you've set up manual instrumentation, you may want to use [instrumentation
378-
libraries](../libraries/). As the name suggests, they will
379-
instrument relevant libraries you're using and generate spans (activities) for things like
380-
inbound and outbound HTTP requests and more.
376+
After you've set up manual instrumentation, you may want to use
377+
[instrumentation libraries](../libraries/). As the name suggests, they will
378+
instrument relevant libraries you're using and generate spans (activities) for
379+
things like inbound and outbound HTTP requests and more.
381380

382-
You'll also want to configure an appropriate exporter to [export your telemetry
383-
data](../exporters/) to one or more telemetry backends.
381+
You'll also want to configure an appropriate exporter to
382+
[export your telemetry data](../exporters/) to one or more telemetry backends.
384383

385-
You can also check the [automatic instrumentation for
386-
.NET](../automatic/), which is currently in beta.
384+
You can also check the [automatic instrumentation for .NET](../automatic/),
385+
which is currently in beta.

0 commit comments

Comments
 (0)