{"id":20740937,"url":"https://github.com/rollbar/rollbar-rust","last_synced_at":"2025-08-22T22:36:30.253Z","repository":{"id":37180327,"uuid":"172781279","full_name":"rollbar/rollbar-rust","owner":"rollbar","description":"Rust SDK and other Rust code for working with Rollbar","archived":false,"fork":false,"pushed_at":"2024-04-30T14:29:36.000Z","size":4169,"stargazers_count":7,"open_issues_count":7,"forks_count":2,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-04-30T15:51:57.209Z","etag":null,"topics":["error-monitoring","exception-reporting","exceptions","observability","rollbar","rust"],"latest_commit_sha":null,"homepage":"https://rollbar.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rollbar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-02-26T20:01:54.000Z","updated_at":"2024-04-30T14:29:40.000Z","dependencies_parsed_at":"2024-05-06T10:15:12.625Z","dependency_job_id":null,"html_url":"https://github.com/rollbar/rollbar-rust","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/rollbar%2Frollbar-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollbar%2Frollbar-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollbar%2Frollbar-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rollbar%2Frollbar-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rollbar","download_url":"https://codeload.github.com/rollbar/rollbar-rust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225008639,"owners_count":17406314,"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":["error-monitoring","exception-reporting","exceptions","observability","rollbar","rust"],"created_at":"2024-11-17T06:31:30.611Z","updated_at":"2024-11-17T06:31:31.125Z","avatar_url":"https://github.com/rollbar.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"## Attention:\n\nAs of May 2024, Rollbar will not be actively updating this repository and plans to archive it in January of 2025. We encourage our community to fork this repo if you wish to continue its development. While Rollbar will no longer be engaging in active development, we remain committed to reviewing and merging pull requests related to security updates. If an actively maintained fork emerges, please reach out to our support team and we will link to it from our documentation.\n\n\u003chr /\u003e\n\nThis is an umbrella project which contains a few different Rust crates for interacting with Rollbar.\nEverything is still heavily under development and everything include crate names are subject to\nchange.\n\n## Crates\n\n### rollbar-rust\n\nThe subdirectory `crates/core` contains a crate which defines the types necessary to build items for the\nRollbar API, basic configuration, and an HTTP transport for sending items to the API. The intended\npurpose of this crate is to serve as the foundation for interacting with the API for other things to\nbuild upon.\n\nI might change the name of this crate to something else and then have a higher level crate take over\nthe name of `rollbar-rust` which will be the Rust SDK. As of now this crate is not really a full\nfledged SDK.\n\n### rollbar-jvm\n\nThe subdirectory `crates/jvm_core` contains a crate which encapsulates certain interactions with the JVM\nand JVMTI. Building this crate requires `JAVA_HOME` be set correctly so that we can get access to\nthe JVMTI C headers to generate Rust bindings. You can see what is necessary in the `build.rs` file\nwithin this crate. This crate relies on `rollbar-rust` for some type definitions of Exceptions and\nFrames. These are used for getting stack traces from the JNI/JVMTI.\n\n### rollbar-java-agent\n\nThe subdirectory `crates/jvm_sdk_agent` contains a crate which builds a cdylib to be used as a native agent\nwith the JVM. This agent assumes existence and proper configuration of the `rollbar-java` SDK in\nyour Java project. It is intended to supplement the normal Java SDK by providing extra information\nthat is only possible to gather from the JVMTI. Currently this is only used for gathering local\nvariables. This crate is pretty small as most of the functionality is provided by `rollbar-jvm`.\n\n### rollbar-jvm-agent\n\nThe subdirectory `crates/jvm_bare_agent` contains a crate which builds a cdylib to be used as a native\nagent with the JVM. This agents assumes that `rollbar-java` does NOT exist in your Java project and\ntherefore does some of the work that would otherwise be done by the Java SDK. Again because\n`rollbar-jvm` handles a lot of the heavy lifting of the interaction with the JVM this crate does not\nhave to do that much.\n\nIf you think the naming scheme is terrible I agree with you. Therefore, all of the actual names are\nprobably going to change once all of the parts are fleshed out. That is why nothing has been\npublished to crates.io yet.\n\n### rollbar-wasm\n\nThe subdirectory `crates/wasm` contains a crate which can be built by\n`wasm-pack` and then ran in the browser context. `examples/nextjs` contains an\nexample web application that consumes a package generated from this crate. To\nrun the example, ensure you have a file in the root of this repository named\n`.env` that contains something like:\n\n```\nPOST_TOKEN=\u003cyour post client token\u003e\n```\n\nNext, ensure you have gnu make installed and run `make nextjs-example`.\n\n### rollbar-wasm\n\nThe subdirectory `crates/node` contains a crate which which generates a binary\nlibrary that can be consumed as a native addon for node. The directory also\ncontains a typescript file and a `package.json` that complete an node module\nthat can be consumed by a node application. The `examples/nodejs` directory\ncontain an example of using the library. To run the example, ensure you have a\nfile in the root of this repository named `.env` that contains something like:\n\n```\nPOST_TOKEN=\u003cyour post client token\u003e\n```\n\nNext, ensure you have gnu make installed and run `make nextjs-example`.\n\n## Building\n\n* Install Rust: [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)\n* `cargo build --release`\n* Get what you want from `target/release`:\n  * Agent to help Java SDK: `target/release/librollbar_java_agent.{so,dll,dylib}`\n  * Agent without Java SDK: `target/release/librollbar_jvm_agent.{so,dll,dylib}`\n* There is also a Dockerfile for building Linux releases on the Mac\n\n## Building on a Mac for Linux\n\nIn the particular case where you are using a Mac but want to build a shared library that works on Linux, you have to do a little bit of extra work. Luckily, Rust has a decent cross compilation story. The first step is adding the right target via `rustup`:\n\n* `rustup target add x86_64-unknown-linux-gnu`\n\nThis is not enough because you need a cross compiling toolchain, in particular a linker, that does the right thing. You can get this via:\n\n* `brew tap SergioBenitez/osxct`\n* `brew install x86_64-unknown-linux-gnu`\n  - You might have to run `xcode-select --install` first depending on your setup\n\nOnce that is setup, you can build for the specified target:\n\n* `cargo build --release --target x86_64-unknown-linux-gnu`\n\nYou will find the resulting `.so` located at:\n\n```\ntarget/x86_64-unknown-linux-gnu/release/librollbar_java_agent.so\n```\n\nAlternatively, you can use the `build-lib.sh` script which uses the Dockerfile in the root to build\na `.so` inside a Docker container and then copies it to your file system.\n\n## Debugging\n\nIf you want to see additional output from our agent, you can set the environment variable\n`ROLLBAR_LOG` to one of `trace`, `debug`, `info`, or `warn`. These will output different levels of\ninformation to standard out where your JVM process is running.\n\n## Using the agent\n\nHow to use the agent depends on how you invoke the JVM to start your application. In order\nto use a native agent you need to pass a command line argument to this invocation. The most\nbasic usage would look like:\n\n```\njava -jar foo.jar -agentpath:path/to/librollbar_java_agent.dylib\n```\n\nHowever, if you are using a toolchain, such as Gradle, to manage your application then\nadding this command line argument might take a bit more effort to figure out where to add it. For\nGradle the easiest way is to add the following to your `build.gradle` file:\n\n```\napplicationDefaultJvmArgs = [\"-agentpath:path/to/\"+System.mapLibraryName(\"rollbar_java_agent\")]\n```\n\nRegardless of your JVM language of choice, at some level their is an invocation of the JVM and\ntherefore there is a configuration option to pass arguments directly to the JVM.\n\n## Configuration\n\nThe agent that works with the Rollbar Java SDK does not need any configuration because it relies on\nthe Java SDK to be properly configured and to send items to the API. The other agent does need to be\nconfigured. The agent assumes a file named `rollbar.conf` which lives at the same path as the\ndynamic library. This file should be in TOML format, for example:\n\n```\naccess_token = \"abc123\"\nendpoint = \"https://api.rollbar.com/api/1/item/\"\ntimeout = 10\n```\n\nWe are still working on the configuration, but the only required field is the `access_token`.\n\nInstead of using a file, if the only thing you want to set is the `access_token`, you can also set\nthe `ROLLBAR_TOKEN` environment variable in your process with the value of your access token. If\n`rollbar.conf` is present it will take precedence over the environment variable.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollbar%2Frollbar-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frollbar%2Frollbar-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frollbar%2Frollbar-rust/lists"}