Description
PryIn is Application Performance Monitoring made for Elixir and Phoenix.
It has a native Elixir client, automatically instruments your controllers and channels and can be extended with custom traces for background jobs, gen servers and mostly everything else. It also analyzes BEAM resource consumption and helps you find problems there.
PryIn alternatives and similar packages
Based on the "Benchmarking" category.
Alternatively, view PryIn alternatives based on common mentions on social networks and blogs.
CodeRabbit: AI Code Reviews for Developers
Do you think we are missing an alternative of PryIn or a related project?
Popular Comparisons
README
PryIn
PryIn is a performance metrics platform for your Phoenix application.
Installation
- Sign up for a PryIn account and create a new project there.
- Add
pryin
to your dependencies inmix.exs
:
def deps do
[
{:pryin, "~> 1.0"}
]
end
If you define an applications list in your
mix.exs
, add:pryin
there, too:def applications do [..., :pryin] end
Add general configuration for the pryin app in
config/config.exs
:
config :pryin,
otp_app: :my_app,
api_key: "your_secret_api_key",
enabled: false,
env: :dev
config :my_app, MyApp.Repo,
loggers: [PryIn.EctoLogger, Ecto.LogEntry]
config :my_app, MyApp.Endpoint,
instrumenters: [PryIn.Instrumenter]
- Enable PryIn in the environments you want to collect metrics for.
If you want to collect data for the production environment, for example,
add the following to
config/prod.exs
:
config :pryin,
enabled: true,
env: :prod
Possible values for env
are :dev
, :staging
or :prod
.
- Add the PryIn plug to your application's endpoint (
lib/my_app/endpoint.ex
) just before the router plug:
...
plug PryIn.Plug
plug MyApp.Router
- To collect data about Ecto queries, view renderings or custom instrumentation in your channel joins,
you need to join the transport's trace first:
elixir def join("rooms:lobby", message, socket) do PryIn.join_trace(socket.transport_pid, self()) Repo.all(...) ...
This is only neccessary in your channel join functions, because the channel process does not exist yet when tracing starts.
Configuration
Above steps will give you a basic installation with standard configuration. If you want to tweak some settings, here are all the possible configuration options:
key | default | description |
---|---|---|
:otp_app |
- | The name of your application. Mainly used to get your application's version. |
:api_key |
- | Your project's api key. You can find this on PryIn under "Settings". |
:enabled |
- | Whether to forward data to PryIn. Should be set to true in all enviroments you want to collect data in. |
:env |
- | Name of the current environment. Can be one of :dev , :staging or :prod . |
:forward_interval |
1000 | Duration of forward intervals in milliseconds. During the interval, data is collected and stored locally. At the end of the interval, the data is then forwared to PryIn. |
:max_interactions_for_interval |
100 | Maximum number of traces stored locally during each forward interval. If this limit is reached, new traces will be dropped until data is sent to PryIn and the store is cleared. |
:max_tracked_metric_values_for_interval |
100 | Maximum number of Tracked Metric values stored locally during each forward interval. If this limit is reached, new values will be dropped until data is sent to PryIn and the store is cleared. |
:node_name |
node() |
Name of the current node. BEAM metrics will be grouped under this value. |
Further reading
You can find more details (about background jobs, custom instrumentation, and a lot more), in PryIn's FAQs.