Added some logging in the ingestion request method of Vulnerability Consumer.
@@ -447,20 +447,26 @@ public class MetadataUtility {
* @param pkgCoord - String
*/
public void sendIngestRequest(String pkgCoord) {
- try {
var apiUrl = System.getenv(fastenApiUrlEnvVariable);
if(Objects.isNull(apiUrl)) {
apiUrl = fastenApiUrlDefault;
}
+ try {
var url = new URL(apiUrl + pkgCoord);
var con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
int status = con.getResponseCode();
if (status == 201) {
- logger.info("Successfully sent request to lazily ingest " + pkgCoord);
+ logger.info(apiUrl + pkgCoord + " will be ingested for later processing.");
+ }
+ else if (status == 200){
+ logger.info(apiUrl + pkgCoord + " package version already present in data base.");
+ }
+ else {
+ logger.info(apiUrl + pkgCoord + " will not ingest with HTTP code " + status + ".");
}
- } catch (IOException e) {
- logger.error("Could not send request to lazy ingest");
+ } catch (Exception e) {
+ logger.error(apiUrl + pkgCoord + " error while creating or sending API ingestion request: " + e);
}
}
}
