deadtrickster / prometheus_rabbitmq_exporter

Prometheus.io exporter as a RabbitMQ Managment Plugin plugin
MIT License
291 stars 72 forks source link

add metric rabbitmq_exchange_messages_deliver_get_total #9

Closed tbcs closed 8 years ago

tbcs commented 8 years ago

Sum of messages_delivered_total, messages_delivered_no_ack_total, messages_get_total and messages_get_no_ack_total. Same as rabbitmq_queue_messages_deliver_get_total, except per exchange.

tbcs commented 8 years ago

I should point out that I was unable to test this change because of the build process. When I invoked "make" I was asked for github credentials. I didn't know what this is required for, so I aborted the build at that point.

deadtrickster commented 8 years ago

Hey, thank you, I'll build this later today or tomorrow morning.

When I invoked "make" I was asked for github credentials.

That's interesting... What repository it tried to clone? I just can't find what's wrong with my Makefile and I'm sure it doesn't ask me for Github credentials 😕

tbcs commented 8 years ago

I just tried again, just to make sure. This time I used a pristine user account, no git config and no relevant environment variables set. The effect is still the same:

# git clone https://github.com/deadtrickster/prometheus_rabbitmq_exporter.git
Cloning into 'prometheus_rabbitmq_exporter'...
remote: Counting objects: 333, done.
remote: Total 333 (delta 0), reused 0 (delta 0), pack-reused 333
Receiving objects: 100% (333/333), 472.01 KiB | 796.00 KiB/s, done.
Resolving deltas: 100% (211/211), done.
Checking connectivity... done.
# cd prometheus_rabbitmq_exporter/
# git checkout rabbitmq_v3_6_5
Branch rabbitmq_v3_6_5 set up to track remote branch rabbitmq_v3_6_5 from origin.
Switched to a new branch 'rabbitmq_v3_6_5'
# make
 DEP    rabbit_common
Username for 'https://github.com': 

Here's the pstree output of the relevant process:

make
  └─sh -c echo " DEP   " rabbit_common; \011fetch_url1='https://github.com/deadtrickster/rabbit_common.git'; fetch_url2='https://github.com/rabbitmq/rabbitmq-common.git'; if test "$fetch_url1" != 'https://github.com/deadtrickster/prometheus_rabbitmq_exporter.git' && git clone -q -n -- "$fetch_url1" /root/prometheus_rabbitmq_exporter/deps/rabbit_common; then fetch_url="$fetch_url1"; push_url='https://github.com/deadtrickster/rabbit_common.git'; elif git clone -q -n -- "$fetch_url2" /root/prometheus_rabbitmq_exporter/deps/rabbit_common; then fetch_url="$fetch_url2"; push_url='git@github.com:rabbitmq/rabbitmq-common.git'; fi; cd /root/prometheus_rabbitmq_exporter/deps/rabbit_common && (  git checkout -q rabbitmq_v3_6_5 >/dev/null 2>&1 ||   git checkout -q master >/dev/null 2>&1 ||   git checkout -q master >/dev/null 2>&1 ||  (echo "error: no valid pathspec among:  rabbitmq_v3_6_5 master master" 1>&2 && false) ) && (test "$fetch_url" = "$push_url" || git remote set-url --push origin "$push_url")
      └─git clone -q -n -- https://github.com/deadtrickster/rabbit_common.git /root/prometheus_rabbitmq_exporter/deps/rabbit_common
          └─git-remote-http origin https://github.com/deadtrickster/rabbit_common.git
deadtrickster commented 8 years ago

Looks like it first tries to clone rabbit_common from my account (ughh) which confuses github

 DEP    rabbit_common
Username for 'https://github.com': deadtrickster
Password for 'https://deadtrickster@github.com': 
remote: Repository not found.
fatal: repository 'https://github.com/deadtrickster/rabbit_common.git/' not found

RabbitMQ make files is just a disaster...

This worked out for me:

tbcs commented 8 years ago

The build progresses further with make run-broker. The last few lines of output were:

[...]
 ERLC   prometheus_mnesia_collector.erl prometheus_vm_memory_collector.erl prometheus_vm_statistics_collector.erl prometheus_vm_system_info_collector.erl prometheus_http.erl prometheus_mnesia.erl prometheus_test_instrumenter.erl prometheus_protobuf_format.erl prometheus_text_format.erl prometheus_counter.erl prometheus_gauge.erl prometheus_histogram.erl prometheus_summary.erl prometheus_model.erl prometheus_model_helpers.erl prometheus.erl prometheus_buckets.erl prometheus_collector.erl prometheus_format.erl prometheus_instrumenter.erl prometheus_metric.erl prometheus_metric_spec.erl prometheus_misc.erl prometheus_registry.erl prometheus_sup.erl prometheus_time.erl
src/model/prometheus_model.erl:2002: attribute 'dialyzer' after function definitions
src/model/prometheus_model.erl:2016: attribute 'dialyzer' after function definitions
[...]
src/model/prometheus_model.erl:2218: attribute 'dialyzer' after function definitions
src/model/prometheus_model.erl:2227: attribute 'dialyzer' after function definitions
../../erlang.mk:4953: recipe for target 'ebin/prometheus.app' failed
make[2]: *** [ebin/prometheus.app] Error 1
../../erlang.mk:4761: recipe for target 'app' failed
make[1]: *** [app] Error 2
make[1]: Leaving directory '/home/guest/src/prometheus_rabbitmq_exporter/deps/prometheus'
erlang.mk:4090: recipe for target 'deps' failed
make: *** [deps] Error 2

It still fails, but this might just be due to an incompatibility with the version of Erlang I tried to build with (this issue looks similar). I'm using version 17.3 as shipped with Debian Jessie (package version 1:17.3-dfsg-4).

deadtrickster commented 8 years ago

I'm using OTP 19, this should work on OTP 18. 17.3 is a little bit old :-)

tbcs commented 8 years ago

I'll make sure to use a recent Erlang distribution in case I have something significant to contribute.

deadtrickster commented 8 years ago

Merged, thanks!

deadtrickster commented 8 years ago

https://github.com/deadtrickster/prometheus_rabbitmq_exporter/releases/tag/rabbitmq-3.6.5.6