The Crystal Programming Language Forum

Newrelic agent

ive written al the bridging so we can instruction crystal apps to report fro newrelic insights. the one thing however it requires i was wondering if someone with som go expericne would like to tackle, converting the go collector daemon to crystal so it can be intergrated with agent api so provide a full rpm stack for crystal

Hi!

A couple of things:

  • I recently wrote bindings to the newrelic C SDK in Haskell. I can’t show source code yet but it’ll eventually be open-sourced.
  • I think for reporting to newrelic it would be enough to bind to the C SDK and use that.
  • You can use the newrelic daemon that gets built when you run make on the C SDK. What’s the “go collector deamon” you mention? It would be great if you could include some links.
1 Like

I did some PoC around GC/Fibers stats for profiling programs and specs and output to a Prometheus text file .prom every a fixed amount of time in https://github.com/bcardiff/crystal/commits/feature/profiling . Some of the changes are already in master: mainly the one that allows you to do GC.prof_stats.

It is not actually a daemon but it can be helpfull.

the c dsk requires a daemon written in go to collect the api call output (it sends over a socket), gather and uploads to newrelic. it comes with the c sdk as a vendor directory. it would be nicer if the daemon it runs as an external process could be transformed into a fiber that runs in app.

Oooh… I didn’t know the deamon was written in Go.

I’m not sure porting the collector to Crystal is a good idea. If the newrelic teams modifies it or adds more features they’ll need to be continuously ported. The same could be said about the C SDK: just rewrite it in Crystal, after all I think they are just doing some socket communication. But maybe it’s simpler to just use the C SDK and the provided Go daemon.

Do you know if the daemon was ported to any other language? (maybe Ruby…)

they do, i wrapped the c sdk bindings, but i wanted to self include the daemon into my app so i didnt have yet another process to manage in my env, and yes agent does exist in other langs, i havent dug yet into the ruby agent to see what it sends