Skip to content

Commit f12732d

Browse files
authored
Merge pull request #342 from tsloughter/cut-1.0.0
Cut 1.0.0
2 parents 1b90aa7 + 1a42d7f commit f12732d

File tree

10 files changed

+136
-110
lines changed

10 files changed

+136
-110
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## 1.0.0 - 2022-01-03
11+
12+
### [SDK]
13+
14+
#### Fixed
15+
16+
- [SDK will continue to try initializing exporter if it fails to resolve startup
17+
ordering issues](https://github.com/open-telemetry/opentelemetry-erlang/pull/338)
18+
- [elixir span docs: fix reference to attributes
19+
type](https://github.com/open-telemetry/opentelemetry-erlang/pull/336)
20+
21+
### [API]
22+
23+
#### Fixed
24+
25+
- [events: accept map for attributes on an event](https://github.com/open-telemetry/opentelemetry-erlang/pull/335)
26+
1027
### [Exporter]
1128

1229
#### Added

README.md

Lines changed: 80 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,82 +4,81 @@ OpenTelemetry
44
[![EEF Observability WG project](https://img.shields.io/badge/EEF-Observability-black)](https://github.com/erlef/eef-observability-wg)
55
![Build Status](https://github.com/open-telemetry/opentelemetry-erlang/workflows/Common%20Test/badge.svg)
66

7-
OpenTelemetry distributed tracing framework for Erlang.
7+
[OpenTelemetry](https://opentelemetry.io/) distributed tracing framework for
8+
Erlang and Elixir.
89

9-
Requires OTP 21.3 or above.
10+
These applications implement version 1.8.0 of the [OpenTelemetry
11+
Specification](https://github.com/open-telemetry/opentelemetry-specification),
12+
see the [spec compliance
13+
matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix.md)
14+
for a list of features supported.
15+
16+
## Requirements
17+
18+
- OTP 21.3+
19+
20+
If using the Elixir API:
21+
22+
- Elixir 1.8+
1023

1124
## Contacting Us
1225

1326
We hold weekly meetings. See details at [community page](https://github.com/open-telemetry/community#special-interest-groups).
1427

15-
We use [GitHub Discussions](https://github.com/open-telemetry/opentelemetry-erlang/discussions) for support or general questions. Feel free to drop us a line.
28+
We use [GitHub
29+
Discussions](https://github.com/open-telemetry/opentelemetry-erlang/discussions)
30+
for support or general questions. Feel free to drop us a line.
1631

1732
We are also present in the #otel-erlang-elixir channel in the [CNCF
1833
slack](https://slack.cncf.io/). Please join us for more informal discussions.
1934

20-
You can also find us in the #opentelemetry channel on [Elixir Slack](https://elixir-slackin.herokuapp.com/).
35+
You can also find us in the #opentelemetry channel on [Elixir
36+
Slack](https://elixir-slackin.herokuapp.com/).
2137

2238
## Design
2339

24-
The [OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification) defines a language library as having 2 components, the API and the SDK. The API must not only define the interfaces of any implementation in that language but also be able to function as a noop implementation of the tracer. The SDK is the default implementation of the API that must be optional.
40+
The [OpenTelemetry
41+
specification](https://github.com/open-telemetry/opentelemetry-specification)
42+
defines a language library as having 2 components, the API and the SDK. The API
43+
must not only define the interfaces of any implementation in that language but
44+
also be able to function as a noop implementation of the tracer. The SDK is the
45+
default implementation of the API that must be optional.
2546

2647
When instrumenting a project your application should only depend on the
2748
[OpenTelemetry API](https://hex.pm/packages/opentelemetry_api) application,
2849
found in directory `apps/opentelemetry_api` of this repo which is published as
2950
the hex package [opentelemetry_api](https://hex.pm/packages/opentelemetry_api).
3051

31-
This repository is the Erlang's SDK implementation and should be included in the final release and configured to setup the sampler, span processors and span exporters.
52+
The SDK implementation, found under `apps/opentelemetry` and hex package
53+
[opentelemetry](https://hex.pm/packages/opentelemetry), should be included in an
54+
OTP Release along with an exporter.
3255

33-
## Usage
34-
35-
### Hex Dependencies
36-
37-
It is recommended to use the versions published on hex.pm for [OpenTelemetry
38-
API](https://hex.pm/packages/opentelemetry_api), [OpenTelemetry
39-
SDK](https://hex.pm/packages/opentelemetry) and the [OpenTelemetry
40-
Exporter](https://hex.pm/packages/opentelemetry_exporter).
41-
42-
### Git Dependencies
43-
44-
Because the OpenTelemetry OTP Applications are kept in a single repository,
45-
under the directory `apps`, either [rebar3's](https://rebar3.org) `git_subdir`
46-
(rebar 3.14 or above is required) or
47-
[mix's](](https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html))
48-
`sparse` feature must be used when using as Git dependencies in a project. The
49-
blocks below shows how in rebar3 and mix the git repo for the API and/or SDK
50-
Applications can be used.
56+
Example of Release configuration in `rebar.config`:
5157

5258
``` erlang
53-
{opentelemetry_api, {git_subdir,
54-
"http://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"}, "apps/opentelemetry_api"}}
55-
{opentelemetry, {git_subdir,
56-
"http://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"}, "apps/opentelemetry"}}
57-
```
59+
{relx, [{release, {my_instrumented_release, "0.1.0"},
60+
[opentelemetry_exporter,
61+
{opentelemetry, temporary},
62+
my_instrumented_app]},
5863

59-
``` elixir
60-
{:opentelemetry_api, github: "open-telemetry/opentelemetry-erlang", sparse:
61-
"apps/opentelemetry_api", override: true},
62-
{:opentelemetry, github: "open-telemetry/opentelemetry-erlang", sparse: "apps/opentelemetry", override: true},
64+
...]}.
6365
```
6466

65-
The `override: true` is required because the SDK Application, `opentelemetry`, has
66-
the API in its `deps` list of its `rebar.config` as a hex dependency and this will
67-
clash when `mix` tries to resolve the dependencies and fail without the
68-
override. `override: true` is also used on the SDK because the
69-
`opentelemetry_exporter` application depends on it and the API as hex deps so if
70-
it is included the override is necessary.
71-
72-
### Including in Release
67+
Example configuration for [mix's Release
68+
task](https://hexdocs.pm/mix/Mix.Tasks.Release.html):
7369

74-
In an Erlang project add `opentelemetry_exporter` and `opentelemetry` as the
75-
first elements of the release's applications:
70+
``` elixir
71+
def project do
72+
[
73+
releases: [
74+
my_instrumented_release: [
75+
applications: [:runtime_tools, :opentelemetry_exporter, {:opentelemetry, :temporary}, :my_instrumented_app]
76+
],
7677

77-
``` erlang
78-
{relx, [{release, {<name>, <version>},
79-
[opentelemetry_exporter,
80-
{opentelemetry, temporary},
81-
<your applications>]},
82-
...]}.
78+
...
79+
]
80+
]
81+
end
8382
```
8483

8584
In the above example `opentelemetry_exporter` is first to ensure all of its
@@ -93,23 +92,42 @@ the processes started by the root supervisor to leave it up to the end user
9392
whether they want the crash or shutdown or `opentelemetry` to be ignored or
9493
cause the shutdown of the rest of the applications in the release.
9594

96-
Doing the same for an Elixir project would be:
95+
## Git Dependencies
9796

98-
``` elixir
99-
def project do
100-
[
101-
...
102-
releases: [
103-
<name>: [
104-
applications: [:opentelemetry_exporter, opentelemetry: :temporary]
105-
],
97+
While it is recommended to use the Hex packages for the
98+
[API](https://hex.pm/packages/opentelemetry_api),
99+
[SDK](https://hex.pm/packages/opentelemetry) and [OTLP
100+
exporter](https://hex.pm/packages/opentelemetry_exporter), there are times
101+
depending on the git repo is necessary. Because the OpenTelemetry OTP
102+
Applications are kept in a single repository, under the directory `apps`, either
103+
[rebar3's](https://rebar3.org) `git_subdir` (rebar 3.14 or above is required) or
104+
[mix's](https://elixir-lang.org/getting-started/mix-otp/introduction-to-mix.html)
105+
`sparse` feature must be used when using as Git dependencies in a project. The
106+
blocks below shows how in rebar3 and mix the git repo for the API and/or SDK
107+
Applications can be used.
106108

107-
...
108-
]
109-
]
110-
end
109+
``` erlang
110+
{opentelemetry_api, {git_subdir, "http://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"}, "apps/opentelemetry_api"}},
111+
{opentelemetry, {git_subdir, "http://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"},
112+
"apps/opentelemetry"}},
113+
{opentelemetry_exporter, {git_subdir, "http://github.com/open-telemetry/opentelemetry-erlang", {branch, "main"}, "apps/opentelemetry_exporter"}}
114+
```
115+
116+
``` elixir
117+
{:opentelemetry_api, github: "open-telemetry/opentelemetry-erlang", sparse:
118+
"apps/opentelemetry_api", override: true},
119+
{:opentelemetry, github: "open-telemetry/opentelemetry-erlang", sparse:
120+
"apps/opentelemetry", override: true},
121+
{:opentelemetry_exporter, github: "open-telemetry/opentelemetry-erlang", sparse: "apps/opentelemetry_exporter", override: true}
111122
```
112123

124+
The `override: true` is required because the SDK Application, `opentelemetry`, has
125+
the API in its `deps` list of its `rebar.config` as a hex dependency and this will
126+
clash when `mix` tries to resolve the dependencies and fail without the
127+
override. `override: true` is also used on the SDK because the
128+
`opentelemetry_exporter` application depends on it and the API as hex deps so if
129+
it is included the override is necessary.
130+
113131
## Benchmarks
114132

115133
Running benchmarks is done with [benchee](https://github.com/bencheeorg/benchee). Benchmark functions are in modules under `samples/`. To run them open a rebar3 shell in the `bench` profile:

apps/opentelemetry/rebar.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{erl_opts, [debug_info]}.
2-
{deps, [{opentelemetry_api, "~> 1.0.0-rc.4"}]}.
2+
{deps, [{opentelemetry_api, "~> 1.0.0"}]}.

apps/opentelemetry_api/README.md

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,14 @@
33
[![EEF Observability WG project](https://img.shields.io/badge/EEF-Observability-black)](https://github.com/erlef/eef-observability-wg)
44
[![Hex.pm](https://img.shields.io/hexpm/v/opentelemetry)](https://hex.pm/packages/opentelemetry_api)
55

6-
This is the API portion of [OpenTelemetry](https://opentelemetry.io/) for Erlang and Elixir Applications.
6+
This is the API portion of [OpenTelemetry](https://opentelemetry.io/) for Erlang
7+
and Elixir Applications, implementing the API portion of [the specification](https://github.com/open-telemetry/opentelemetry-specification).
78

8-
This is a library, it does not start any processes, and should be the only OpenTelemetry dependency of Erlang/Elixir Applications.
9-
10-
The end user of your Application can then choose to include the [OpenTelemetry implementation](https://github.com/open-telemetry/opentelemetry-erlang) Application. If the implementation Application is not in the final release the OpenTelemetry instrumentation will all be no-ops. This means no processes started, no ETS tables created and nothing added to the process dictionary.
11-
12-
This separation is done so you should feel comfortable instrumenting your Erlang/Elixir Application with OpenTelemetry and not worry that a complicated dependency is being forced on your users.
9+
This is a library, it does not start any processes, and should be the only
10+
OpenTelemetry dependency of Erlang/Elixir Applications.
1311

1412
## Use
1513

16-
When instrumenting an Application to be used as a dependency of other projects it is best practice to register a `Tracer` with a name and a version using the Application's name and version. This should be the name and version of the Application that has the `opentelemetry` calls being written in it, not the name of the Application it might be being used to instrument. For example, an [Elli](https://github.com/elli-lib/elli) middleware to add tracing to the Elli HTTP server would *not* be named `elli`, it would be the name of the middleware Application, like `opentelemetry_elli`.
17-
18-
Registration is done through a single process and uses a [persistent_term](https://erlang.org/doc/man/persistent_term.html), so should be done only once per-Application. Updating a registration is allowed, so updating the version on a release upgrade can, and should, be done, but will involve the performance penalty of updating a [persistent_term](https://erlang.org/doc/man/persistent_term.html).
19-
20-
Naming the `Tracers` provides additional metadata on spans and allows the user of your Application to disable the traces from the dependency if it is needed.
21-
22-
### Dependency in Elixir
23-
24-
``` elixir
25-
def deps do
26-
[
27-
{:opentelemetry_api, "~> 0.6.0"}
28-
]
29-
end
30-
```
31-
32-
### Helper Macros for Application Tracers
33-
3414
There are both Erlang and Elixir macros that make use of the current module's
3515
name to lookup a Named Tracer -- a Named Tracer is created for each Application
3616
loaded in the system at start time -- for you and can be used for Trace and Span
@@ -63,24 +43,28 @@ end
6343

6444
### Including the OpenTelemetry SDK
6545

66-
For traces to actually be tracked, propagated and exported, the [opentelemetry](https://github.com/open-telemetry/opentelemetry-erlang) Application must be included as a dependency of your project, likely as part of a [Release](https://erlang.org/doc/design_principles/release_structure.html) and not as a dependency of an individual Application within the Release.
67-
68-
See the [Using section](https://github.com/open-telemetry/opentelemetry-erlang#using) of the [OpenTelemetry-Erlang](https://github.com/open-telemetry/opentelemetry-erlang) repository for details.
46+
When only the API is available at runtime a no-op Tracer is used and no Traces
47+
are exported. The [OpenTelemetry SDK](https://hex.pm/packages/opentelemetry)
48+
provides the functionality of Tracers, Span Processors and Exporters and should
49+
be included as part of a
50+
[Release](https://erlang.org/doc/design_principles/release_structure.html) and
51+
not as a dependency of any individual Application.
6952

7053
### Exporters
7154

72-
Exporters can be found as separate Applications on Github under the [OpenTelemetry Beam Organization](https://github.com/opentelemetry-beam).
55+
Included in the same [Github
56+
repo](https://github.com/open-telemetry/opentelemetry-erlang) as the API and SDK are an exporter for the [OpenTelemetry Protocol
57+
(OTLP)](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md)
58+
and [Zipkin](https://zipkin.io/):
7359

60+
- [OpenTelemetry Protocol](https://hex.pm/packages/opentelemetry_exporter)
7461
- [Zipkin](https://hex.pm/packages/opentelemetry_zipkin)
75-
- [OpenTelemetry Collector](https://hex.pm/packages/opentelemetry_exporter)
76-
77-
### HTTP Integrations
78-
79-
- [Elli](https://hex.pm/packages/opentelemetry_elli)
8062

81-
### Database Client Integration
63+
### Integrations
8264

83-
- [Ecto](https://hex.pm/packages/opentelemetry_ecto)
65+
Instrumentations of many popular Erlang and Elixir projects can be found in the
66+
[contrib repo](https://github.com/open-telemetry/opentelemetry-erlang-contrib)
67+
and on [hex.pm](https://hex.pm) under the [OpenTelemetry organization](https://hex.pm/orgs/opentelemetry).
8468

8569
## Contributing
8670

apps/opentelemetry_api/src/opentelemetry_api.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{application, opentelemetry_api,
22
[{description, "OpenTelemetry API"},
3-
{vsn, "1.0.0-rc.4.1"},
3+
{vsn, "1.0.0"},
44
{registered, []},
55
{applications,
66
[kernel,

apps/opentelemetry_exporter/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The OpenTelemetry Protocol exporter for use with the [OpenTelemetry
44
Collector](https://github.com/open-telemetry/opentelemetry-collector). The
55
version of this Application does not track the supported version of the
6-
OpenTelemetry Protocol (OTLP) . The currently used version of the [OTLP protobufs
6+
OpenTelemetry Protocol (OTLP). The currently used version of the [OTLP protobufs
77
is v0.11.0](https://github.com/open-telemetry/opentelemetry-proto/tree/v0.11.0).
88

99
Currently only supports the Tracer protocol using either GRPC or Protobuffers over HTTP1.1.
@@ -12,7 +12,8 @@ Currently only supports the Tracer protocol using either GRPC or Protobuffers ov
1212

1313
### Options to Batch Processor
1414

15-
Easiest way to setup is to add configuration for the batch processor in OpenTelemetry application environment.
15+
Exporter configuration can be done as arguments to the batch processor in
16+
the OpenTelemetry application environment.
1617

1718
For an Erlang release in `sys.config`:
1819

@@ -25,7 +26,8 @@ For an Erlang release in `sys.config`:
2526
headers => [{"x-honeycomb-dataset", "experiments"}]}}}}]}]}
2627
```
2728

28-
The default protocol is `http_protobuf`, to override this and use grpc add `protocol` to the config map:
29+
The default protocol is `http_protobuf`, to override this and use grpc add
30+
`protocol` to the config map:
2931

3032
``` erlang
3133
{opentelemetry,
@@ -48,6 +50,9 @@ config :opentelemetry, :processors,
4850

4951
### Application Environment
5052

53+
Alternatively the `opentelemetry_exporter` Application can be configured itself.
54+
Available configuration keys:
55+
5156
- `otlp_endpoint`: The URL to send traces and metrics to, for traces the path `v1/traces` is appended to the path in the URL.
5257
- `otlp_traces_endpoint`: URL to send only traces to. This takes precedence for exporting traces and the path of the URL is kept as is, no suffix is appended.
5358
- `otlp_headers`: List of additional headers (`[{unicode:chardata(), unicode:chardata()}]`) to add to export requests.
@@ -75,8 +80,7 @@ config :opentelemetry_exporter,
7580
otlp_endpoint: "https://api.honeycomb.io:443",
7681
otlp_headers: [{"x-honeycomb-dataset", "experiments"}]
7782
```
78-
79-
83+
8084
The default SSL options for HTTPS requests are set using
8185
[tls_certificate_check](https://hex.pm/packages/tls_certificate_check). This
8286
package also provides the [CA certificates from Mozilla](https://curl.se/docs/caextract.html).
@@ -91,6 +95,9 @@ for more information on securing HTTP requests in Erlang.
9195

9296
### OS Environment
9397

98+
Lastly, configuring the exporter can be done with OS environment variables,
99+
which take precedence:
100+
94101
- `OTEL_EXPORTER_OTLP_ENDPOINT`: The URL to send traces and metrics to, for traces the path `v1/traces` is appended to the path in the URL.
95102
- `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`: URL to send only traces to. This takes precedence for exporting traces and the path of the URL is kept as is, no suffix is appended.
96103
- `OTEL_EXPORTER_OTLP_HEADERS`: List of additional headers to add to export requests.

apps/opentelemetry_exporter/rebar.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{erl_opts, [debug_info]}.
22
{deps, [{grpcbox, ">= 0.0.0"},
33
{tls_certificate_check, "~> 1.11"},
4-
{opentelemetry, "~> 1.0.0-rc.4"},
5-
{opentelemetry_api, "~> 1.0.0-rc.4"}]}.
4+
{opentelemetry, "~> 1.0"},
5+
{opentelemetry_api, "~> 1.0"}]}.
66

77
{grpc, [{protos, ["opentelemetry-proto/opentelemetry/proto/collector/trace/v1"]},
88
{gpb_opts, [{module_name_prefix, "opentelemetry_exporter_"},

apps/opentelemetry_exporter/src/opentelemetry_exporter.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{application, opentelemetry_exporter,
22
[{description, "OpenTelemetry Protocol Exporter"},
3-
{vsn, "1.0.0-rc.4"},
3+
{vsn, "1.0.0"},
44
{registered, []},
55
{applications,
66
[kernel,

apps/opentelemetry_zipkin/rebar.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{erl_opts, [debug_info]}.
2-
{deps, [{opentelemetry, "~> 1.0.0-rc.4"},
3-
{opentelemetry_api, "~> 1.0.0-rc.4"}]}.
2+
{deps, [{opentelemetry, "~> 1.0"},
3+
{opentelemetry_api, "~> 1.0"}]}.
44

55
{profiles, [{test, [{erl_opts, [nowarn_export_all]}]},
66

docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set -e
99

1010
rebar3 compile
1111
rebar3 edoc
12-
version=1.0.0-rc.4
12+
version=1.0.0
1313

1414
ex_doc "opentelemetry" $version "_build/default/lib/opentelemetry/ebin" \
1515
--source-ref v${version} \

0 commit comments

Comments
 (0)