fix(prom): skip cert info for disabled ssl/wss/quic listeners

This commit is contained in:
JimMoen 2024-02-28 15:37:48 +08:00
parent 0e12503a8d
commit 6fd04e33f5
No known key found for this signature in database
1 changed files with 7 additions and 4 deletions

View File

@ -856,10 +856,12 @@ do_points_of_listeners(Type, Listeners) ->
lists:foldl( lists:foldl(
fun(Name, PointsAcc) -> fun(Name, PointsAcc) ->
case case
emqx_utils_maps:deep_get( emqx_utils_maps:deep_get([Name, enable], Listeners, false) andalso
[Name, ssl_options, certfile], Listeners, undefined emqx_utils_maps:deep_get(
) [Name, ssl_options, certfile], Listeners, undefined
)
of of
false -> PointsAcc;
undefined -> PointsAcc; undefined -> PointsAcc;
Path -> [gen_point_cert_expiry_at(Type, Name, Path) | PointsAcc] Path -> [gen_point_cert_expiry_at(Type, Name, Path) | PointsAcc]
end end
@ -894,11 +896,12 @@ cert_expiry_at_from_path(Path0) ->
0 0
end end
catch catch
E:R -> E:R:S ->
?SLOG(error, #{ ?SLOG(error, #{
msg => "obtain_cert_expiry_time_failed", msg => "obtain_cert_expiry_time_failed",
error => E, error => E,
reason => R, reason => R,
stacktrace => S,
path => Path0, path => Path0,
resolved_path => Path resolved_path => Path
}), }),