Skip to content

Commit

Permalink
Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
reachfh committed Dec 23, 2023
1 parent 59aa068 commit d73da48
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[OpenTelemetry](https://opentelemetry.io/) [AWS X-Ray](https://aws.amazon.com/xray/) support for Erlang/Elixir.

This library includes two modules:
This library includes the following modules:

* An id generator that creates X-Ray-compatible `trace_id` and `span_id`.
It implements the `otel_id_generator` protocol in the Erlang SDK.
Expand All @@ -16,9 +16,9 @@ This library includes two modules:
It assumes that you are using the
[AWS Distro for OpenTelemetry Collector](https://aws-otel.github.io/docs/getting-started/collector),
a version of the [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/)
which has support for AWS services such as X-Ray. It accepts standard
OpenTelemetry traces, converts them to X-Ray format, and sends them to AWS.
You can run the collector as a sidecar container in an ECS task or as a daemon
which has support for AWS services such as X-Ray. This collector accepts standard
OpenTelemetry traces, converts them to X-Ray format, and sends them to AWS. You
can run the collector as a sidecar container in an ECS task or as a daemon
on an EC2 instance.

In AWS X-Ray, the `trace_id` is a 128-bit value. The first 32 bits are a Unix
Expand All @@ -35,12 +35,11 @@ This library includes a propagator which reads the trace id from this header
and uses it within your app. It can then pass the same trace id to downstream
apps via the header.

NOTE: Amazon by default samples relatively few traces. If you want to ensure
NOTE: By default Amazon samples relatively few traces. If you want to ensure
that your traces are sampled, make sure that you turn on sampling in your app.
A common approach is to turn on sampling for all traces that have errors,
and some percentage of normal traces.


Links:

* Propagators in general: https://opentelemetry.io/docs/specs/otel/context/api-propagators/
Expand Down Expand Up @@ -79,9 +78,20 @@ end

## Configuration

Erlang:

In `sys.config`:

```erlang
{opentelemetry, {
id_generator, [opentelemetry_xray_id_generator],
propagators: [opentelemetry_xray_propagator, baggage]
}}
```

Elixir:

In `config/config.exs` or `config/prod.exs`, configure `opentelemetry` to use this library:
In `config/prod.exs`, configure `opentelemetry` to use this library:

```elixir
config :opentelemetry,
Expand All @@ -92,19 +102,8 @@ config :opentelemetry,
Add resource attributes to the span to connect it to log messages:

```shell
OTEL_RESOURCE_ATTRIBUTES="aws.log.group.names=$AWS_LOG_GROUP"
export OTEL_RESOURCE_ATTRIBUTES="aws.log.group.names=$AWS_LOG_GROUP"
```

See [phoenix_container_example](https://github.com/cogini/phoenix_container_example)
for a complete Elixir Phoenix app that uses this library.

Erlang:

In `sys.config`:

```erlang
{opentelemetry, {
id_generator, [opentelemetry_xray_id_generator],
propagators: [opentelemetry_xray_propagator, baggage]
}}
```

0 comments on commit d73da48

Please sign in to comment.