deadtrickster / prometheus.ex

Prometheus.io Elixir client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid value "unknown" for "erlang_vm_logical_processors_available"

geowa4 opened this issue · comments

When I go to /metrics in my Pheonix app, I get a response containing the following snippet.

# TYPE erlang_vm_logical_processors_available gauge
# HELP erlang_vm_logical_processors_available The detected number of logical processors available to the Erlang runtime system
erlang_vm_logical_processors_available unknown

Prometheus is unable to parse unknown and yields this error message: text format parsing error in line 9: expected float as value, got "unknown". From what I hear, the correct value in this case should be NaN.

Edit: I am using version 1.0.0-alpha9.

Hi George!

Sorry for the inconvenience. It's already fixed in the prometheus.erl master and stable versions of prometheus.ex and prometheus.erl and other libs are almost there! In the meantime you can override prometheus.erl like this:

{:prometheus, git: "https://github.com/deadtrickster/prometheus.erl.git", override: true}

Please let me know if that works for you!

Also I have a little questionnaire if you don't mind :-)

  1. What time units do you use?
  2. What other Prometheus stuff do you use (like prometheus plugs, process_info_collector)?
  3. Do you think default time units should be seconds everywhere?

Thank you. I appreciate your help.

I tested changing to the Git version out in my test app (based off the HelloPhoenix tutorial) and got this when starting.

** (Mix) Could not start application hello_phoenix: exited in: HelloPhoenix.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (ArgumentError) argument error
            (stdlib) :ets.insert(:prometheus_registry_table, {:default, :prometheus_counter})
            (prometheus) src/prometheus_registry.erl:79: :prometheus_registry.register_collector/2
            (prometheus) src/prometheus_metric.erl:101: :prometheus_metric.insert_mf/3
            (hello_phoenix) lib/hello_phoenix/plug_pipeline_instrumenter.ex:4: HelloPhoenix.Plug.PipelineInstrumenter.setup/0
            (hello_phoenix) lib/hello_phoenix.ex:14: HelloPhoenix.start/2
            (kernel) application_master.erl:273: :application_master.start_it_old/4

My dependencies are the following (which may answer question 2).

$ mix deps.update --all
* Updating prometheus (https://github.com/deadtrickster/prometheus.erl.git)
Running dependency resolution
Dependency resolution completed
  absinthe: 1.1.10
  absinthe_plug: 1.1.3
  bunt: 0.1.6
  connection: 1.0.4
  cowboy: 1.0.4
  cowlib: 1.0.2
  credo: 0.4.11
  db_connection: 1.0.0-rc.5
  decimal: 1.1.2
  ecto: 2.0.5
  fs: 0.9.2
  gettext: 0.11.0
  mime: 1.0.1
  phoenix: 1.2.1
  phoenix_ecto: 3.0.1
  phoenix_html: 2.6.2
  phoenix_live_reload: 1.0.5
  phoenix_pubsub: 1.0.0
  plug: 1.2.0
  plug_logger_json: 0.1.1
  poison: 2.2.0
  poolboy: 1.5.1
  postgrex: 0.12.0
  prometheus_ecto: 1.0.0-alpha9
  prometheus_ex: 1.0.0-alpha9
  prometheus_phoenix: 1.0.0-alpha9
  prometheus_plugs: 1.0.0-alpha9
  ranch: 1.2.1

As for questions 1 & 3, I'm fine with microseconds, but I feel like milliseconds is more common. In general, I think choosing units is like choosing a style guide. In the end, I only care that it exists, is consistent, and is not crazy. Crazy in this case would be something like picoseconds.

I think you have to start :prometheus app manually (i.e. explicitly add to apps list) because of override.

Prometheus 3 has completely new timing system, it always works with native units and now it can work with seconds as per prometheus guides. I'm thinking about moving to seconds as default time unit in plugs/ecto/phoenix instrumenters.

This is my mix.exs:

  def application do
    [mod: {HelloPhoenix, []},
     applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy,
                    :plug_logger_json, :logger,
                    :gettext, :absinthe_plug,
                    :prometheus, :prometheus_ex,
                    :prometheus_phoenix, :prometheus_ecto,
                    :phoenix_ecto, :postgrex]]
  end

I'm fine with seconds. I don't think it would impact me much either way. This app I'm working on is the only one I have instrumented with Prometheus so I wouldn't have to think too hard.

TL;DR update all your elixir deps to 1.0.0-rc1 and remove prometheus.erl override.

Details:

  • looks like mix can't properly work with erlang deps pulled directly from git. ETS tables created at prometheus app startup. Looks like something strange is going on here;
  • hex.pm can't properly sort deps:
3.0.0-alpha2 August 31, 2016
3.0.0-alpha10 September 18, 2016
3.0.0-alpha1 August 27, 2016

I'll create issues for these tomorrow.

I ran test for all prometheus elixir libs, they all pass. Please do let me know if the problem persists!

Perfect! Everything is working well. Thanks for helping me with this.