diff options
| author | Karsten Loesing <karsten.loesing@gmx.net> | 2019-11-01 17:40:11 +0100 |
|---|---|---|
| committer | Karsten Loesing <karsten.loesing@gmx.net> | 2019-11-01 17:57:22 +0100 |
| commit | 14cff6502252a0bf70453581d11b8d05a6445ab8 (patch) | |
| tree | 1fd02a6fd06b2c2f396b2057b754d777d2d59df1 | |
| parent | 0e57dae0bfd6f3f7e0c5b5c78773818343ba9550 (diff) | |
Tweak BridgeDB metrics file names.task-19332-2
We were using the same path for BridgeDB metrics in out/ and recent/,
and file names didn't contain the "-bridgedb-metrics" suffix that we
intended to add.
We're now using paths generated by BridgedbMetricsPersistence.
Also update create-tarballs.sh to create BridgeDB metrics tarballs.
Still part of #19332.
| m--------- | src/build | 0 | ||||
| -rw-r--r-- | src/main/java/org/torproject/metrics/collector/bridgedb/BridgedbMetricsProcessor.java | 20 | ||||
| -rwxr-xr-x | src/main/resources/create-tarballs.sh | 7 |
3 files changed, 14 insertions, 13 deletions
diff --git a/src/build b/src/build -Subproject d82fff984634fe006ac7b0b102e7f48a52ca20d +Subproject eb16cb359db41722e6089bafb1e26808df4338d diff --git a/src/main/java/org/torproject/metrics/collector/bridgedb/BridgedbMetricsProcessor.java b/src/main/java/org/torproject/metrics/collector/bridgedb/BridgedbMetricsProcessor.java index 7ae4502..9bb4f36 100644 --- a/src/main/java/org/torproject/metrics/collector/bridgedb/BridgedbMetricsProcessor.java +++ b/src/main/java/org/torproject/metrics/collector/bridgedb/BridgedbMetricsProcessor.java @@ -11,6 +11,7 @@ import org.torproject.metrics.collector.conf.Configuration; import org.torproject.metrics.collector.conf.ConfigurationException; import org.torproject.metrics.collector.conf.Key; import org.torproject.metrics.collector.cron.CollecTorMain; +import org.torproject.metrics.collector.persist.BridgedbMetricsPersistence; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,7 +22,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.time.Instant; -import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.Arrays; import java.util.Stack; @@ -50,12 +50,6 @@ public class BridgedbMetricsProcessor extends CollecTorMain { private String recentPathName; /** - * File name format. - */ - private DateTimeFormatter filenameFormat = DateTimeFormatter.ofPattern( - "uuuu/MM/dd/uuuu-MM-dd-HH-mm-ss"); - - /** * Initialize this class with the given configuration. */ public BridgedbMetricsProcessor(Configuration config) { @@ -101,10 +95,12 @@ public class BridgedbMetricsProcessor extends CollecTorMain { .readDescriptors(this.inputDirectory)) { if (descriptor instanceof BridgedbMetrics) { BridgedbMetrics bridgedbMetrics = (BridgedbMetrics) descriptor; + BridgedbMetricsPersistence persistence + = new BridgedbMetricsPersistence(bridgedbMetrics); Path tarballPath = Paths.get(this.outputPathName, - bridgedbMetrics.bridgedbMetricsEnd().format(this.filenameFormat)); + persistence.getStoragePath()); Path rsyncPath = Paths.get(this.recentPathName, - bridgedbMetrics.bridgedbMetricsEnd().format(this.filenameFormat)); + persistence.getRecentPath()); this.writeDescriptor(bridgedbMetrics.getRawDescriptorBytes(), tarballPath, rsyncPath); } else if (descriptor instanceof UnparseableDescriptor) { @@ -127,10 +123,8 @@ public class BridgedbMetricsProcessor extends CollecTorMain { * storing them in instance attributes. */ private void initializeConfiguration() throws ConfigurationException { - this.outputPathName = Paths.get(config.getPath(Key.OutputPath).toString(), - "bridgedb-metrics").toString(); - this.recentPathName = Paths.get(config.getPath(Key.RecentPath).toString(), - "bridgedb-metrics").toString(); + this.outputPathName = config.getPath(Key.OutputPath).toString(); + this.recentPathName = config.getPath(Key.RecentPath).toString(); this.inputDirectory = config.getPath(Key.BridgedbMetricsLocalOrigins).toFile(); } diff --git a/src/main/resources/create-tarballs.sh b/src/main/resources/create-tarballs.sh index 5802020..de8dce4 100755 --- a/src/main/resources/create-tarballs.sh +++ b/src/main/resources/create-tarballs.sh @@ -63,6 +63,8 @@ TARBALLS=( snowflakes-$YEARTWO-$MONTHTWO bridge-pool-assignments-$YEARONE-$MONTHONE bridge-pool-assignments-$YEARTWO-$MONTHTWO + bridgedb-metrics-$YEARONE-$MONTHONE + bridgedb-metrics-$YEARTWO-$MONTHTWO ) TARBALLS=($(printf "%s\n" "${TARBALLS[@]}" | uniq)) @@ -94,6 +96,8 @@ DIRECTORIES=( $OUTDIR/snowflakes/$YEARTWO/$MONTHTWO/ $OUTDIR/bridge-pool-assignments/$YEARONE/$MONTHONE/ $OUTDIR/bridge-pool-assignments/$YEARTWO/$MONTHTWO/ + $OUTDIR/bridgedb-metrics/$YEARONE/$MONTHONE/ + $OUTDIR/bridgedb-metrics/$YEARTWO/$MONTHTWO/ ) DIRECTORIES=($(printf "%s\n" "${DIRECTORIES[@]}" | uniq)) @@ -183,4 +187,7 @@ ln -f -s -t $ARCHIVEDIR/snowflakes/ $TARBALLTARGETDIR/snowflakes-20??-??.tar.xz mkdir -p $ARCHIVEDIR/bridge-pool-assignments/ ln -f -s -t $ARCHIVEDIR/bridge-pool-assignments/ $TARBALLTARGETDIR/bridge-pool-assignments-20??-??.tar.xz +mkdir -p $ARCHIVEDIR/bridgedb-metrics/ +ln -f -s -t $ARCHIVEDIR/bridgedb-metrics/ $TARBALLTARGETDIR/bridgedb-metrics-20??-??.tar.xz + echo `date` "Finished." |
