{"id":29210633,"url":"https://github.com/embarkstudios/tracing-ext-ffi-subscriber","last_synced_at":"2025-07-02T21:07:21.568Z","repository":{"id":57680731,"uuid":"492441118","full_name":"EmbarkStudios/tracing-ext-ffi-subscriber","owner":"EmbarkStudios","description":"Simple subscriber for forwarding tracing spans to a C or C++ profiling API.","archived":false,"fork":false,"pushed_at":"2023-07-19T11:18:21.000Z","size":50,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-24T19:14:23.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/EmbarkStudios.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2022-05-15T09:25:15.000Z","updated_at":"2024-02-12T06:53:30.000Z","dependencies_parsed_at":"2022-09-01T14:51:49.176Z","dependency_job_id":null,"html_url":"https://github.com/EmbarkStudios/tracing-ext-ffi-subscriber","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"EmbarkStudios/opensource-template","purl":"pkg:github/EmbarkStudios/tracing-ext-ffi-subscriber","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftracing-ext-ffi-subscriber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftracing-ext-ffi-subscriber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftracing-ext-ffi-subscriber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftracing-ext-ffi-subscriber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EmbarkStudios","download_url":"https://codeload.github.com/EmbarkStudios/tracing-ext-ffi-subscriber/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EmbarkStudios%2Ftracing-ext-ffi-subscriber/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263215299,"owners_count":23431895,"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":[],"created_at":"2025-07-02T21:07:20.573Z","updated_at":"2025-07-02T21:07:21.546Z","avatar_url":"https://github.com/EmbarkStudios.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Allow this file to not have a first line heading --\u003e\n\u003c!-- markdownlint-disable-file MD041 --\u003e\n\n\u003c!-- inline html --\u003e\n\u003c!-- markdownlint-disable-file MD033 --\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# `⏱️ tracing-ext-ffi-subscriber`\n\n**Subscriber for passing spans from a rust library to a profiling tool in a host application via FFI.**\n\n[![Embark](https://img.shields.io/badge/embark-open%20source-blueviolet.svg)](https://embark.dev)\n[![Embark](https://img.shields.io/badge/discord-ark-%237289da.svg?logo=discord)](https://discord.gg/dAuKfZS)\n[![Crates.io](https://img.shields.io/crates/v/tracing-ext-ffi-subscriber.svg)](https://crates.io/crates/tracing-ext-ffi-subscriber)\n[![Docs](https://docs.rs/tracing-ext-ffi-subscriber/badge.svg)](https://docs.rs/tracing-ext-ffi-subscriber)\n[![dependency status](https://deps.rs/repo/github/EmbarkStudios/tracing-ext-ffi-subscriber/status.svg)](https://deps.rs/repo/github/EmbarkStudios/tracing-ext-ffi-subscriber)\n[![Build status](https://github.com/EmbarkStudios/tracing-ext-ffi-subscriber/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/tracing-ext-ffi-subscriber/actions)\n\u003c/div\u003e\n\nA simple crate for passing spans generated by the tracing ecosystem to a C or C++ profiling system when Rust is\nintegrated into an existing framework. To help with integration into other tools you can use the environment variable\n`TRACING_FFI_RELATIVE_OUT_DIR` to configure where the include file ends relative to the build output (`OUT_DIR`). For\nexample, `TRACING_FFI_RELATIVE_OUT_DIR = \"../../../../../include\"` will normally lead to the files being generated in an\n`include` dir next to your Cargo.toml.\n\n## Example usage\n\n```c\n#include \u003cProfiling.h\u003e\n#include \u003ctracing_ffi.h\u003e\n#include \u003cmyrustlib.h\u003e\n\nint main(int argc, const char* argv[]) {\n    tracing_ffi_ReturnCode result = tracing_ffi_install_global_with_enable(\n        profiling_begin_named_scope,\n        profiling_end_named_scope,\n        profiling_is_enabled,\n    );\n\n    if (result != tracing_ffi_ReturnCode_Success) {\n        return (int)result;\n    }\n\n    myrustlib_execute(10, 20);\n\n    profiling_write_file(\"profile.json\");\n}\n```\n\nYou can of course also configure this from Rust code; and bypass the C-api. In that case, use\n`subscriber::ExternFFISpanSubscriber` directly, and install with your preferred `tracing` method.\n\n## Contribution\n\n[![Contributor Covenant](https://img.shields.io/badge/contributor%20covenant-v1.4-ff69b4.svg)](../main/CODE_OF_CONDUCT.md)\n\nWe welcome community contributions to this project.\n\nPlease read our [Contributor Guide](CONTRIBUTING.md) for more information on how to get started.\nPlease also read our [Contributor Terms](CONTRIBUTING.md#contributor-terms) before you make any contributions.\n\nAny contribution intentionally submitted for inclusion in an Embark Studios project, shall comply with the Rust standard licensing model (MIT OR Apache 2.0) and therefore be dual licensed as described below, without any additional terms or conditions:\n\n### License\n\nThis contribution is dual licensed under EITHER OF\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\nFor clarity, \"your\" refers to Embark or any other licensee/user of the contribution.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembarkstudios%2Ftracing-ext-ffi-subscriber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fembarkstudios%2Ftracing-ext-ffi-subscriber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fembarkstudios%2Ftracing-ext-ffi-subscriber/lists"}