{"id":18603594,"url":"https://github.com/cogini/opentelemetry_xray","last_synced_at":"2025-10-13T15:06:04.709Z","repository":{"id":202824170,"uuid":"708127858","full_name":"cogini/opentelemetry_xray","owner":"cogini","description":"OpenTelemetry AWS X-Ray for Erlang","archived":false,"fork":false,"pushed_at":"2025-04-22T22:38:09.000Z","size":60,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-22T23:24:51.715Z","etag":null,"topics":["aws","erlang-library","opentelemetry","x-ray","xray"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cogini.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-10-21T15:56:01.000Z","updated_at":"2025-04-22T22:35:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"75592995-a878-4c27-9d6c-3e87710ca098","html_url":"https://github.com/cogini/opentelemetry_xray","commit_stats":null,"previous_names":["cogini/opentelemetry_propagator_xray","cogini/opentelemetry_xray"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cogini/opentelemetry_xray","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogini%2Fopentelemetry_xray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogini%2Fopentelemetry_xray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogini%2Fopentelemetry_xray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogini%2Fopentelemetry_xray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cogini","download_url":"https://codeload.github.com/cogini/opentelemetry_xray/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogini%2Fopentelemetry_xray/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015901,"owners_count":26085777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","erlang-library","opentelemetry","x-ray","xray"],"created_at":"2024-11-07T02:14:51.938Z","updated_at":"2025-10-13T15:06:04.703Z","avatar_url":"https://github.com/cogini.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"![test workflow](https://github.com/cogini/opentelemetry_xray/actions/workflows/test.yml/badge.svg)\n[![Module Version](https://img.shields.io/hexpm/v/opentelemetry_xray.svg)](https://hex.pm/packages/opentelemetry_xray)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/opentelemetry_xray)\n[![Total Download](https://img.shields.io/hexpm/dt/opentelemetry_xray.svg)](https://hex.pm/packages/opentelemetry_xray)\n[![License](https://img.shields.io/hexpm/l/opentelemetry_xray.svg)](https://github.com/cogini/opentelemetry_xray/blob/master/LICENSE.md)\n[![Last Updated](https://img.shields.io/github/last-commit/cogini/opentelemetry_xray/main)](https://github.com/cogini/opentelemetry_xray/commits/main)\n[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)\n\n# opentelemetry_xray\n\n[OpenTelemetry](https://opentelemetry.io/) [AWS X-Ray](https://aws.amazon.com/xray/) support for Erlang/Elixir.\n\nIt works with the [AWS Distro for OpenTelemetry Collector](https://aws-otel.github.io/docs/getting-started/collector),\na version of the [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/)\nwhich has support for AWS services such as X-Ray. This collector accepts standard\nOpenTelemetry traces, converts them to X-Ray format, and sends them to AWS. You\ncan run the collector as a sidecar container in an ECS task or as a daemon\non an EC2 instance.\n\nIn AWS X-Ray, the `trace_id` is a 128-bit value. The first 32 bits are a Unix\n`time_t` and the rest are a 96-bit random number. If you use the default\n`trace_id`, then X-Ray will reject your traces. This library generates ids that\nare compatible with X-Ray.\n\nWhen your app app is downstream from another app or the AWS load balancer, the\nupstream app creates the trace for the current request and sends it in the\n`X-Amzn-Trace-Id` HTTP header. The header includes the trace id and optional\ninformation about the parent span and sampling.\n\nThis library includes a propagator which reads the trace id from this header\nand uses it within your app. It can then pass the same trace id to downstream\napps via the header.\n\nNOTE: By default Amazon samples relatively few traces. If you want to ensure\nthat your traces are sampled, make sure that you turn on sampling in your app.\nA common approach is to turn on sampling for all traces that have errors\nand for some percentage of normal traces.\n\nThis library includes the following modules:\n\n* An id generator that creates X-Ray-compatible `trace_id` and `span_id`.\n  It implements the `otel_id_generator` protocol in the Erlang SDK.\n\n* A propagator that reads and writes AWS X-Ray trace context headers.\n  It implements the `otel_propagator_text_map` protocol in the Erlang SDK.\n\nLinks:\n\n* Propagators in general: https://opentelemetry.io/docs/specs/otel/context/api-propagators/\n* Erlang SDK propagation: https://opentelemetry.io/docs/instrumentation/erlang/propagation/\n* Erlang SDK id generator: https://github.com/open-telemetry/opentelemetry-erlang/blob/main/apps/opentelemetry/src/otel_id_generator.erl\n* X-Ray tracing header: https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-tracingheader\n* X-Ray sampling: https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-sampling\n* X-Ray configuration: https://aws-otel.github.io/docs/getting-started/x-ray#configuring-the-aws-x-ray-exporter\n* AWS CloudWatch Log Group resource: https://github.com/aws/aws-xray-sdk-python/issues/188\n* OpenTelemetry resources: https://opentelemetry.io/docs/instrumentation/erlang/resources/\n* OpenTelemetry getting started: https://opentelemetry.io/docs/instrumentation/erlang/getting-started/\n* OpenTelemetry intro: https://davelucia.com/blog/observing-elixir-with-lightstep\n* Addding Erlang logger filters to new Elixir logger: https://write.as/yuriploc/elixir-logger-and-erlang-filters\n\n## Installation\n\nErlang:\n\nAdd `opentelemetry_xray` to the list of dependencies in `rebar.config`:\n\n```erlang\n{deps, [opentelemetry_xray]}.\n```\n\nElixir:\n\nAdd `opentelemetry_xray` to the list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:opentelemetry_xray, \"~\u003e 0.7\"},\n  ]\nend\n```\n\n## Configuration\n\nErlang:\n\nIn `sys.config`:\n\n```erlang\n{opentelemetry, {\n    id_generator, [opentelemetry_xray_id_generator],\n    propagators: [opentelemetry_xray_propagator, baggage]\n}}\n```\n\nElixir:\n\nIn `config/prod.exs`, configure `opentelemetry` to use this library:\n\n```elixir\nconfig :opentelemetry,\n  id_generator: :opentelemetry_xray_id_generator,\n  propagators: [:opentelemetry_xray_propagator, :baggage]\n```\n\nAdd resource attributes to the span to connect it to log messages:\n\n```shell\nexport OTEL_RESOURCE_ATTRIBUTES=\"aws.log.group.names=$AWS_LOG_GROUP\"\n```\n\nSee [phoenix_container_example](https://github.com/cogini/phoenix_container_example)\nfor a complete Elixir Phoenix app that uses this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcogini%2Fopentelemetry_xray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcogini%2Fopentelemetry_xray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcogini%2Fopentelemetry_xray/lists"}