You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2020/09/20 06:42:03 UTC

[incubator-nlpcraft] branch master updated: WIP.

This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/master by this push:
     new 5866eb3  WIP.
5866eb3 is described below

commit 5866eb3681b2d1cfc1490f8b828b2e9ce31bcfcc
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Sep 19 23:41:49 2020 -0700

    WIP.
---
 .../apache/nlpcraft/server/opencensus/NCOpenCensusServerStats.scala  | 5 ++++-
 .../main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala  | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/opencensus/NCOpenCensusServerStats.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/opencensus/NCOpenCensusServerStats.scala
index 25f8612..4bc63ac 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/opencensus/NCOpenCensusServerStats.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/opencensus/NCOpenCensusServerStats.scala
@@ -29,6 +29,7 @@ import io.opencensus.stats._
   * OpenCensus stats instrumentation.
   */
 trait NCOpenCensusServerStats {
+    val M_HEALTH_MS: MeasureLong = MeasureLong.create("health_latency", "The latency of '/health' REST call", "ms")
     val M_ASK_LATENCY_MS: MeasureLong = MeasureLong.create("ask_latency", "The latency of '/ask' REST call", "ms")
     val M_CHECK_LATENCY_MS: MeasureLong = MeasureLong.create("check_latency", "The latency of '/check' REST call", "ms")
     val M_MODEL_SUGSYN_LATENCY_MS: MeasureLong = MeasureLong.create("model_inspect_latency", "The latency of '/model/inspect' REST call", "ms")
@@ -99,12 +100,13 @@ trait NCOpenCensusServerStats {
         }
         
         val views = List(
+            mkViews(M_HEALTH_MS, "health"),
             mkViews(M_ASK_LATENCY_MS, "ask"),
+            mkViews(M_ASK_SYNC_LATENCY_MS, "ask/sync"),
             mkViews(M_CANCEL_LATENCY_MS, "cancel"),
             mkViews(M_CHECK_LATENCY_MS, "check"),
             mkViews(M_SIGNIN_LATENCY_MS, "signin"),
             mkViews(M_SIGNOUT_LATENCY_MS, "signout"),
-            mkViews(M_ASK_SYNC_LATENCY_MS, "ask/sync"),
             mkViews(M_CLEAR_CONV_LATENCY_MS, "clear/conversation"),
             mkViews(M_CLEAR_DIALOG_LATENCY_MS, "clear/dialog"),
             mkViews(M_COMPANY_ADD_LATENCY_MS, "company/add"),
@@ -123,6 +125,7 @@ trait NCOpenCensusServerStats {
             mkViews(M_FEEDBACK_ADD_LATENCY_MS, "feedback/add"),
             mkViews(M_FEEDBACK_DELETE_LATENCY_MS, "feedback/delete"),
             mkViews(M_FEEDBACK_GET_LATENCY_MS, "feedback/get"),
+            mkViews(M_MODEL_SUGSYN_LATENCY_MS, "model/sugsyn"),
             mkViews(M_PROBE_ALL_LATENCY_MS, "probe/all"),
             
             // Special views for round trip metrics. 
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
index 3ea1790..e2cb9a3 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/rest/NCBasicRestApi.scala
@@ -1895,12 +1895,13 @@ class NCBasicRestApi extends NCRestApi with LazyLogging with NCOpenCensusTrace w
                 corsHandler (
                     get {
                         withRequestTimeoutResponse(_ ⇒ timeoutResp) {
-                            path(API / "health") { health$() }
+                            path(API / "health") { health$() } // Also duplicated for POST.
                         }
                     } ~
                     post {
                         encodeResponseWith(Coders.NoCoding, Coders.Gzip) {
                             withRequestTimeoutResponse(_ ⇒ timeoutResp) {
+                                path(API / "health") { health$() } // Duplicate for POST.
                                 path(API / "signin") { withMetric(M_SIGNIN_LATENCY_MS, signin$) } ~
                                 path(API / "signout") { withMetric(M_SIGNOUT_LATENCY_MS, signout$) } ~
                                 path(API / "cancel") { withMetric(M_CANCEL_LATENCY_MS, cancel$) } ~