[ 
https://issues.apache.org/jira/browse/OAK-7904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16746398#comment-16746398
 ] 

Thomas Mueller commented on OAK-7904:
-------------------------------------

A few comments:

* The patch only measures the execute() method, not the next() method. next() 
is called during iteration.
* We already measure timing data for queries, but not for indexes, in the 
_caller_ of SelectorImpl.execute() and next(). That is: 
QueryImpl.RowIterator.fetchNext(). See 

{noformat}
long nanos = System.nanoTime();
...
nanos = System.nanoTime() - nanos;
stats.read(rowIndex - oldIndex, rowIndex, nanos);
{noformat}

* As this is called a lot, it's relatively important that it's fast. So I would 
for example avoid String concatenation if possible, in "QUERY_DURATION_" + 
indexName. Instead, the String could be cached, or maybe even the timer could 
be re-used (not sure) and just times could be increased as done in 
stats.read(...)
* TimeUnit.NANOSECONDS.toMillis(context.stop()); is not really needed, it's 
sufficient to call context.stop()


> Exporting query duration per index metrics with Sling Metrics / DropWizard
> --------------------------------------------------------------------------
>
>                 Key: OAK-7904
>                 URL: https://issues.apache.org/jira/browse/OAK-7904
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: indexing, query
>            Reporter: Paul Chibulcuteanu
>            Assignee: Paul Chibulcuteanu
>            Priority: Major
>             Fix For: 1.9.10, 1.12
>
>         Attachments: OAK-7904.0.patch, OAK-7904.1.patch
>
>
> Purpose of this task is to evaluate & create metric which calculates the 
> average duration of query for each index.
> This metric can be later used to evaluate which index(s) need to be optimised.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to