From d73da4810b51412a0818456b2dd7ea36e6f82fbe Mon Sep 17 00:00:00 2001 From: Jake Morrison Date: Sat, 23 Dec 2023 13:52:51 -0600 Subject: [PATCH] Doc --- README.md | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7d7aa91..83bb816 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 @@ -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/ @@ -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, @@ -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] -}} -```