kezhenxu94 commented on code in PR #9575:
URL: https://github.com/apache/skywalking/pull/9575#discussion_r965518504


##########
docs/en/concepts-and-designs/lal.md:
##########
@@ -240,6 +240,80 @@ metrics:
     exp: http_response_time.sum(['le', 'service', 
'instance']).increase('PT5M').histogram().histogram_percentile([50,70,90,99])
 ```
 
+### SlowSql
+
+SlowSql aims to convert LogData to DatabaseSlowStatement. It extracts data 
from `parsed` result and save them as DatabaseSlowStatement. SlowSql will not 
abort or edit logs, you can use other LAL for further processing.
+We need to set a log tag("isSlowSql") to enable it. If logs sent to OAP does 
not have this tag, slowSql processing will be skipped.The example to set the 
tag is following:
+``` json
+[
+   {
+      "tags":{
+         "data":[
+            {
+               "key":"isSlowSql",
+               "value":"true"
+            }
+         ]
+      },
+      "body":{
+         "json":{
+            
"json":"{\"time\":\"20220906153959\",\"id\":\"cb92c1a5b-2691e-fb2f-457a-9c72a392d9ed\",\"service\":\"root[root]@[localhost]\",\"statement\":\"select
 sleep(2);\",\"layer\":\"MYSQL\",\"query_time\":2000}"
+         }
+      },
+      "service":"root[root]@[localhost]"
+   }
+]
+```
+
+- `serviceName`
+
+`serviceName` extracts the service name from the `parsed` result, and set it 
into the `DatabaseSlowStatement`, which will be persisted (if
+not dropped) and is used to associate with TopNDatabaseStatement and service.
+
+- `timeBucket`
+
+`timeBucket` extracts the time bucket from the `parsed` result, and set it 
into the `DatabaseSlowStatement`, which will be
+persisted (if not dropped) and is used to associate with TopNDatabaseStatement.
+
+- `statement`
+
+`statement` extracts the time bucket from the `parsed` result, and set it into 
the `DatabaseSlowStatement`, which will be
+persisted (if not dropped) and is used to associate with TopNDatabaseStatement.
+
+- `latency`
+
+`latency` extracts the latency from the `parsed` result, and set it into the 
`DatabaseSlowStatement`, which will be
+persisted (if not dropped) and is used to associate with TopNDatabaseStatement.
+
+- `id`
+
+`id` extracts the id from the `parsed` result, and set it into the 
`DatabaseSlowStatement`, which will be persisted (if not
+dropped) and is used to associate with TopNDatabaseStatement.
+
+- `layer`
+
+`layer` extracts the 
[layer](../../../oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/Layer.java)
 from the `parsed` result, and set it into the `DatabaseSlowStatement`, which 
will be persisted (if
+not dropped) and is used to associate with service.
+
+Example :
+
+```groovy
+filter {
+        json{
+        }
+        if (log.tags.getDataList().find{tag1->tag1.getKey() == 
"isSlowSql"}.getValue() == "true") {

Review Comment:
   > @kezhenxu94 Modifying Class `ExtractorSpec` may not have this effect, 
maybe I need to modify the
   > Class `LALPrecompiledExtension` and `AbstractSpec`?
   
   Hi, feel free to modify those if needed, I just provided an idea and it's 
not complete.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to