commit d217212943b2d1c8690c54a50021ee085acbf6c3 Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Feb 23 13:24:30 2011 +0100
Import GetTor stats directly into the database. --- src/org/torproject/ernie/db/Configuration.java | 5 ++++ src/org/torproject/ernie/db/GetTorProcessor.java | 24 ---------------------- 2 files changed, 5 insertions(+), 24 deletions(-)
diff --git a/src/org/torproject/ernie/db/Configuration.java b/src/org/torproject/ernie/db/Configuration.java index 37676ec..8b0fc1f 100644 --- a/src/org/torproject/ernie/db/Configuration.java +++ b/src/org/torproject/ernie/db/Configuration.java @@ -252,6 +252,11 @@ public class Configuration { + "least one data sink, but we don't have a single data source " + "containing bridge descriptors."); } + if (this.downloadProcessGetTorStats && + !this.writeAggregateStatsDatabase) { + logger.warning("We are configured to download GetTor statistics, " + + "but not to import them into the database."); + } } public boolean getWriteConsensusStats() { return this.writeConsensusStats; diff --git a/src/org/torproject/ernie/db/GetTorProcessor.java b/src/org/torproject/ernie/db/GetTorProcessor.java index ed1b7ff..8c5687c 100644 --- a/src/org/torproject/ernie/db/GetTorProcessor.java +++ b/src/org/torproject/ernie/db/GetTorProcessor.java @@ -65,30 +65,6 @@ public class GetTorProcessor { return; }
- File statsFile = new File("stats/gettor-stats"); - logger.fine("Writing file " + statsFile.getAbsolutePath() + "..."); - try { - statsFile.getParentFile().mkdirs(); - BufferedWriter bw = new BufferedWriter(new FileWriter(statsFile)); - bw.write("date"); - for (String column : columns) { - bw.write("," + column); - } - bw.write("\n"); - for (String date : data.keySet()) { - bw.write(date); - for (String column : columns) { - Integer value = data.get(date).get(column); - bw.write("," + (value == null ? "NA" : value)); - } - bw.write("\n"); - } - bw.close(); - } catch (IOException e) { - logger.log(Level.WARNING, "Failed writing " - + statsFile.getAbsolutePath() + "!", e); - } - /* Write results to database. */ if (connectionURL != null) { try {
tor-commits@lists.torproject.org