Skip to content

Commit 91193e6

Browse files
author
Vladimir Kotal
committed
add IndexDatabase metrics
1 parent ea52985 commit 91193e6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.index;
@@ -474,15 +474,17 @@ public void update() throws IOException {
474474
Statistics elapsed = new Statistics();
475475
LOGGER.log(Level.INFO, "Starting traversal of directory {0}", dir);
476476
indexDown(sourceRoot, dir, args);
477-
elapsed.report(LOGGER, String.format("Done traversal of directory %s", dir));
477+
elapsed.report(LOGGER, String.format("Done traversal of directory %s", dir),
478+
"indexer.db.directory.traversal");
478479

479480
showFileCount(dir, args);
480481

481482
args.cur_count = 0;
482483
elapsed = new Statistics();
483484
LOGGER.log(Level.INFO, "Starting indexing of directory {0}", dir);
484485
indexParallel(dir, args);
485-
elapsed.report(LOGGER, String.format("Done indexing of directory %s", dir));
486+
elapsed.report(LOGGER, String.format("Done indexing of directory %s", dir),
487+
"indexer.db.directory.index");
486488

487489
// Remove data for the trailing terms that indexDown()
488490
// did not traverse. These correspond to files that have been
@@ -610,7 +612,8 @@ public void optimize() throws IOException {
610612

611613
wrt = new IndexWriter(indexDirectory, conf);
612614
wrt.forceMerge(1); // this is deprecated and not needed anymore
613-
elapsed.report(LOGGER, String.format("Done optimizing index%s", projectDetail));
615+
elapsed.report(LOGGER, String.format("Done optimizing index%s", projectDetail),
616+
"indexer.db.optimize");
614617
synchronized (lock) {
615618
if (dirtyFile.exists() && !dirtyFile.delete()) {
616619
LOGGER.log(Level.FINE, "Failed to remove \"dirty-file\": {0}",

0 commit comments

Comments
 (0)