Giter Site home page Giter Site logo

Comments (2)

unflxw avatar unflxw commented on June 13, 2024

Hi @thbar! TL;DR: It is safe to call add_distribution_value (or interface with AppSignal in other ways) from within a Telemetry handler. All operations involving the NIF are non-blocking.

  1. Are these add_distribution_value calls synchronous?

Yes, they're "synchronous", in that they synchronously communicate with the AppSignal extension via the NIF. But they're not "synchronous" in that they'd block until the value is sent to AppSignal, or anything like that. Communicating through the NIF takes a very short time. This is to say, this should not be a problem -- the value is merely queued in the extension, which will send it to AppSignal asynchronously.

(Our own instrumentations interface with the NIF from within Telemetry handlers -- see Ecto for example)

  1. Could they raise errors?

In practice, no. They could raise an error if they're not being invoked correctly -- say, if you were to pass a string as the distribution value instead of a double. As long as the right number of arguments are passed with the right types, no error will be raised.

While the integration's NIF interfaces with the AppSignal agent, which is not open source, the NIF bridge itself is publicly available, and you can take a look at the implementation for add_distribution_value.

That said, if an error was somehow raised, the consequence would be that Telemetry would detach the event handler that raised an error. This error would be logged, and your application would no longer emit this metric to AppSignal, but your application would not crash because of it.

from appsignal-elixir.

thbar avatar thbar commented on June 13, 2024

Hi @unflxw! Thanks for the timely & thoughtful answer!

Yes, they're "synchronous", in that they synchronously communicate with the AppSignal extension via the NIF. But they're not "synchronous" in that they'd block until the value is sent to AppSignal, or anything like that.

This is what I hoped for, given the type of software 😄 thanks for the confirmation!

They could raise an error if they're not being invoked correctly -- say, if you were to pass a string as the distribution value instead of a double

Ok! I looked at the code before and indeed was wondering what would happen inside the NIF, would it block or not etc.

Many thanks, this is perfect and I can move forward with our implementation. Thank you!

from appsignal-elixir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.