Skip to content

Commit 3d6a643

Browse files
authored
Run website formatter over website_docs (#3762)
* Run website formatter over website_docs * Ignore selected website_docs links
1 parent 69d0946 commit 3d6a643

File tree

7 files changed

+303
-112
lines changed

7 files changed

+303
-112
lines changed

.lycheeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ http://localhost
22
http://jaeger-collector
33
https://github.com/open-telemetry/opentelemetry-go/milestone/
44
https://github.com/open-telemetry/opentelemetry-go/projects
5+
file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries
6+
file:///home/runner/work/opentelemetry-go/opentelemetry-go/manual

website_docs/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Go
33
description: >-
4-
<img width="35" src="/https/github.com/img/logos/32x32/Golang_SDK.svg" alt="Go"></img> A
5-
language-specific implementation of OpenTelemetry in Go.
4+
<img width="35" class="img-initial" src="/img/logos/32x32/Golang_SDK.svg"
5+
alt="Go"></img> A language-specific implementation of OpenTelemetry in Go.
66
aliases: [/golang, /golang/metrics, /golang/tracing]
77
cascade:
88
github_repo: &repo https://github.com/open-telemetry/opentelemetry-go

website_docs/exporters.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ weight: 4
55
---
66

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

1111
## OTLP Exporter
1212

website_docs/getting-started.md

Lines changed: 198 additions & 64 deletions
Large diffs are not rendered by default.

website_docs/libraries.md

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
11
---
22
title: Using instrumentation libraries
3-
weight: 3
43
linkTitle: Libraries
5-
aliases: [/docs/instrumentation/go/using_instrumentation_libraries, /docs/instrumentation/go/automatic_instrumentation]
4+
aliases:
5+
- /docs/instrumentation/go/using_instrumentation_libraries
6+
- /docs/instrumentation/go/automatic_instrumentation
7+
weight: 3
68
---
79

8-
Go does not support truly automatic instrumentation like other languages today. Instead, you'll need to depend on [instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library) that generate telemetry data for a particular instrumented library. For example, the instrumentation library for `net/http` will automatically create spans that track inbound and outbound requests once you configure it in your code.
10+
Go does not support truly automatic instrumentation like other languages today.
11+
Instead, you'll need to depend on
12+
[instrumentation libraries](/docs/reference/specification/glossary/#instrumentation-library)
13+
that generate telemetry data for a particular instrumented library. For example,
14+
the instrumentation library for `net/http` will automatically create spans that
15+
track inbound and outbound requests once you configure it in your code.
916

1017
## Setup
1118

12-
Each instrumentation library is a package. In general, this means you need to `go get` the appropriate package:
19+
Each instrumentation library is a package. In general, this means you need to
20+
`go get` the appropriate package:
1321

14-
```console
22+
```sh
1523
go get go.opentelemetry.io/contrib/instrumentation/{import-path}/otel{package-name}
1624
```
1725

18-
And then configure it in your code based on what the library requires to be activated.
26+
And then configure it in your code based on what the library requires to be
27+
activated.
1928

2029
## Example with `net/http`
2130

22-
As an example, here's how you can set up automatic instrumentation for inbound HTTP requests for `net/http`:
31+
As an example, here's how you can set up automatic instrumentation for inbound
32+
HTTP requests for `net/http`:
2333

2434
First, get the `net/http` instrumentation library:
2535

26-
```console
36+
```sh
2737
go get go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
2838
```
2939

@@ -76,13 +86,18 @@ func main() {
7686
}
7787
```
7888

79-
Assuming that you have a `Tracer` and [exporter]({{< relref "exporters" >}}) configured, this code will:
89+
Assuming that you have a `Tracer` and [exporter](../exporters/) configured, this
90+
code will:
8091

81-
* Start an HTTP server on port `3030`
82-
* Automatically generate a span for each inbound HTTP request to `/hello-instrumented`
83-
* Create a child span of the automatically-generated one that tracks the work done in `sleepy`
92+
- Start an HTTP server on port `3030`
93+
- Automatically generate a span for each inbound HTTP request to
94+
`/hello-instrumented`
95+
- Create a child span of the automatically-generated one that tracks the work
96+
done in `sleepy`
8497

85-
Connecting manual instrumentation you write in your app with instrumentation generated from a library is essential to get good observability into your apps and services.
98+
Connecting manual instrumentation you write in your app with instrumentation
99+
generated from a library is essential to get good observability into your apps
100+
and services.
86101

87102
## Available packages
88103

@@ -91,6 +106,9 @@ A full list of instrumentation libraries available can be found in the
91106

92107
## Next steps
93108

94-
Instrumentation libraries can do things like generate telemetry data for inbound and outbound HTTP requests, but they don't instrument your actual application.
109+
Instrumentation libraries can do things like generate telemetry data for inbound
110+
and outbound HTTP requests, but they don't instrument your actual application.
95111

96-
To get richer telemetry data, use [manual instrumentation]({{< relref "manual" >}}) to enrich your telemetry data from instrumentation libraries with instrumentation from your running application.
112+
To get richer telemetry data, use [manual instrumentation](../manual/) to enrich
113+
your telemetry data from instrumentation libraries with instrumentation from
114+
your running application.

website_docs/manual.md

Lines changed: 64 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
---
22
title: Manual Instrumentation
3-
weight: 3
43
linkTitle: Manual
5-
aliases: [/docs/instrumentation/go/instrumentation, /docs/instrumentation/go/manual_instrumentation]
4+
aliases:
5+
- /docs/instrumentation/go/instrumentation
6+
- /docs/instrumentation/go/manual_instrumentation
7+
weight: 3
68
---
79

8-
Instrumentation is the process of adding observability code to your application. There are two general types of instrumentation - automatic, and manual - and you should be familiar with both in order to effectively instrument your software.
10+
Instrumentation is the process of adding observability code to your application.
11+
There are two general types of instrumentation - automatic, and manual - and you
12+
should be familiar with both in order to effectively instrument your software.
913

1014
## Getting a Tracer
1115

@@ -15,7 +19,7 @@ To create spans, you'll need to acquire or initialize a tracer first.
1519

1620
Ensure you have the right packages installed:
1721

18-
```
22+
```sh
1923
go get go.opentelemetry.io/otel \
2024
go.opentelemetry.io/otel/trace \
2125
go.opentelemetry.io/otel/sdk \
@@ -54,7 +58,7 @@ func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider {
5458
semconv.ServiceName("ExampleService"),
5559
),
5660
)
57-
61+
5862
if err != nil {
5963
panic(err)
6064
}
@@ -90,9 +94,12 @@ You can now access `tracer` to manually instrument your code.
9094

9195
## Creating Spans
9296

93-
Spans are created by tracers. If you don't have one initialized, you'll need to do that.
97+
Spans are created by tracers. If you don't have one initialized, you'll need to
98+
do that.
9499

95-
To create a span with a tracer, you'll also need a handle on a `context.Context` instance. These will typically come from things like a request object and may already contain a parent span from an [instrumentation library][].
100+
To create a span with a tracer, you'll also need a handle on a `context.Context`
101+
instance. These will typically come from things like a request object and may
102+
already contain a parent span from an [instrumentation library][].
96103

97104
```go
98105
func httpHandler(w http.ResponseWriter, r *http.Request) {
@@ -103,13 +110,16 @@ func httpHandler(w http.ResponseWriter, r *http.Request) {
103110
}
104111
```
105112

106-
In Go, the `context` package is used to store the active span. When you start a span, you'll get a handle on not only the span that's created, but the modified context that contains it.
113+
In Go, the `context` package is used to store the active span. When you start a
114+
span, you'll get a handle on not only the span that's created, but the modified
115+
context that contains it.
107116

108117
Once a span has completed, it is immutable and can no longer be modified.
109118

110119
### Get the current span
111120

112-
To get the current span, you'll need to pull it out of a `context.Context` you have a handle on:
121+
To get the current span, you'll need to pull it out of a `context.Context` you
122+
have a handle on:
113123

114124
```go
115125
// This context needs contain the active span you plan to extract.
@@ -119,13 +129,15 @@ span := trace.SpanFromContext(ctx)
119129
// Do something with the current span, optionally calling `span.End()` if you want it to end
120130
```
121131

122-
This can be helpful if you'd like to add information to the current span at a point in time.
132+
This can be helpful if you'd like to add information to the current span at a
133+
point in time.
123134

124135
### Create nested spans
125136

126137
You can create a nested span to track work in a nested operation.
127138

128-
If the current `context.Context` you have a handle on already contains a span inside of it, creating a new span makes it a nested span. For example:
139+
If the current `context.Context` you have a handle on already contains a span
140+
inside of it, creating a new span makes it a nested span. For example:
129141

130142
```go
131143
func parentFunction(ctx context.Context) {
@@ -151,7 +163,10 @@ Once a span has completed, it is immutable and can no longer be modified.
151163

152164
### Span Attributes
153165

154-
Attributes are keys and values that are applied as metadata to your spans and are useful for aggregating, filtering, and grouping traces. Attributes can be added at span creation, or at any other time during the lifecycle of a span before it has completed.
166+
Attributes are keys and values that are applied as metadata to your spans and
167+
are useful for aggregating, filtering, and grouping traces. Attributes can be
168+
added at span creation, or at any other time during the lifecycle of a span
169+
before it has completed.
155170

156171
```go
157172
// setting attributes at creation...
@@ -169,13 +184,21 @@ span.SetAttributes(myKey.String("a value"))
169184

170185
#### Semantic Attributes
171186

172-
Semantic Attributes are attributes that are defined by the [OpenTelemetry Specification][] in order to provide a shared set of attribute keys across multiple languages, frameworks, and runtimes for common concepts like HTTP methods, status codes, user agents, and more. These attributes are available in the `go.opentelemetry.io/otel/semconv/v1.12.0` package.
187+
Semantic Attributes are attributes that are defined by the [OpenTelemetry
188+
Specification][] in order to provide a shared set of attribute keys across
189+
multiple languages, frameworks, and runtimes for common concepts like HTTP
190+
methods, status codes, user agents, and more. These attributes are available in
191+
the `go.opentelemetry.io/otel/semconv/v1.12.0` package.
173192

174193
For details, see [Trace semantic conventions][].
175194

176195
### Events
177196

178-
An event is a human-readable message on a span that represents "something happening" during it's lifetime. For example, imagine a function that requires exclusive access to a resource that is under a mutex. An event could be created at two points - once, when we try to gain access to the resource, and another when we acquire the mutex.
197+
An event is a human-readable message on a span that represents "something
198+
happening" during it's lifetime. For example, imagine a function that requires
199+
exclusive access to a resource that is under a mutex. An event could be created
200+
at two points - once, when we try to gain access to the resource, and another
201+
when we acquire the mutex.
179202

180203
```go
181204
span.AddEvent("Acquiring lock")
@@ -186,7 +209,9 @@ span.AddEvent("Unlocking")
186209
mutex.Unlock()
187210
```
188211

189-
A useful characteristic of events is that their timestamps are displayed as offsets from the beginning of the span, allowing you to easily see how much time elapsed between them.
212+
A useful characteristic of events is that their timestamps are displayed as
213+
offsets from the beginning of the span, allowing you to easily see how much time
214+
elapsed between them.
190215

191216
Events can also have attributes of their own -
192217

@@ -196,7 +221,8 @@ span.AddEvent("Cancelled wait due to external signal", trace.WithAttributes(attr
196221

197222
### Set span status
198223

199-
A status can be set on a span, typically used to specify that there was an error in the operation a span is tracking - .`Error`.
224+
A status can be set on a span, typically used to specify that there was an error
225+
in the operation a span is tracking - .`Error`.
200226

201227
```go
202228
import (
@@ -213,11 +239,13 @@ if err != nil {
213239
}
214240
```
215241

216-
By default, the status for all spans is `Unset`. In rare cases, you may also wish to set the status to `Ok`. This should generally not be necessary, though.
242+
By default, the status for all spans is `Unset`. In rare cases, you may also
243+
wish to set the status to `Ok`. This should generally not be necessary, though.
217244

218245
### Record errors
219246

220-
If you have an operation that failed and you wish to capture the error it produced, you can record that error.
247+
If you have an operation that failed and you wish to capture the error it
248+
produced, you can record that error.
221249

222250
```go
223251
import (
@@ -235,18 +263,22 @@ if err != nil {
235263
}
236264
```
237265

238-
It is highly recommended that you also set a span's status to `Error` when using `RecordError`, unless you do not wish to consider the span tracking a failed operation as an error span.
239-
The `RecordError` function does **not** automatically set a span status when called.
266+
It is highly recommended that you also set a span's status to `Error` when using
267+
`RecordError`, unless you do not wish to consider the span tracking a failed
268+
operation as an error span. The `RecordError` function does **not**
269+
automatically set a span status when called.
240270

241271
## Creating Metrics
242272

243273
The metrics API is currently unstable, documentation TBA.
244274

245275
## Propagators and Context
246276

247-
Traces can extend beyond a single process. This requires _context propagation_, a mechanism where identifiers for a trace are sent to remote processes.
277+
Traces can extend beyond a single process. This requires _context propagation_,
278+
a mechanism where identifiers for a trace are sent to remote processes.
248279

249-
In order to propagate trace context over the wire, a propagator must be registered with the OpenTelemetry API.
280+
In order to propagate trace context over the wire, a propagator must be
281+
registered with the OpenTelemetry API.
250282

251283
```go
252284
import (
@@ -257,10 +289,15 @@ import (
257289
otel.SetTextMapPropagator(propagation.TraceContext{})
258290
```
259291

260-
> OpenTelemetry also supports the B3 header format, for compatibility with existing tracing systems (`go.opentelemetry.io/contrib/propagators/b3`) that do not support the W3C TraceContext standard.
292+
> OpenTelemetry also supports the B3 header format, for compatibility with
293+
> existing tracing systems (`go.opentelemetry.io/contrib/propagators/b3`) that
294+
> do not support the W3C TraceContext standard.
261295
262-
After configuring context propagation, you'll most likely want to use automatic instrumentation to handle the behind-the-scenes work of actually managing serializing the context.
296+
After configuring context propagation, you'll most likely want to use automatic
297+
instrumentation to handle the behind-the-scenes work of actually managing
298+
serializing the context.
263299

264-
[OpenTelemetry Specification]: {{< relref "/docs/reference/specification" >}}
265-
[Trace semantic conventions]: {{< relref "/docs/reference/specification/trace/semantic_conventions" >}}
266-
[instrumentation library]: {{< relref "libraries" >}}
300+
[opentelemetry specification]: /docs/reference/specification/
301+
[trace semantic conventions]:
302+
/docs/reference/specification/trace/semantic_conventions/
303+
[instrumentation library]: ../libraries/

website_docs/resources.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ weight: 6
55

66
Resources are a special type of attribute that apply to all spans generated by a
77
process. These should be used to represent underlying metadata about a process
8-
that's non-ephemeral - for example, the hostname of a process, or its instance
9-
ID.
8+
that's non-ephemeral &mdash; for example, the hostname of a process, or its
9+
instance ID.
1010

1111
Resources should be assigned to a tracer provider at its initialization, and are
1212
created much like attributes:

0 commit comments

Comments
 (0)