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_r260602075
##########
File path:
common/scala/src/main/scala/org/apache/openwhisk/core/database/cosmosdb/CosmosDBArtifactStore.scala
##########
@@ -240,10 +252,17 @@ class CosmosDBArtifactStore[DocumentAbstraction <:
DocumentSerializer](protected
.map(_.toList)
.map(l => if (limit > 0) l.take(limit) else l)
- f.foreach { out =>
- transid.finished(this, start, s"[QUERY] '$collName' completed: matched
${out.size}")
+ val g = f.andThen {
+ case Success(out) =>
+ queryMetrics.foreach { m =>
+ val combinedMetrics = QueryMetrics.ZERO.add(m: _*)
+ logging.debug(
+ this,
+ s"[QueryMetricsEnabled] Collection [$collName] - Query
[${querySpec.getQueryText}].\nQueryMetrics\n[$combinedMetrics]")
Review comment:
The sample output is there in PR description. The testcase currently only
looks for a marker `QueryMetricsEnabled` to assert that log statement is
executed
----------------------------------------------------------------
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