{"id":16727687,"url":"https://github.com/poiscript/tracing-newrelic","last_synced_at":"2026-03-11T18:39:41.246Z","repository":{"id":43374889,"uuid":"323952615","full_name":"PoiScript/tracing-newrelic","owner":"PoiScript","description":"New Relic integration for tracing","archived":false,"fork":false,"pushed_at":"2024-03-04T10:45:27.000Z","size":1013,"stargazers_count":11,"open_issues_count":4,"forks_count":4,"subscribers_count":2,"default_branch":"a","last_synced_at":"2025-03-18T05:13:16.050Z","etag":null,"topics":["newrelic","rust","tracing"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/PoiScript.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-23T16:37:15.000Z","updated_at":"2024-11-29T07:38:10.000Z","dependencies_parsed_at":"2024-10-28T11:34:34.234Z","dependency_job_id":"6f027924-5862-49a5-a0d1-5dc47e5cf269","html_url":"https://github.com/PoiScript/tracing-newrelic","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.08823529411764708,"last_synced_commit":"cd02febe27de01d668040e1d4706d7fe0a510da5"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoiScript%2Ftracing-newrelic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoiScript%2Ftracing-newrelic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoiScript%2Ftracing-newrelic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PoiScript%2Ftracing-newrelic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PoiScript","download_url":"https://codeload.github.com/PoiScript/tracing-newrelic/tar.gz/refs/heads/a","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244874154,"owners_count":20524576,"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":["newrelic","rust","tracing"],"created_at":"2024-10-12T23:06:38.470Z","updated_at":"2026-03-11T18:39:41.199Z","avatar_url":"https://github.com/PoiScript.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tracing-newrelic\n\nNew Relic integration for tracing\n\n## Overview\n\nThis crate provides a layer for collecting trace data from [`tracing`] and sending them to [New Relic].\n\n`tracing::Span` will be tried as Trace Span, and `tracing::Event` as Logs.\n\n`tracing::Attribute` and `tracing::Metadata` wil be tried as Custom Attributes.\n\n[`tracing`]: https://github.com/tokio-rs/tracing\n[New Relic]: https://newrelic.com\n\n## Examples\n\n```rust\nuse std::thread::sleep;\nuse std::time::Duration;\n\nuse tracing_subscriber::{layer::SubscriberExt, Registry};\n\n#[tracing::instrument(name = \"fibonacci()\")]\nfn fibonacci(n: u32) -\u003e u32 {\n    let ms = 100 * n as u64;\n\n    tracing::info!(n = n, \"sleep {}ms\", ms);\n\n    sleep(Duration::from_millis(ms));\n\n    match n {\n        0 | 1 =\u003e 1,\n        _ =\u003e fibonacci(n - 1) + fibonacci(n - 2),\n    }\n}\n\nfn main() {\n    env_logger::init();\n\n    let newrelic = tracing_newrelic::layer(\"YOUR-API-KEY\");\n\n    let fmt = tracing_subscriber::fmt::layer();\n\n    let subscriber = Registry::default().with(newrelic).with(fmt);\n\n    tracing::subscriber::with_default(subscriber, || {\n        let span = tracing::info_span!(\n            \"calculating fibonacci(3)\",\n            service.name = \"tracing-newrelic-demo\"\n        );\n\n        let _enter = span.enter();\n\n        fibonacci(3);\n    });\n}\n```\n\n1. Replace `YOUR-API-KEY` above with your api key and run it.\n\n2. Open [New Relic One], navigate to `Entity explorer` and search for `tracing-newrelic-demo`.\n\n3. You should see a entry span named `calculating fibonacci(3)` and click it for more details:\n\n\u003cimg src=\"https://raw.githubusercontent.com/PoiScript/tracing-newrelic/a/screenshot/distributed-tracing.jpg\"  width=\"804\" height=\"570\"  alt=\"newrelic screenshot\" /\u003e\n\n4. Click `See logs` to view all events inside this span:\n\n\u003cimg src=\"https://raw.githubusercontent.com/PoiScript/tracing-newrelic/a/screenshot/log-in-context.jpg\"  width=\"825\" height=\"440\"  alt=\"newrelic screenshot\" /\u003e\n\n[New Relic One]: http://one.newrelic.com\n\nAnd I strongly recommend include these attributes in your spans:\n\n1. `span.kind`\n\n    New Relic creates throught and response time dashboards for spans with `span.kind` set to `server` and `consumer`.\n\n    \u003cimg src=\"https://raw.githubusercontent.com/PoiScript/tracing-newrelic/a/screenshot/throughtput-reponse-time.jpg\" width=\"691\" height=\"315\" alt=\"newrelic throughtput-reponse-time\" /\u003e\n\n2. `otel.status_code` \u0026 `otel.status_description`\n\n    New Relic creates error rate dashboard for spans with `otel.status_code` set to `ERROR`.\n\n    \u003cimg src=\"https://raw.githubusercontent.com/PoiScript/tracing-newrelic/a/screenshot/error-rate.jpg\" alt=\"newrelic error-rate\"   width=\"344\" height=\"345\"   /\u003e\n\n3. `service.name`\n\n    New Relic group entity by their `service.name` field.\n\n    \u003cimg src=\"https://raw.githubusercontent.com/PoiScript/tracing-newrelic/a/screenshot/services.jpg\"  alt=\"newrelic services\"  width=\"713\" height=\"174\"  /\u003e\n\n4. `name`\n\n    New Relic group trnsations by their `name` field.\n\n    \u003cimg src=\"https://raw.githubusercontent.com/PoiScript/tracing-newrelic/a/screenshot/transactions.jpg\"  alt=\"newrelic transactions\"  width=\"614\" height=\"326\"  /\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoiscript%2Ftracing-newrelic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoiscript%2Ftracing-newrelic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoiscript%2Ftracing-newrelic/lists"}