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,15 +127,19 @@ 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(
msg => "handle_resource_metrics_failed", warning,
hint => "transient failures may occur when restarting a resource", #{
kind => Kind, msg => "handle_resource_metrics_failed",
reason => Reason, hint => "transient failures may occur when restarting a resource",
stacktrace => Stacktrace, kind => Kind,
resource_id => ID, reason => Reason,
event => Event stacktrace => Stacktrace,
}), resource_id => ID,
event => Event
},
#{tag => ?TAG}
),
ok ok
end; end;
handle_telemetry_event( handle_telemetry_event(
@ -151,15 +155,19 @@ 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(
msg => "handle_resource_metrics_failed", warning,
hint => "transient failures may occur when restarting a resource", #{
kind => Kind, msg => "handle_resource_metrics_failed",
reason => Reason, hint => "transient failures may occur when restarting a resource",
stacktrace => Stacktrace, kind => Kind,
resource_id => ID, reason => Reason,
event => Event stacktrace => Stacktrace,
}), resource_id => ID,
event => Event
},
#{tag => ?TAG}
),
ok ok
end; end;
handle_telemetry_event(_EventName, _Measurements, _Metadata, _HandlerConfig) -> handle_telemetry_event(_EventName, _Measurements, _Metadata, _HandlerConfig) ->