Browse Source

metric log

ehlxr 1 year ago
parent
commit
c5abb608cc

+ 4 - 4
etl-core/src/main/java/com/tzld/crawler/etl/service/impl/EtlServiceImpl.java

@@ -249,7 +249,7 @@ public class EtlServiceImpl implements EtlService {
         CommonResponse<WxVideoVO> response = longVideoFeign.crawlerVideoSend(request);
         log.info("crawler send video request [{}] response [{}]", request, response);
         if (!response.isSuccess() || response.getData() == null || response.getData().getId() == null) {
-            metric(MetricTypeEnum.VIDEO_SEND_FAILED);
+            metric(MetricTypeEnum.VIDEO_SEND_FAILED, response);
             throw new CommonException(ExceptionEnum.INVOKE_VIDEOAPI_ERROR,
                     "invoke crawler send video failed!" + response);
         }
@@ -342,7 +342,7 @@ public class EtlServiceImpl implements EtlService {
                     }
                 }, videoPath, "synthesis", String.format("video [%s] audio [%s] synthesis", videoPath, audioPath));
             } catch (Exception e) {
-                metric(MetricTypeEnum.VIDEO_SYNTHESIS_FAILED);
+                metric(MetricTypeEnum.VIDEO_SYNTHESIS_FAILED, CommonUtils.getRootCause(e).getMessage());
                 throw new CommonException(e);
             }
 
@@ -404,7 +404,7 @@ public class EtlServiceImpl implements EtlService {
                 } catch (CommonException e) {
                     if (e.getCode() == ExceptionEnum.URL_FORBIDDEN.getCode()) {
                         log.error("access to the url [{}] of remote server is prohibited.", fileUrl);
-                        metric(MetricTypeEnum.INVALID_URL);
+                        metric(MetricTypeEnum.INVALID_URL, fileUrl);
                         return false;
                     }
                     throw new RuntimeException(e);
@@ -413,7 +413,7 @@ public class EtlServiceImpl implements EtlService {
                 }
             }, localFilePath, "download", String.format("download file from [%s] to [%s]", fileUrl, filePath));
         } catch (Exception e) {
-            metric(MetricTypeEnum.DOWNLOAD_FAILED);
+            metric(MetricTypeEnum.DOWNLOAD_FAILED, fileUrl);
             throw new CommonException(e);
         }