{"id":13508421,"url":"https://github.com/spandex-project/spandex","last_synced_at":"2026-02-21T12:01:28.029Z","repository":{"id":45128414,"uuid":"94697872","full_name":"spandex-project/spandex","owner":"spandex-project","description":"A platform agnostic tracing library","archived":false,"fork":false,"pushed_at":"2023-10-16T18:10:40.000Z","size":448,"stargazers_count":343,"open_issues_count":19,"forks_count":53,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-10-21T19:02:52.115Z","etag":null,"topics":["hacktoberfest"],"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/spandex-project.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["gregmefford"]}},"created_at":"2017-06-18T16:02:03.000Z","updated_at":"2025-10-07T14:18:35.000Z","dependencies_parsed_at":"2024-01-08T19:22:12.204Z","dependency_job_id":null,"html_url":"https://github.com/spandex-project/spandex","commit_stats":{"total_commits":310,"total_committers":29,"mean_commits":"10.689655172413794","dds":"0.24838709677419357","last_synced_commit":"a40c10acee3550e657244f7f17c072b178e80b0d"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"purl":"pkg:github/spandex-project/spandex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spandex-project%2Fspandex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spandex-project%2Fspandex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spandex-project%2Fspandex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spandex-project%2Fspandex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spandex-project","download_url":"https://codeload.github.com/spandex-project/spandex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spandex-project%2Fspandex/sbom","scorecard":{"id":840202,"data":{"date":"2025-08-11","repo":{"name":"github.com/spandex-project/spandex","commit":"a40c10acee3550e657244f7f17c072b178e80b0d"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":3,"reason":"Found 9/29 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-vq52-99r9-h5pw","Warn: Project is vulnerable to: GHSA-9fm9-hp7p-53mf"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 13 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T20:17:16.390Z","repository_id":45128414,"created_at":"2025-08-23T20:17:16.390Z","updated_at":"2025-08-23T20:17:16.390Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29680147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T11:29:27.227Z","status":"ssl_error","status_checked_at":"2026-02-21T11:29:20.292Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["hacktoberfest"],"created_at":"2024-08-01T02:00:52.803Z","updated_at":"2026-02-21T12:01:28.007Z","avatar_url":"https://github.com/spandex-project.png","language":"Elixir","funding_links":["https://github.com/sponsors/gregmefford"],"categories":["Instrumenting / Monitoring","Tracing"],"sub_categories":[],"readme":"![Spandex](https://github.com/spandex-project/spandex/blob/master/static/spandex.png?raw=true)\n=========\n\n[![CircleCI](https://circleci.com/gh/spandex-project/spandex.svg?style=svg)](https://circleci.com/gh/spandex-project/spandex)\n[![Inline docs](http://inch-ci.org/github/spandex-project/spandex.svg)](http://inch-ci.org/github/spandex-project/spandex)\n[![Coverage Status](https://coveralls.io/repos/github/spandex-project/spandex/badge.svg)](https://coveralls.io/github/spandex-project/spandex)\n[![Hex pm](http://img.shields.io/hexpm/v/spandex.svg?style=flat)](https://hex.pm/packages/spandex)\n[![Total Download](https://img.shields.io/hexpm/dt/spandex.svg)](https://hex.pm/packages/spandex)\n[![License](https://img.shields.io/hexpm/l/spandex.svg)](https://github.com/spandex-project/spandex/blob/master/LICENSE)\n\nView the [documentation](https://hexdocs.pm/spandex)\n\nSpandex is a library for tracing your elixir application. Tracing is a\nmonitoring tool that allows you get extremely granular information about the\nruntime of your system. Using distributed tracing, you can also get a view of\nhow requests make their way through your entire ecosystem of microservices or\napplications. Currently, Spandex only supports integrating with\n[datadog](https://www.datadoghq.com/), but it is built to be agnostic to what\nplatform you choose to view your trace data. Eventually it should support Open\nZipkin, Stackdriver, and any other trace viewer/aggregation tool you'd like to\nintegrate with. We are still under active development, working on moving to a\nmore standard/generic implementation of the internals. Contributions welcome!\n\n## 3.0 Release\n\nThe 3.0 release only involves ensuring that you're using the latest adapter, which will be explicit in its dependency on a spandex version. This major version was done only to solve for breaking changes between the adapter and spandex core, in order to honor semver and also not break everyone's installation.\n\n## 2.0 Upgrade Guide\n\nThis is Datadog-specific since that's currently the only adapter.\n\n* Include the adapter as a dependency (see below).\n* Replace any occurrences of `Spandex.Adapters.Datadog` with\n  `SpandexDatadog.Adapter` in your code.\n* Replace any occurrences of `Spandex.Adapters.ApiSender` with\n  `SpandexDatadog.ApiSender` in your code.\n\n## Adapters\n\n* [Datadog](https://github.com/spandex-project/spandex_datadog)\n* Thats it so far! If you want another adapter, it should be relatively easy to\n  write! This library is in charge of handling the state management of spans,\n  and the adapter is just in charge of generating certain values and ultimately\n  sending the values to the service.\n\n## Installation\n\n```elixir\ndef deps do\n  [{:spandex, \"~\u003e 3.2\"}]\nend\n```\n\n## Setup and Configuration\n\nDefine your tracer:\n\n```elixir\ndefmodule MyApp.Tracer do\n  use Spandex.Tracer, otp_app: :my_app\nend\n```\n\nConfigure it:\n\n```elixir\nconfig :my_app, MyApp.Tracer,\n  service: :my_api,\n  adapter: SpandexDatadog.Adapter,\n  disabled?: false,\n  env: \"PROD\"\n```\n\nOr at runtime, by calling `configure/1` (usually in your application's startup)\n\n```elixir\nMyApp.Tracer.configure(disabled?: System.get_env(\"TRACE\") != \"true\")\n```\n\nFor more information on Tracer configuration, view the docs for\n`Spandex.Tracer`. There you will find the documentation for the `opts` schema.\nThe entire configuration can also be passed into each function in your tracer\nto be overridden if desired. For example:\n\n`MyApp.Tracer.start_span(\"span_name\", service: :some_special_service)`\n\nYour configuration and the configuration in your config files are merged\ntogether, to avoid needing to specify this config at all times.\n\nTo bypass the Tracer pattern entirely, you can call directly into the functions\nin `Spandex`, like `Spandex.start_span(\"span_name\", [adapter: Foo, service:\n:bar])`. Note that in this case, you will need to specify all of the\nconfiguration options in each call, because the Tracer is not managing the\ndefaults for you.\n\n### Adapter specific configuration\n\nFor adapter configuration, see the documentation for that adapter\n\n## Phoenix Plugs\n\nThere are 3 plugs provided for usage w/ Phoenix:\n\n* `Spandex.Plug.StartTrace` - See module docs for options. Goes as early in your\n  pipeline as possible.\n* `Spandex.Plug.AddContext` - See moduledoc for options. Either after the\n  router, or inside a pipeline in the router.\n* `Spandex.Plug.EndTrace` - Must go *after* your router.\n\n## Distributed Tracing\n\nIndividual adapters can support distributed tracing. See their documentation\nfor more information.\n\n## Logger metadata\n\nIn general, you'll probably want the current span_id and trace_id in your logs,\nso that you can find them in your tracing service. Make sure to add `span_id`\nand `trace_id` to logger_metadata\n\n```elixir\nconfig :logger, :console,\n  metadata: [:request_id, :trace_id, :span_id]\n```\n\n## General Usage\n\nThe nicest interface for working with spans is the `span` macro, illustrated in\n`span_me_also` below.\n\n```elixir\ndefmodule ManuallyTraced do\n  require Spandex\n\n  # Does not handle exceptions for you.\n  def trace_me() do\n    Tracer.start_trace(\"my_trace\") #also opens a span\n    Tracer.update_span(service: :my_app, type: :db)\n\n    result = span_me()\n\n    Tracer.finish_trace()\n\n    result\n  end\n\n  # Does not handle exceptions for you.\n  def span_me() do\n    Tracer.start_span(\"this_span\")\n    Tracer.update_span(service: :my_app, type: :web)\n\n    result = span_me_also()\n\n    Tracer.finish_span()\n  end\n\n  # Handles exception at the span level. Trace still must be reported.\n  def span_me_also() do\n    Tracer.span(\"span_me_also\") do\n      ...\n    end\n  end\nend\n```\n\n### Metadata\n\nSee the module documentation for `Spandex.Span` as well as the documentation\nfor the structs contained as keys for that struct. They illustrate the keys\nthat are known to either be common keys or to have UI sugar with certain\nclients. Its hard to find any kind of list of these published anywhere, so let\nme know if you know of more!\n\nFor example:\n\n```elixir\nSpandex.update_span(\n  type: :db,\n  http: [url: \"/posts\", status_code: 400],\n  sql_query: [query: \"SELECT * FROM posts\", rows: 10]\n)\n```\n\n## Asynchronous Processes\n\nThe current `trace_id` and `span_id` can be retrieved and later used (for\nexample, from another process) as follows:\n\n```elixir\ntrace_id = Tracer.current_trace_id()\nspan_id = Tracer.current_span_id()\nspan_context = %SpanContext{trace_id: trace_id, parent_id: span_id}\nTracer.continue_trace(\"new_trace\", span_context)\n```\n\nNew spans can then be logged from there and sent in a separate batch.\n\n## Strategies\n\nThere is (currently and temporarily) only one storage strategy, which can be\nchanged via the `strategy` option. See Tracer opt documentation for an example\nof setting it. To implement your own (ETS adapter should be on its way), simply\nimplement the `Spandex.Strategy` behaviour. Keep in mind that the strategy is\nnot an atomic pattern. It represents retrieving and wholesale replacing a\ntrace, meaning that it is *not* safe to use across processes or concurrently.\nEach process should have its own store for its own generated spans. This should\nbe fine because you can send multiple batches of spans for the same trace\nseparately.\n\n## Decorators\n\nBecause the  `decorator` library can cause conflicts when it interacts with other dependencies in the same project, we support it as an optional dependency. This allows you to disable it if it causes problems for you, but it also means that you need to explicitly include some version of `decorator` in your application's dependency list:\n\n```elixir\n# mix.exs\n\ndefp deps do\n  [\n    {:decorator, \"~\u003e 1.2\"}\n  ]\nend\n```\n\nThen, configure the Spandex decorator with your default tracer:\n\n```elixir\nconfig :spandex, :decorators, tracer: MyApp.Tracer\n```\n\nSpan function decorators take an optional argument which is the attributes to update the span with. One of those attributes can be the `:tracer` in case you want to override the default tracer (e.g., in case you want to use multiple tracers).\n\nIMPORTANT If you define multiple clauses for a function, you'll have to decorate all of the ones you want to span.\n\n```elixir\ndefmodule TracedModule do\n  use Spandex.Decorators\n\n  @decorate trace(service: :my_app, type: :web)\n  def trace_me() do\n    span_1()\n  end\n\n  @decorate span(name: \"span_1\")\n  def span_1() do\n    inner_span_1()\n  end\n\n  @decorate span()\n  def inner_span_1() do\n    _ = ThirdPartyApi.different_service_call()\n    inner_span_2()\n  end\n\n  @decorate span(tracer: MyApp.OtherTracer)\n  def inner_span_2() do\n    \"this produces a span stack to be reported by another tracer\"\n  end\n\n  # Multiple Clauses\n  @decorate span()\n  def divide(n, 0), do: {:error, :divide_by_zero}\n  @decorate span()\n  def divide(n, m), do: n / m\nend\n\ndefmodule ThirdPartyApi do\n  use Spandex.Decorators\n\n  @decorate span(service: :third_party, type: :cache)\n  def different_service_call() do\n    ...\n  end\nend\n```\n\nNote: Decorators don't magically do everything. It often makes a lot of sense to use `Tracer.update_span` from within your function to add details that are only available inside that same function.\n\n## Ecto Tracing\n\nCheck out [spandex_ecto](https://github.com/spandex-project/spandex_ecto).\n\n## Phoenix Tracing\n\nCheck out [spandex_phoenix](https://github.com/spandex-project/spandex_phoenix).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspandex-project%2Fspandex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspandex-project%2Fspandex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspandex-project%2Fspandex/lists"}