{"id":13651316,"url":"https://github.com/opencensus-beam/opencensus_elixir","last_synced_at":"2025-10-18T07:22:53.887Z","repository":{"id":33910438,"uuid":"161716351","full_name":"opencensus-beam/opencensus_elixir","owner":"opencensus-beam","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-10T21:53:49.000Z","size":61,"stargazers_count":39,"open_issues_count":5,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-24T01:52:09.519Z","etag":null,"topics":["apm","elixir","opencensus","tracing"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/opencensus-beam.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-12-14T01:39:14.000Z","updated_at":"2024-10-27T03:44:35.000Z","dependencies_parsed_at":"2022-08-08T21:30:16.471Z","dependency_job_id":null,"html_url":"https://github.com/opencensus-beam/opencensus_elixir","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/opencensus-beam/opencensus_elixir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opencensus-beam","download_url":"https://codeload.github.com/opencensus-beam/opencensus_elixir/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_elixir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002075,"owners_count":26083285,"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-09T02:00:07.460Z","response_time":59,"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":["apm","elixir","opencensus","tracing"],"created_at":"2024-08-02T02:00:47.894Z","updated_at":"2025-10-09T21:12:21.066Z","avatar_url":"https://github.com/opencensus-beam.png","language":"Elixir","funding_links":[],"categories":["Integrations","Tracing"],"sub_categories":["Erlang/Elixir"],"readme":"# Opencensus\n\n[![CircleCI](https://circleci.com/gh/opencensus-beam/opencensus_elixir.svg?style=svg)](https://circleci.com/gh/opencensus-beam/opencensus_elixir)\n[![Hex version badge](https://img.shields.io/hexpm/v/opencensus_elixir.svg)](https://hex.pm/packages/opencensus_elixir)\n\nWraps some [`:opencensus`][:opencensus] capabilities for Elixir users so\nthey don't have to [learn them some Erlang][lyse] in order to get\n[OpenCensus] distributed tracing.\n\n[opencensus]: http://opencensus.io\n[:opencensus]: https://hex.pm/packages/opencensus\n[lyse]: https://learnyousomeerlang.com\n\n## Installation\n\nAdd `opencensus_elixir` to your `deps` in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:opencensus, \"~\u003e 0.9\"},\n    {:opencensus_elixir, \"~\u003e 0.3.0\"}\n  ]\nend\n```\n\n## Usage\n\nWrap your code with the\n[`Opencensus.Trace.with_child_span/3`][oce-with_child_span-3] macro to\nexecute it in a fresh span:\n\n```elixir\nimport Opencensus.Trace\n\ndef traced_fn(arg) do\n  with_child_span \"traced\" do\n    :YOUR_CODE_HERE\n  end\nend\n```\n\n## Alternatives\n\nIf you prefer driving Erlang packages directly (see also `:telemetry`), copy\nwhat you need from `lib/opencensus/trace.ex` and call\n`Logger.set_logger_metadata/0` if there's any chance of Logger use within\nthe span.\n\n```elixir\ndef traced_fn() do\n  try do\n    :ocp.with_child_span(\"name\", %{fn: :traced_fn, mod: __MODULE__})\n    Logger.set_logger_metadata()\n\n    :YOUR_CODE_HERE\n  after\n    :ocp.finish_span()\n    Logger.set_logger_metadata()\n  end\nend\n```\n\nIf `try .. after .. end` feels too bulky and you're _sure_ you won't need\nLogger, try [`:ocp.with_child_span/3`][ocp-with_child_span-3]:\n\n```elixir\ndef traced_fn() do\n  :ocp.with_child_span(\"traced\", %{fn: :traced_fn, mod: __MODULE__}, fn () -\u003e\n    :YOUR_CODE_HERE\n  end)\nend\n```\n\n## Troubleshooting\n\nTo see your spans, use the `:oc_reporter_stdout` reporter, either in config:\n\n```elixir\nconfig :opencensus, reporters: [{:oc_reporter_stdout, []}]\n```\n\n... or at the `iex` prompt:\n\n```plain\niex\u003e :oc_reporter.register(:oc_reporter_stdout)\n```\n\n[oce-with_child_span-3]: https://hexdocs.pm/opencensus_elixir/Opencensus.Trace.html#with_child_span/3\n[ocp-with_child_span-3]: https://hexdocs.pm/opencensus/ocp.html#with_child_span-3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencensus-beam%2Fopencensus_elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopencensus-beam%2Fopencensus_elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencensus-beam%2Fopencensus_elixir/lists"}