Azure Monitor/body close logs an error bug (#74632)

on body close causes logs an error even if no error. also changed to warning similar to the rest of grafana
This commit is contained in:
Andrew Hackmann
2023-09-11 09:02:44 -05:00
committed by GitHub
parent a90e3f67e4
commit c8a0ebe0e8
4 changed files with 22 additions and 15 deletions
+3 -2
View File
@@ -393,8 +393,9 @@ func parseSubscriptions(res *http.Response) ([]string, error) {
return nil, err
}
defer func() {
err := res.Body.Close()
backend.Logger.Error("Failed to close response body", "err", err)
if err := res.Body.Close(); err != nil {
backend.Logger.Warn("Failed to close response body", "err", err)
}
}()
result := make([]string, len(target.Value))