chetanmeh commented on a change in pull request #4275: Collect and log CosmosDB
query metrics when extra logging is enabled
URL:
https://github.com/apache/incubator-openwhisk/pull/4275#discussion_r261051762
##########
File path:
common/scala/src/main/scala/org/apache/openwhisk/core/database/cosmosdb/CosmosDBArtifactStore.scala
##########
@@ -223,11 +224,22 @@ class CosmosDBArtifactStore[DocumentAbstraction <:
DocumentSerializer](protected
val querySpec = viewMapper.prepareQuery(ddoc, viewName, startKey, endKey,
realLimit, realIncludeDocs, descending)
+ val options = newFeedOptions()
+ val queryMetrics = if (transid.meta.extraLogging) {
+ options.setPopulateQueryMetrics(true)
+ Some(scala.collection.mutable.Buffer[QueryMetrics]())
Review comment:
> I guess not creating the buffer at all is slightly better, just harder to
read.
Yes the objective was to avoid that part for a debug logic. However I see
the readability point. Refactored the code to use suggested approach
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services