summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Lazu <gerhard@lazu.co.uk>2021-02-12 11:43:52 +0000
committerGerhard Lazu <gerhard@lazu.co.uk>2021-02-12 11:43:52 +0000
commit4052ebe80ec6d78d332b7464747ea4549c2d2300 (patch)
tree0089449c5bbc17f6baa3588595323cc6a1759a05
parent6adb2449b4ec7f68763560c34cb10e2bd0bbb6e5 (diff)
downloadrabbitmq-server-git-otel.tar.gz
Start experimenting with OpenTelemetryotel
This is meant to address https://github.com/rabbitmq/rabbitmq-server/issues/2783, which began as https://github.com/rabbitmq/rabbitmq-server/discussions/2781 This is just an experiment, don't get too excited. The first impression is that the OpenTelemetry API is really hard to work with, and the concepts involved don't make a lot of sense. We (+@mkuratczyk) will continue as soon as we have dealt with https://github.com/rabbitmq/rabbitmq-server/discussions/2785 Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
-rw-r--r--deps/rabbit/Makefile4
-rw-r--r--deps/rabbit/src/rabbit_channel.erl3
2 files changed, 6 insertions, 1 deletions
diff --git a/deps/rabbit/Makefile b/deps/rabbit/Makefile
index 1148265d7b..3f8acbb643 100644
--- a/deps/rabbit/Makefile
+++ b/deps/rabbit/Makefile
@@ -132,7 +132,7 @@ APPS_DIR := $(CURDIR)/apps
LOCAL_DEPS = sasl rabbitmq_prelaunch os_mon inets compiler public_key crypto ssl syntax_tools xmerl
BUILD_DEPS = rabbitmq_cli syslog
-DEPS = cuttlefish ranch lager rabbit_common ra sysmon_handler stdout_formatter recon observer_cli osiris amqp10_common
+DEPS = cuttlefish ranch lager rabbit_common ra sysmon_handler stdout_formatter recon observer_cli osiris amqp10_common opentelemetry_api opentelemetry
TEST_DEPS = rabbitmq_ct_helpers rabbitmq_ct_client_helpers amqp_client meck proper
PLT_APPS += mnesia
@@ -140,6 +140,8 @@ PLT_APPS += mnesia
dep_cuttlefish = hex 2.4.1
dep_syslog = git https://github.com/schlagert/syslog 3.4.5
dep_osiris = git https://github.com/rabbitmq/osiris master
+dep_opentelemetry_api = hex 0.5.0
+dep_opentelemetry = hex 0.5.0
define usage_xml_to_erl
$(subst __,_,$(patsubst $(DOCS_DIR)/rabbitmq%.1.xml, src/rabbit_%_usage.erl, $(subst -,_,$(1))))
diff --git a/deps/rabbit/src/rabbit_channel.erl b/deps/rabbit/src/rabbit_channel.erl
index 4d1be7d2d3..803dff50f9 100644
--- a/deps/rabbit/src/rabbit_channel.erl
+++ b/deps/rabbit/src/rabbit_channel.erl
@@ -45,6 +45,7 @@
-include_lib("rabbit_common/include/rabbit_misc.hrl").
-include("amqqueue.hrl").
+-include_lib("opentelemetry_api/include/otel_meter.hrl").
-behaviour(gen_server2).
@@ -215,6 +216,8 @@
-define(INCR_STATS(Type, Key, Inc, Measure),
begin
rabbit_core_metrics:channel_stats(Type, Measure, {self(), Key}, Inc),
+ % rabbit_log:warning("NOT FINE~nType: ~p~nMeasure: ~p~nSelf: ~p~nKey: ~p~nInc: ~p~n", [Type, Measure, self(), Key, Inc]),
+ ?otel_counter_add(lists:concat([Type, "_", Measure, "_total"]), Inc),
%% Keys in the process dictionary are used to clean up the core metrics
put({Type, Key}, none)
end).