small enhancements
This commit is contained in:
@@ -31,7 +31,7 @@ public class Entry {
|
||||
|
||||
Entry(final long epochMilli, final long value, final Tags tags) {
|
||||
if (value < 0 || value > MAX_VALUE) {
|
||||
throw new IllegalArgumentException("value must be between 0 and " + MAX_VALUE);
|
||||
throw new IllegalArgumentException("value must be between 0 and " + MAX_VALUE + ", but was " + value);
|
||||
}
|
||||
|
||||
this.epochMilli = epochMilli;
|
||||
|
||||
@@ -83,14 +83,12 @@ public class PerformanceDb implements AutoCloseable {
|
||||
}
|
||||
final Entry entry = entryOptional.get();
|
||||
|
||||
final long epochMilli = entry.getEpochMilli();
|
||||
final long value = entry.getValue();
|
||||
final Tags tags = entry.getTags();
|
||||
final OffsetDateTime date = entry.getDate();
|
||||
|
||||
final PdbWriter writer = manager.get(tags, date);
|
||||
|
||||
writer.write(epochMilli, value);
|
||||
writer.write(entry);
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
import org.lucares.performance.db.PerformanceDb;
|
||||
@@ -33,7 +34,8 @@ public class Ingestor {
|
||||
}
|
||||
|
||||
public static void main(final String[] args) throws LiquibaseException, Exception {
|
||||
final Path dataDirectory = Files.createTempDirectory("ingestor");
|
||||
final Path dataDirectory = Paths.get("/tmp/ingestor");
|
||||
Files.createDirectories(dataDirectory);
|
||||
final File logFile = new File(
|
||||
"/home/andi/ws/performanceDb/data/production/ondem/ondem01/ap001/1_performance.log");
|
||||
|
||||
|
||||
@@ -41,13 +41,13 @@ public class PerformanceLogs {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
final Entry entry = filter.parse(line, tags);
|
||||
if (entry != null) {
|
||||
System.out.println(entry);
|
||||
queue.put(entry);
|
||||
}
|
||||
}
|
||||
|
||||
result = true;
|
||||
} finally {
|
||||
System.out.println("added poison");
|
||||
queue.put(Entry.POISON);
|
||||
}
|
||||
return result;
|
||||
@@ -60,11 +60,11 @@ public class PerformanceLogs {
|
||||
} catch (ExecutionException | TimeoutException e) {
|
||||
e.printStackTrace(); // TODO @ahr handle this mess
|
||||
}
|
||||
} catch (final RuntimeException e) {
|
||||
} catch (final Exception e) {
|
||||
future.cancel(true);
|
||||
} finally {
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(10, TimeUnit.MINUTES);
|
||||
executor.awaitTermination(10, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user