Skip to content

Commit

Permalink
Start experimenting with OpenTelemetry
Browse files Browse the repository at this point in the history
This is meant to address
#2783, which began as
#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
#2785

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
  • Loading branch information
gerhard committed Feb 12, 2021
1 parent 6adb244 commit 4052ebe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deps/rabbit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,16 @@ 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

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))))
Expand Down
3 changes: 3 additions & 0 deletions deps/rabbit/src/rabbit_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit 4052ebe

Please sign in to comment.