Skip to content

Commit 23c5aaf

Browse files
chore: Update README usage guidelines (#1926)
Also, update spacing to shorten line lengths
1 parent 75c8a39 commit 23c5aaf

File tree

1 file changed

+73
-11
lines changed

1 file changed

+73
-11
lines changed

semantic_conventions/README.md

Lines changed: 73 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
# Opentelemetry::SemanticConventions
1+
# OpenTelemetry::SemanticConventions
22

3-
The `opentelemetry-semantic_conventions` gem provides auto-generated constants that represent the OpenTelemetry [Semantic Conventions][semantic-conventions].
3+
The `opentelemetry-semantic_conventions` gem provides auto-generated constants
4+
that represent the OpenTelemetry [Semantic Conventions][semantic-conventions].
45

56
## What is OpenTelemetry?
67

7-
OpenTelemetry is an open source observability framework, providing a general-purpose API, SDK, and related tools required for the instrumentation of cloud-native software, frameworks, and libraries.
8+
OpenTelemetry is an open source observability framework, providing a
9+
general-purpose API, SDK, and related tools required for the instrumentation of
10+
cloud-native software, frameworks, and libraries.
811

9-
OpenTelemetry provides a single set of APIs, libraries, agents, and collector services to capture distributed traces and metrics from your application. You can analyze them using Prometheus, Jaeger, and other observability tools.
12+
OpenTelemetry provides a single set of APIs, libraries, agents, and collector
13+
services to capture distributed traces and metrics from your application. You
14+
can analyze them using Prometheus, Jaeger, and other observability tools.
1015

1116
## How does this gem fit in?
1217

13-
The `opentelemetry-semantic_conventions` gem provides auto-generated constants that represent the OpenTelemetry Semantic Conventions. They may be referenced in instrumentation or end-user code in place of hard-coding the names of the conventions. Because they are generated from the YAML models in the specification, they are kept up-to-date for you.
18+
The `opentelemetry-semantic_conventions` gem provides auto-generated constants
19+
that represent the OpenTelemetry Semantic Conventions. They may be referenced
20+
in instrumentation or end-user code in place of hard-coding the names of the
21+
conventions. Because they are generated from the YAML models in the
22+
specification, they are kept up-to-date for you.
1423

1524
## How do I get started?
1625

@@ -20,29 +29,82 @@ Install the gem using:
2029
gem install opentelemetry-semantic_conventions
2130
```
2231

23-
Or, if you use Bundler, include `opentelemetry-semantic_conventions` in your `Gemfile`.
32+
Or, if you use Bundler, include `opentelemetry-semantic_conventions` in your
33+
`Gemfile`.
34+
35+
## How do I use the gem?
36+
37+
The gem's versions match the corresponding
38+
[OpenTelemetry Semantic Convention versions][semconv].
39+
40+
In version 1.36.0, we established a new pattern for naming the constants:
41+
* `OpenTelemetry::SemConv::Incubating::#{CATEGORY_NAME}` is the prefix for
42+
experimental, development, or deprecated constants
43+
* `OpenTelemetry::SemConv::#{CATEGORY_NAME}` is the prefix for stable constants
44+
45+
Incubating constants will never be removed. If an incubating constant becomes
46+
stable, it will be copied into the stable namespace and the value will be
47+
available from two constants. The new constant's name will be the same, except
48+
the `Incubating` namespace will be removed.
49+
50+
Prior to 1.36.0 (last version 1.11.0), constants follow a different naming
51+
pattern: `OpenTelemetry::SemanticConventions::#{CATEGORY_NAME}`
52+
53+
These constants will be preserved to avoid breaking changes for users who rely
54+
on the old constants. These constants do not differentiate between stable and
55+
unstable constants. New constants will not be added to this namespace.
56+
57+
We recommend you require only the files that contain the constants you are going
58+
to use. For example, if you were creating instrumentation for an HTTP Client
59+
that emits only stable conventions, you would likely require:
2460

61+
```rb
62+
require 'opentelemetry/semconv/http'
63+
```
64+
65+
If you want to require all of the 1.11.0 constants, you can use:
2566
```rb
2667
require 'opentelemetry/semantic_conventions'
2768

2869
# Use the constants however you feel necessary, eg:
2970

30-
puts "This is the value of #{OpenTelemetry::SemanticConventions::Trace::CODE_LINENO}"
71+
puts "This is the value of #{OpenTelemetry::SemanticConventions::Trace::DB_USER}"
72+
```
73+
74+
The constant names can be very long. You can consider aliasing the long bit in
75+
another constant to save your fingertips some trouble.
76+
77+
```rb
78+
SEMCONV_HTTP_INC = OpenTelemetry::SemConv::Incubating::HTTP
79+
80+
SEMCONV_HTTP_INC::HTTP_REQUEST_METHOD # which would return 'http.request.method'
3181
```
3282

83+
## What's up with the gem's versions?
84+
85+
This gem doesn't follow semantic versioning. Instead, the version matches the
86+
upstream [OpenTelemetry Semantic Conventions version][semconv].
87+
3388
## How do I rebuild the conventions?
3489

3590
Bump the version number in the Rakefile, and then run `rake generate`.
3691

3792
## How can I get involved?
3893

39-
The `opentelemetry-semantic_conventions` gem source is on github, along with related gems.
94+
The `opentelemetry-semantic_conventions` gem source is on GitHub, along with
95+
related gems.
4096

41-
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the meeting calendar for dates and times. For more information on this and other language SIGs, see the OpenTelemetry community page.
97+
The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special
98+
interest group (SIG). You can get involved by joining us in
99+
[GitHub Discussions][discussions-url] or attending our weekly meeting. See the
100+
meeting calendar for dates and times. For more information on this and other
101+
language SIGs, see the OpenTelemetry community page.
42102

43103
## License
44104

45-
The `opentelemetry-semantic_conventions` gem is distributed under the Apache 2.0 license. See LICENSE for more information.
105+
The `opentelemetry-semantic_conventions` gem is distributed under the Apache 2.0
106+
license. See LICENSE for more information.
46107

47108
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
48-
[semantic-conventions]: https://github.com/open-telemetry/opentelemetry-specification/tree/v1.20.0/semantic_conventions
109+
[semantic-conventions]: https://github.com/open-telemetry/semantic-conventions
110+
[semconv]: https://opentelemetry.io/docs/specs/semconv/

0 commit comments

Comments
 (0)