favetelinguis
I have what I thinks is a standar layout of a Phoenix project, in my lib folder I have two projects app_core and app_interface. In app_interface I have the dependency to phoenix and following this post I also have the dependency to
{:prometheus_ex, "~> 1.0"},
{:prometheus_plugs, "~> 1.0"}
Given this setup my Phoenix project will expose an metrics endpoint.
Now the problem I have is that I want to instrument the app_core project and have those metrics made available on the metrics endpoint in the app_interface project.
Is this even possible or how are you guys using metrics with the business logic side of a Phoneix project???
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Tuxified
Prometheus is an external tool, so you send events/metrics to prometheus. You can send metrics from different apps/projects, your metrics endpoint could retrieve data from prometheus to show it to a user? I think prometheus already has a UI/works with grafana so it might be better to just use those?
Phillipp
I am using the prometheus package without a phoenix installation.
The package lets you define, set, update and delete metrics.
It’s useful to look at the docs for the specific metrics types to see how you can use them. E.g. prometheus.ex/lib/prometheus/metric/gauge.ex at master · prometheus-erl/prometheus.ex · GitHub
favetelinguis
Not sure we have the same view of Prometheus, you dont send data. Prometheus is polling the metrics endpoint wich contains data from instrumented parts of your app.
Tuxified
Maybe I don’t understand correctly how Prometheus works, but I got from this overview you can send your metrics to a push gateway from which prometheus will pull info? If so, that might make it easier to use? Otherwise you’d have to gather the metrics yourself, store/remember them before prometheus pull that info from your metrics endpoint?
Phillipp
That is only meant for things like queue workers where you want to send metrics of individual jobs.
That is what the
prometheus_exlib does.Tuxified
I came across a project that might function as an example: GitHub - oestrich/ex_venture: Text based MMORPG engine written in Elixir · GitHub → Exventure - . Hope that helps
favetelinguis
Ok interesting, my understanding was that prometheus.ex is only used for instrumenting your code, it does not provide an exporter, that is the metrics endpoint will not be provided by it. For that you have to use som other package that provides the endpoint?
Do you have any github projects where you have this setup?
Phillipp
The package provides everything you need.
So, given you use it in your code to declare and update metrics like this:
(I use
registry: :allhere because I don’t need the system metrics that are added by default byprometheus_ex)You just need plug, or anything else that serves your metrics endpoint. The prometheus package gives you the metrics in the correct form. My code is simply this in a normal plug router.
(Here I pass it the
:allargument because I pushed my metrics to the:allregistry)favetelinguis
So lets say in my lib folder I have 5 projects that all depend on each other, would I need to provide 5 /metrics endpoints on 5 web servers on 5 different ports or could I use one metrics endpoints for all 5 projects? This is sort of my original question.
Phillipp
Do you mean 5 apps in an umbrella setup?
If you don’t have an umbrella setup and just one elixir app, there is nothing special to do.
If you have an umbrella setup with different apps, I would suggest that you create another app just for the metrics. That metrics app has the dependency to
prometheus_exand exposes functions for your other apps to add and update their metrics. That way, your other apps can have the metrics app as dependency and push their metrics to it. That metrics app also exposesPrometheus.Format.Text.formatwhich is important for your web facing app to get the metrics for the endpoint. The point is that you have a central place for the metrics so you don’t end up having one metrics list per app which is not very practical in most cases.