chore: compile error

This commit is contained in:
zhongwencool 2024-07-17 16:18:53 +08:00
parent 2a58a36e37
commit e74a921d33
1 changed files with 27 additions and 19 deletions

View File

@ -17,6 +17,7 @@
-module(emqx_resource_metrics). -module(emqx_resource_metrics).
-include_lib("emqx/include/logger.hrl"). -include_lib("emqx/include/logger.hrl").
-include("emqx_resource.hrl").
-export([ -export([
events/0, events/0,
@ -74,7 +75,6 @@
success_get/1 success_get/1
]). ]).
-define(RES_METRICS, resource_metrics).
-define(TELEMETRY_PREFIX, emqx, resource). -define(TELEMETRY_PREFIX, emqx, resource).
-spec events() -> [telemetry:event_name()]. -spec events() -> [telemetry:event_name()].
@ -127,7 +127,9 @@ handle_telemetry_event(
%% We catch errors to avoid detaching the telemetry handler function. %% We catch errors to avoid detaching the telemetry handler function.
%% When restarting a resource while it's under load, there might be transient %% When restarting a resource while it's under load, there might be transient
%% failures while the metrics are not yet created. %% failures while the metrics are not yet created.
?SLOG(warning, #{ ?SLOG(
warning,
#{
msg => "handle_resource_metrics_failed", msg => "handle_resource_metrics_failed",
hint => "transient failures may occur when restarting a resource", hint => "transient failures may occur when restarting a resource",
kind => Kind, kind => Kind,
@ -135,7 +137,9 @@ handle_telemetry_event(
stacktrace => Stacktrace, stacktrace => Stacktrace,
resource_id => ID, resource_id => ID,
event => Event event => Event
}), },
#{tag => ?TAG}
),
ok ok
end; end;
handle_telemetry_event( handle_telemetry_event(
@ -151,7 +155,9 @@ handle_telemetry_event(
%% We catch errors to avoid detaching the telemetry handler function. %% We catch errors to avoid detaching the telemetry handler function.
%% When restarting a resource while it's under load, there might be transient %% When restarting a resource while it's under load, there might be transient
%% failures while the metrics are not yet created. %% failures while the metrics are not yet created.
?SLOG(warning, #{ ?SLOG(
warning,
#{
msg => "handle_resource_metrics_failed", msg => "handle_resource_metrics_failed",
hint => "transient failures may occur when restarting a resource", hint => "transient failures may occur when restarting a resource",
kind => Kind, kind => Kind,
@ -159,7 +165,9 @@ handle_telemetry_event(
stacktrace => Stacktrace, stacktrace => Stacktrace,
resource_id => ID, resource_id => ID,
event => Event event => Event
}), },
#{tag => ?TAG}
),
ok ok
end; end;
handle_telemetry_event(_EventName, _Measurements, _Metadata, _HandlerConfig) -> handle_telemetry_event(_EventName, _Measurements, _Metadata, _HandlerConfig) ->