newrelic
Version, currently master branch1 version
- master branchlatestJul 20, 2019
github.com/romul/newrelic.cr
NewRelic support for Crystal
Installation
# Add this to your shard.yml
dependencies:
newrelic:
github: romul/newrelic.cr
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.29.0- License
- MIT
- Author
- Roman Smirnov
Dependencies
This version declares no dependencies.
README
NewRelic support for Crystal
This is a binding to the New Relic C SDK, that allow to take advantage of New Relic's monitoring capabilities and features to instrument in programs written in Crystal.
The binding itself is fully featured and could be found in LibNewRelic. Also provided some wrappers and macros to simplify basic use cases. See below
Installation
-
Add the dependency to your
shard.yml:dependencies: newrelic: github: romul/newrelic.cr -
Run
shards install -
Copy
libnewrelic.ato/usr/local/lib
cp lib/newrelic/bin/libnewrelic.a /usr/local/lib/libnewrelic.a
- Copy
newrelic-daemonwherever you would like
cp lib/newrelic/bin/newrelic-daemon newrelic-daemon
Note: Copies of libnewrelic.a & newrelic-daemon are built for Linux x86_64 for 1.1.0 version of C-SDK, if you would like another target platform or version, please follow build instructions from C-SDK
- export NEWRELIC_LICENSE_KEY="your license key"
Usage
require "newrelic"
# these 2 lines are required to call only once (when program starts)
NewRelic::Agent.configure_log("newrelic.log") # optional
NewRelic::Agent.start("Your App Name")
NewRelic.web_transaction("transaction_name") do
# some code
NewRelic.segment("segment_name", "Category") do
# some other code
end
end
Note: Don't forget to run newrelic-daemon on the same machine. Your application, which makes API calls, reports data to the daemon over a socket; in turn, the daemon reports the data to New Relic.
For debug purposes you can start the daemon in the foreground with:
./newrelic-daemon -f --logfile stdout --loglevel debug
Contributing
- Fork it (https://github.com/romul/newrelic.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Roman Smirnov - creator and maintainer
Sponsored by Markeaze
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Jul 20, 2019
- Crystal
0.29.0- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/romul/newrelic.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 15, 2026
- Synced
- Aug 15, 2026
- Versions
- 1