Comments (2)
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.
- 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)
- 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.
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)
- Drop support for unmaintained Elixir/Erlang versions
- Provide logging feature through a logger handler HOT 1
- Collect Ecto stacktraces HOT 9
- Neon startup causes errors to be sent to AppSignal HOT 2
- (Mox) testing guidelines? HOT 3
- Oban "Insert job" should not be a root span HOT 1
- AppSignal causes Phoenix to seg fault when a request is received on MacOS 13.6 HOT 12
- Expose a way to clone the Tracer stack for a process HOT 2
- Allow for additional context to be added to Tesla calls
- Memory leak when running long, work intensive Oban background job HOT 10
- Jobs cancelled via Oban Web are not properly closed
- `Logger.error` does not log AppSignal Error HOT 2
- Clickable stack traces to directly jump into the source HOT 1
- Allow setting per-process metadata to unhandled exceptions HOT 3
- Consider sharing exception "blame" information to aid debugging HOT 1
- Alpine aarch64-unknown-linux-musl unknown architecture HOT 2
- Elixir parameter filtering does not match Phoenix's behavior
- Include last message from genserver shut down HOT 1
- LiveComponents shown in "background" namespace HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from appsignal-elixir.