Skip to content

Commit 71c324d

Browse files
svrnmchalinahayworthrobertlaurin
authored
docs: Restructure ruby docs (#1390)
* docs: Restructure ruby docs Signed-off-by: svrnm <[email protected]> * Update website_docs/manual.md * Update website_docs/manual.md Co-authored-by: Patrice Chalin <[email protected]> * Update _index.md Signed-off-by: svrnm <[email protected]> Co-authored-by: Patrice Chalin <[email protected]> Co-authored-by: Andrew Hayworth <[email protected]> Co-authored-by: Robert <[email protected]>
1 parent 000d4d3 commit 71c324d

File tree

4 files changed

+55
-73
lines changed

4 files changed

+55
-73
lines changed

website_docs/_index.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,7 @@ cascade:
1212
weight: 24
1313
---
1414

15-
This is the OpenTelemetry for Ruby documentation. OpenTelemetry is an observability framework -- an API, SDK, and tools that are designed to aid in the generation and collection of application telemetry data such as metrics, logs, and traces.
16-
This documentation is designed to help you understand how to get started using OpenTelemetry for Ruby.
17-
18-
## Status and Releases
19-
20-
The current status of the major functional components for OpenTelemetry Ruby is
21-
as follows:
22-
23-
| Traces | Metrics | Logs |
24-
| ------- | ------- | ------- |
25-
| Stable | Not Yet Implemented | Not Yet Implemented |
26-
27-
{{% latest_release "ruby" /%}}
15+
{{% lang_instrumentation_index_head "ruby" /%}}
2816

2917
## Who's using OpenTelemetry Ruby?
3018

website_docs/context-propagation.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

website_docs/events.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

website_docs/manual.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
---
22
title: Manual Instrumentation
33
linkTitle: Manual
4-
aliases: [/docs/instrumentation/ruby/manual_instrumentation]
4+
aliases:
5+
- /docs/instrumentation/ruby/manual_instrumentation
6+
- /docs/instrumentation/ruby/events
7+
- /docs/instrumentation/ruby/context-propagation
58
weight: 4
69
---
710

@@ -79,13 +82,61 @@ end
7982
> &#9888; Sampling decisions happen at the moment of span creation.
8083
> If your sampler considers span attributes when deciding to sample a span, then you _must_ pass those attributes as part of span creation. Any attributes added after creation will not be seen by the sampler, because the sampling decision has already been made.
8184
82-
8385
#### Semantic Attributes
8486

8587
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 [Semantic Conventions gem][semconv-gem].
8688

8789
For details, see [Trace semantic conventions][semconv-spec].
8890

89-
[OpenTelemetry Specification]: {{< relref "/docs/reference/specification" >}}
91+
### Span Events
92+
93+
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.
94+
95+
```ruby
96+
span.add_event("Acquiring lock")
97+
if mutex.try_lock
98+
span.add_event("Got lock, doing work...")
99+
# some code here
100+
span.add_event("Releasing lock")
101+
else
102+
span.add_event("Lock already in use")
103+
end
104+
```
105+
106+
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.
107+
108+
Events can also have attributes of their own e.g.
109+
110+
```ruby
111+
span.add_event("Cancelled wait due to external signal", attributes: { "pid" => 4328, "signal" => "SIGHUP" })
112+
```
113+
114+
## Context Propagation
115+
116+
> Distributed Tracing tracks the progression of a single Request, called a Trace, as it is handled by Services that make up an Application. A Distributed Trace transverses process, network and security boundaries. [Glossary][]
117+
118+
This requires _context propagation_, a mechanism where identifiers for a trace are sent to remote processes.
119+
120+
> &#8505; The OpenTelemetry Ruby SDK will take care of context propagation as long as your service is leveraging auto-instrumented libraries. Please refer to the [README][auto-instrumentation] for more details.
121+
122+
In order to propagate trace context over the wire, a propagator must be registered with the OpenTelemetry SDK.
123+
The W3 TraceContext and Baggage propagators are configured by default.
124+
Operators may override this value by setting `OTEL_PROPAGATORS` environment variable to a comma separated list of [propagators][propagators].
125+
For example, to add B3 propagation, set `OTEL_PROPAGATORS` to the complete list of propagation formats you wish to support:
126+
127+
```sh
128+
export OTEL_PROPAGATORS=tracecontext,baggage,b3
129+
```
130+
131+
Propagators other than `tracecontext` and `baggage` must be added as gem dependencies to your Gemfile, e.g.:
132+
133+
```ruby
134+
gem 'opentelemetry-propagator-b3'
135+
```
136+
137+
[glossary]: /docs/concepts/glossary/
138+
[propagators]: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/propagator
139+
[auto-instrumentation]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation
90140
[semconv-gem]: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/semantic_conventions
91141
[semconv-spec]: {{< relref "/docs/reference/specification/trace/semantic_conventions" >}}
142+
[OpenTelemetry Specification]: {{< relref "/docs/reference/specification" >}}

0 commit comments

Comments
 (0)