diff --git a/src/fr/devinsy/statoolinfos/metrics/Prober.java b/src/fr/devinsy/statoolinfos/metrics/Prober.java index f8e3527..0b6bb9c 100644 --- a/src/fr/devinsy/statoolinfos/metrics/Prober.java +++ b/src/fr/devinsy/statoolinfos/metrics/Prober.java @@ -151,14 +151,16 @@ public class Prober logger.info("== Probing Gitea."); String httpLogs = configuration.getProbeHttpAccessLogSource(); logger.info("httpLogs=[{}]", httpLogs); + String httpAccessLogRegex = configuration.getProbeHttpAccessLogPattern(); + logger.info("httpAccessPattern=[{}]", httpAccessLogRegex); File dataDirectory = configuration.getAsFile("conf.probe.gitea.data"); logger.info("dataPath=[{}]", dataDirectory); String apiURL = configuration.get("conf.probe.gitea.api.url"); logger.info("apiURL=[{}]", apiURL); String apiToken = configuration.get("conf.probe.gitea.api.token"); - logger.info("apiToken=[{}]", apiToken); + logger.info("apiToken=[{}]", apiToken == null ? "null" : "************************"); - PathCounters metrics = GiteaProber.probe(FilesUtils.searchByWildcard(httpLogs), null, apiURL, apiToken, dataDirectory); + PathCounters metrics = GiteaProber.probe(FilesUtils.searchByWildcard(httpLogs), httpAccessLogRegex, apiURL, apiToken, dataDirectory); counters.putAll(metrics); } diff --git a/src/fr/devinsy/statoolinfos/metrics/gitea/GiteaAPI.java b/src/fr/devinsy/statoolinfos/metrics/gitea/GiteaAPI.java index 741387e..c934b0f 100644 --- a/src/fr/devinsy/statoolinfos/metrics/gitea/GiteaAPI.java +++ b/src/fr/devinsy/statoolinfos/metrics/gitea/GiteaAPI.java @@ -65,7 +65,6 @@ public class GiteaAPI // json = IOUtils.toString(new URL(url + "/api/v1/repos/search?limit=100000&token=" + token), Charset.defaultCharset()); - System.out.println(json); this.repositories = (JSONArray) ((JSONObject) (new JSONParser().parse(json))).get("data"); } diff --git a/src/fr/devinsy/statoolinfos/metrics/gitea/GiteaProber.java b/src/fr/devinsy/statoolinfos/metrics/gitea/GiteaProber.java index 8eba63b..06d9de2 100644 --- a/src/fr/devinsy/statoolinfos/metrics/gitea/GiteaProber.java +++ b/src/fr/devinsy/statoolinfos/metrics/gitea/GiteaProber.java @@ -82,11 +82,13 @@ public class GiteaProber // metrics.service.files.count result.putAll(DatafilesProber.probe(dataPath)); + // + System.out.println("Probing GiteaAPI [" + apiURL + "]"); if (!StringUtils.isBlank(apiURL) && (!StringUtils.isBlank(apiToken))) { try { - GiteaAPI gitea = new GiteaAPI("https://forge.devinsy.fr/", "6fd97c63c25cabf67ff90731ee79ab4568be89b0"); + GiteaAPI gitea = new GiteaAPI(apiURL, apiToken); // metrics.service.accounts // metrics.service.accounts.active @@ -110,6 +112,12 @@ public class GiteaProber result.set(gitea.getPrivateRepositoryCount(), "metrics.forge.repositories.private"); result.set(gitea.getForkRepositoryCount(), "metrics.forge.repositories.forks"); result.set(gitea.getMirrorRepositoryCount(), "metrics.forge.repositories.mirrors"); + + // metrics.issues.count.* = + // metrics.issues.issuers.*= + // metrics.issues.created.* = + // metrics.issues.closed.* = + } catch (IOException | ParseException exception) { @@ -273,7 +281,6 @@ public class GiteaProber // metrics.service.users.ipv6 if ((!log.isBot()) && (USE_PATTERN.matcher(log.getRequest()).matches())) { - System.out.println(log.toStringLog()); String key = String.format("%s---%s", log.getIp(), log.getUserAgent()); users.put(key, year, yearMonth, yearWeek, date); diff --git a/src/fr/devinsy/statoolinfos/metrics/util/DatabaseProber.java b/src/fr/devinsy/statoolinfos/metrics/util/DatabaseProber.java index 8997728..001e404 100644 --- a/src/fr/devinsy/statoolinfos/metrics/util/DatabaseProber.java +++ b/src/fr/devinsy/statoolinfos/metrics/util/DatabaseProber.java @@ -24,7 +24,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import fr.devinsy.statoolinfos.core.DatabaseConfig; -import fr.devinsy.statoolinfos.core.StatoolInfosException; import fr.devinsy.statoolinfos.metrics.PathCounters; /** @@ -44,13 +43,11 @@ public class DatabaseProber /** * Probe. * - * @param directory - * the directory + * @param config + * the config * @return the path counters * @throws IOException * Signals that an I/O exception has occurred. - * @throws StatoolInfosException - * the statool infos exception */ public static PathCounters probe(final DatabaseConfig config) throws IOException {