monocle icon indicating copy to clipboard operation
monocle copied to clipboard

Search fields (merge time)

Open cwharland opened this issue 3 years ago • 3 comments

Is it possible to filter search by merge time? I see the metric reported and used in the x-axis of the complexity chart but I don't see the ability to use that as a field in search.

Alternatively, should I be using an API to the monocle host to query merge time from a subset of repos?

cwharland avatar Aug 01 '22 21:08 cwharland

Hi Chris,

It is not for the moment but the duration attribute which is the delay between the time a change has been created and the time a change has been merged is available in the Monocle database for every merged change. So adding that filter in the query language should be possible. I'll give it a try.

What do you mean by "a subset of repos" ?

morucci avatar Aug 09 '22 08:08 morucci

Subset of repos for me simply means filtering on repo-name which is already possible.

cwharland avatar Aug 10 '22 21:08 cwharland

You can use the 'CHANGES' query type to fetch changes and compute the merge time via the 'created_at' and 'merged_at' fields.

curl 'https://demo.changemetrics.io/api/2/search/query' -H 'Content-Type: application/json' --data '{"index":"python","query":"(from:now-3weeks)","query_type":"QUERY_CHANGE","order":{"field":"updated_at","direction":"DESC"},"limit":"256","change_id":""}'

morucci avatar Aug 11 '22 08:08 morucci

Thanks to #927 and #928:

  • [api] Add support for the 'ttm' field in the query language. The field allows to filter on merged changes of a specific duration (in seconds).
  • [api] Expose the duration field of the change object. Duration is the time to merge delay in seconds.

morucci avatar Aug 11 '22 12:08 morucci