newrelic-unofficial

Crates.ionewrelic-unofficial
lib.rsnewrelic-unofficial
version0.1.3
sourcesrc
created_at2020-08-08 09:53:43.936706
updated_at2020-08-16 02:07:39.10161
descriptionNew Relic instrumentation in pure Rust
homepage
repositoryhttps://github.com/qnighy/newrelic-unofficial-rust
max_upload_size
id274327
size123,644
Masaki Hara (qnighy)

documentation

README

newrelic-unofficial-rust

It's an unofficial port of the New Relic Go agent to Rust.

Unlike the one based on the C sdk, it is completely thread-safe and works alone.

Status

  • Web transactions
  • Non-web transactions
  • Tracking threads in transactions
  • Segments
  • Error reporting
  • Transaction sampling
  • Apdex

The library reports itself as Go because the New Relic server (of course) doesn't have a support for Rust.

Usage

Application setup:

// Set up NewRelic in-process daemon (newrelic_unofficial::Daemon).
// Generate Daemon at application startup and keep it until application shutdown.
let license = std::env::var("NEW_RELIC_LICENSE_KEY").unwrap();
let daemon = Daemon::new("rust-test", &license).unwrap();

// Get application handle (newrelic_unofficial::Application) from the daemon.
// Pass it around to record application events.
let app = daemon.application().clone();

Transaction:

// Start a new (non-web) transaction.
// The end of the transaction is automatically recorded on drop.
let txn = app.start_transaction("SomeBackgroundJob");

// Or you can start a web transaction.
let txn = app.start_web_transaction("/upload", http_request);

Segment: not yet implemented

License

I consider it a port of the New Relic Go agent, therefore (perhaps) inheriting copyrights from the original source code.

  • Copyright 2020 New Relic Corporation. (for the original go-agent)
  • Copyright 2020 Masaki Hara.

Licensed under Apache-2.0

Commit count: 109

cargo fmt