sashman

sashman

Using TelemetryMetricsPrometheus and Plugs Instrumenter/Exporter

I am very much enjoying using GitHub - prometheus-erl/prometheus-plugs: Prometheus.erl Elixir Plugs · GitHub for all the conveniences out of the box, however, I would like to start adding my own telemetry events to be exposed via Prometheus too. Seems like TelemetryMetricsPrometheus — telemetry_metrics_prometheus v1.1.0 specifically TelemetryMetricsPrometheus.Core is the way to go. However, I’m not sure if it’s possible to make both of these interoperate. My ideal solution would be to define a list of telemetry events like so:

defp metrics, do:
  [
    counter("http.request.count"),
    sum("http.request.payload_size", unit: :byte),
    last_value("vm.memory.total", unit: :byte)
  ]

and have the appear along side the metrics already gathered by prometheus_plugs and prometheus_phoenix

Most Liked

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

I may be biased here given I am the author of PromEx…but it sounds like it fits your current needs. PromEx is built on top of Telemetry and TelemetryMetricsPrometheus and collections of metrics are grouped into plugins (Oban plugin, BEAM plugin, LiveView plugin, etc). This also allows you to create your own plugins and have PromEx expose those on your /metrics endpoint. As an added bonus, PromEx can also take care of uploading your dashboards for you to Grafana as it can interface with the Grafana HTTP API. Give it a try and let me know what you think :slight_smile:.

sashman

sashman

For those coming across this, I’m currently using a workaround by service metrics on two endpoints:

This is plugged into k8s service monitors on our end so solves the issue for the time being.

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
earth10
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone. What strikes me is th...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New

We're in Beta

About us Mission Statement