{"id":15063662,"url":"https://github.com/sashman/phx_ex_ray","last_synced_at":"2025-04-10T11:25:21.913Z","repository":{"id":57533175,"uuid":"121525050","full_name":"sashman/phx_ex_ray","owner":"sashman","description":"Wrapper around ex_ray for OpenTrace in Elixir Phoenix","archived":false,"fork":false,"pushed_at":"2018-05-29T07:44:04.000Z","size":14,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T20:03:58.855Z","etag":null,"topics":["elixir","ex","opentracing","otter","phoenix","phoenix-framework","phx","ray"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sashman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-14T15:15:29.000Z","updated_at":"2020-11-24T18:04:59.000Z","dependencies_parsed_at":"2022-09-26T18:20:50.442Z","dependency_job_id":null,"html_url":"https://github.com/sashman/phx_ex_ray","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashman%2Fphx_ex_ray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashman%2Fphx_ex_ray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashman%2Fphx_ex_ray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashman%2Fphx_ex_ray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sashman","download_url":"https://codeload.github.com/sashman/phx_ex_ray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208618,"owners_count":21065203,"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","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":["elixir","ex","opentracing","otter","phoenix","phoenix-framework","phx","ray"],"created_at":"2024-09-25T00:05:37.273Z","updated_at":"2025-04-10T11:25:21.889Z","avatar_url":"https://github.com/sashman.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PhxExRay\n\n\u003e _The first x is silent_\n\n[![Hex.pm](https://img.shields.io/hexpm/v/phx_ex_ray.svg)](https://hex.pm/packages/phx_ex_ray)\n\nWrapper around [ex_ray](https://github.com/derailed/ex_ray) for OpenTrace in Elixir Phoenix. Initial implementation based on the [ex_ray_tracers](https://github.com/derailed/ex_ray_tracers) example.\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `phx_ex_ray` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:phx_ex_ray, \"~\u003e 0.1\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/phx_ex_ray](https://hexdocs.pm/phx_ex_ray).\n\n## Usage\n\nConfigure [otter](https://github.com/Bluehouse-Technology/otter):\n\n```elixir\nconfig :otter,\n  zipkin_collector_uri:    'http://127.0.0.1:9411/api/v1/spans',\n  zipkin_tag_host_service: \"MyApp\"\n```\n\n\u003e `zipkin_collector_uri` must be a char list\n\nConfigure application:\n\n```elixir\n# application.ex\n\n...\nExRay.Store.create()\n...\n```\n\n### Plug Usage\n\n```elixir\n# lib/my_app/endpoint.ex\n\n...\nplug Plug.RequestId         # needs a `x-request-id` header, generated by the RequestId plug\nplug PhxExRay.Tracing.Plug\n...\n```\n\n### Controller Usage\n\nCross controller set up:\n\n```elixir\n# lib/my_app/my_app_web.ex\n\ndef controller do\n  quote do\n    ...\n    import PhxExRay.Span\n    ...\n  end\nend\n```\n\nThen in a specific controller:\n\n```elixir\nuse PhxExRay.Span, :controller\n\n@trace kind: :action\ndef index(conn, _params) do\n  ...\nend\n```\n\n### Database Context Usage\n\nIn a context, or any file where you use `alias MyApp.Repo`:\n\n```elixir\nuse PhxExRay.Span, {:context, MyApp.Repo}\n\n...\n@trace query: :list_all_users, kind: :all, queryable: User\ndef list_users() do\n  Repo.all(User)\nend\n\n# or\n\n@trace query: :get_user_or_explode, sql: \"SELECT * FROM users WHERE (id = X)\"\ndef get_user!(id), do: Repo.get!(User, id)\n```\n\n### Http Client Usage\n\n[ex_ray](https://github.com/derailed/ex_ray#installation) provides integration for http client tracing. Additional config required to specific which http client you want to use:\n\n```elixir\nconfig :otter,\n  ...\n  http_client: (:ibrowse|:httpc|:hackney)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsashman%2Fphx_ex_ray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsashman%2Fphx_ex_ray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsashman%2Fphx_ex_ray/lists"}