{"id":13651414,"url":"https://github.com/opencensus-beam/opencensus_plug","last_synced_at":"2025-04-09T18:43:39.777Z","repository":{"id":50225838,"uuid":"160407399","full_name":"opencensus-beam/opencensus_plug","owner":"opencensus-beam","description":"Opencensus integration with Elixir's Plug library","archived":false,"fork":false,"pushed_at":"2021-06-01T10:58:22.000Z","size":74,"stargazers_count":14,"open_issues_count":4,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T20:43:47.913Z","etag":null,"topics":["elixir","elixir-plug","metrics","opencensus","tracing"],"latest_commit_sha":null,"homepage":"","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":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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-04T19:21:05.000Z","updated_at":"2024-10-27T03:45:48.000Z","dependencies_parsed_at":"2022-08-31T08:50:32.858Z","dependency_job_id":null,"html_url":"https://github.com/opencensus-beam/opencensus_plug","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_plug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_plug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_plug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opencensus-beam%2Fopencensus_plug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opencensus-beam","download_url":"https://codeload.github.com/opencensus-beam/opencensus_plug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247589823,"owners_count":20963025,"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","elixir-plug","metrics","opencensus","tracing"],"created_at":"2024-08-02T02:00:49.200Z","updated_at":"2025-04-09T18:43:39.747Z","avatar_url":"https://github.com/opencensus-beam.png","language":"Elixir","funding_links":[],"categories":["Integrations","Tracing"],"sub_categories":["Erlang/Elixir"],"readme":"# Opencensus.Plug\n\n[![CircleCI](https://circleci.com/gh/opencensus-beam/opencensus_plug.svg?style=svg)](https://circleci.com/gh/opencensus-beam/opencensus_plug)\n[![CodeCov](https://codecov.io/gh/opencensus-beam/opencensus_plug/branch/master/graph/badge.svg)](https://codecov.io/gh/opencensus-beam/opencensus_plug)\n[![Inline docs](http://inch-ci.org/github/opencensus-beam/opencensus_plug.svg)](http://inch-ci.org/github/opencensus-beam/opencensus_plug)\n[![Hex version badge](https://img.shields.io/hexpm/v/opencensus_plug.svg)](https://hex.pm/packages/opencensus_plug)\n\n[Plug][plug] integration for [OpenCensus][oc]. It provides tracer and metrics\nintegration.\n\n## Installation\n\nThe package can be installed by adding `opencensus_plug` to your list\nof dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:opencensus_plug, \"~\u003e 0.3\"}\n  ]\nend\n```\n\nThe docs can be found at [https://hexdocs.pm/opencensus\\_plug](https://hexdocs.pm/opencensus_plug).\n\n## Usage\n\n### Tracing\n\nCreate tracing module:\n\n```elixir\ndefmodule MyApp.TracePlug do\n  use Opencensus.Plug.Trace\nend\n```\n\nAnd then add it on the beginning of your pipeline (the sooner the better):\n\n```elixir\nplug MyApp.TracePlug\n```\n\nThis will extract parent trace from the headers accordingly\nto [Tracing Context](https://github.com/w3c/trace-context) proposal and it will\ncreate new span. By default span name will match request path, you can configure\nthat by defining `span_name/2` method that will receive `Plug.Conn.t` as a first\nargument and plug options as a second.\n\n### Metrics\n\nCreate metrics module:\n\n```elixir\ndefmodule MyApp.MetricsPlug do\n  use Opencensus.Plug.Metrics\nend\n```\n\nAnd then add it on the beginning of your pipeline (the sooner the better):\n\n```elixir\nplug MyApp.MetricsPlug\n```\n\nYou also need to define metrics that will be measured, fortunately there is\nhelper method for you, just call `MyApp.MetricsPlug.setup_metrics()` **before**\nrunning pipeline.\n\nAvailable metrics:\n\n- `\"plug/requests/duration\"` - request duration in microseconds\n- `\"plug/requests/count\"` - requests count\n\n**WARNING!** This defines only metrics, not views. You need to define views on\nyour own to be able to see them in the exporters.\n\n## License\n\nSee [LICENSE](LICENSE) file.\n\n[plug]: https://github.com/elixir-plug/plug\n[oc]: https://opencensus.io\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencensus-beam%2Fopencensus_plug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopencensus-beam%2Fopencensus_plug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopencensus-beam%2Fopencensus_plug/lists"}