add metric logging for getWriter
This commit is contained in:
@@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||
public class TagsToFile implements AutoCloseable {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TagsToFile.class);
|
||||
private final static Logger METRICS_LOGGER = LoggerFactory.getLogger("org.lucares.metrics.ingestion.tagsToFile");
|
||||
|
||||
private static class WriterCache {
|
||||
final List<PdbWriter> writers = new ArrayList<>();
|
||||
@@ -93,6 +94,7 @@ public class TagsToFile implements AutoCloseable {
|
||||
result = optionalWriter.get();
|
||||
LOGGER.trace("using existing pdbWriter: {}", result);
|
||||
} else {
|
||||
final long start = System.nanoTime();
|
||||
final List<PdbFile> pdbFiles = getFilesMatchingTagsExactly(tags);
|
||||
|
||||
assertAllFilesHaveSameFolder(pdbFiles);
|
||||
@@ -102,6 +104,9 @@ public class TagsToFile implements AutoCloseable {
|
||||
final List<Optional<PdbWriter>> existingWriters = CollectionUtils.filter(optionalWriters,
|
||||
Optional::isPresent);
|
||||
final List<PdbWriter> writers = CollectionUtils.map(existingWriters, Optional::get);
|
||||
|
||||
METRICS_LOGGER.debug("find writers took {}ms for tags {}", (System.nanoTime() - start)
|
||||
/ 1_000_000.0, tags);
|
||||
|
||||
final Optional<PdbWriter> optionalFirst = chooseBestMatchingWriter(writers, date);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user