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

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 65e8ab3  Log rate limit sampler rename `qps` to `rpm` (#7384)
65e8ab3 is described below

commit 65e8ab3ecc6eaf86a19ec776de718e1fcff45e18
Author: kezhenxu94 <[email protected]>
AuthorDate: Thu Jul 29 18:11:07 2021 +0800

    Log rate limit sampler rename `qps` to `rpm` (#7384)
---
 CHANGES.md                                                        | 1 +
 dist-material/config-examples/lal.yaml                            | 4 ++--
 docs/en/concepts-and-designs/lal.md                               | 8 ++++----
 .../log/analyzer/dsl/spec/sink/sampler/RateLimitingSampler.java   | 8 ++++----
 .../java/org/apache/skywalking/oap/log/analyzer/dsl/DSLTest.java  | 8 ++++----
 oap-server/server-bootstrap/src/main/resources/lal/envoy-als.yaml | 4 ++--
 oap-server/server-core/src/main/proto/RemoteService.proto         | 2 +-
 7 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 3985ba1..e80df80 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -122,6 +122,7 @@ Release Notes.
 * Filtering NaN value samples when build SampleFamily
 * Add Thread and ClassLoader Metrics for the self-observability and 
otel-oc-rules
 * Simple optimization of trace sql query statement. Avoid "select *" query 
method
+* Breaking Change: rename `qps` to `rpm` in LAL 
 
 #### UI
 
diff --git a/dist-material/config-examples/lal.yaml 
b/dist-material/config-examples/lal.yaml
index f20e359..bc206c1 100644
--- a/dist-material/config-examples/lal.yaml
+++ b/dist-material/config-examples/lal.yaml
@@ -38,11 +38,11 @@ rules:
           sampler {
             if (log.service == "ImportantApp") {
               rateLimit("ImportantAppSampler") {
-                qps 300
+                rpm 18000
               }
             } else {
               rateLimit("OtherSampler") {
-                qps 30
+                rpm 1800
               }
             }
           }
diff --git a/docs/en/concepts-and-designs/lal.md 
b/docs/en/concepts-and-designs/lal.md
index ac6e1b7..65ef65c 100644
--- a/docs/en/concepts-and-designs/lal.md
+++ b/docs/en/concepts-and-designs/lal.md
@@ -244,8 +244,8 @@ Sampler allows you to save the logs in a sampling manner. 
Currently, the samplin
 contributions on more sampling strategies. If multiple samplers are specified, 
the last one determines the final sampling
 result. See examples in [Enforcer](#enforcer).
 
-`rateLimit` samples `n` logs at a maximum rate of 1 second. 
`rateLimit("SamplerID")` requires an ID for the sampler. Sampler
-declarations with the same ID share the same sampler instance, thus sharing 
the same `qps` and resetting logic.
+`rateLimit` samples `n` logs at a maximum rate of 1 minute. 
`rateLimit("SamplerID")` requires an ID for the sampler. Sampler
+declarations with the same ID share the same sampler instance, thus sharing 
the same `rpm` and resetting logic.
 
 Examples:
 
@@ -257,11 +257,11 @@ filter {
         sampler {
             if (parsed.service == "ImportantApp") {
                 rateLimit("ImportantAppSampler") {
-                    qps 30  // samples 30 pieces of logs every second for 
service "ImportantApp"
+                    rpm 1800  // samples 1800 pieces of logs every minute for 
service "ImportantApp"
                 }
             } else {
                 rateLimit("OtherSampler") {
-                    qps 3   // samples 3 pieces of logs every second for other 
services than "ImportantApp"
+                    rpm 180   // samples 180 pieces of logs every minute for 
other services than "ImportantApp"
                 }
             }
         }
diff --git 
a/oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/sink/sampler/RateLimitingSampler.java
 
b/oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/sink/sampler/RateLimitingSampler.java
index c629f75..3f1c548 100644
--- 
a/oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/sink/sampler/RateLimitingSampler.java
+++ 
b/oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/dsl/spec/sink/sampler/RateLimitingSampler.java
@@ -31,11 +31,11 @@ import lombok.experimental.Accessors;
 import lombok.extern.slf4j.Slf4j;
 
 @Accessors(fluent = true)
-@EqualsAndHashCode(of = {"qps"})
+@EqualsAndHashCode(of = {"rpm"})
 public class RateLimitingSampler implements Sampler {
     @Getter
     @Setter
-    private volatile int qps;
+    private volatile int rpm;
 
     private final AtomicInteger factor = new AtomicInteger();
 
@@ -58,7 +58,7 @@ public class RateLimitingSampler implements Sampler {
 
     @Override
     public boolean sample() {
-        return factor.getAndIncrement() < qps;
+        return factor.getAndIncrement() < rpm;
     }
 
     @Override
@@ -80,7 +80,7 @@ public class RateLimitingSampler implements Sampler {
 
             if (!started) {
                 future = Executors.newSingleThreadScheduledExecutor()
-                                  .scheduleAtFixedRate(this::reset, 1, 1, 
TimeUnit.SECONDS);
+                                  .scheduleAtFixedRate(this::reset, 1, 1, 
TimeUnit.MINUTES);
                 started = true;
             }
         }
diff --git 
a/oap-server/analyzer/log-analyzer/src/test/java/org/apache/skywalking/oap/log/analyzer/dsl/DSLTest.java
 
b/oap-server/analyzer/log-analyzer/src/test/java/org/apache/skywalking/oap/log/analyzer/dsl/DSLTest.java
index 36f5451..95770ac 100644
--- 
a/oap-server/analyzer/log-analyzer/src/test/java/org/apache/skywalking/oap/log/analyzer/dsl/DSLTest.java
+++ 
b/oap-server/analyzer/log-analyzer/src/test/java/org/apache/skywalking/oap/log/analyzer/dsl/DSLTest.java
@@ -93,13 +93,13 @@ public class DSLTest {
                     "        // use service:errorCode as sampler id so that 
each service:errorCode has its own sampler,\n" +
                     "        // e.g. 
checkoutservice:[upstreamConnectionFailure], 
checkoutservice:[upstreamRetryLimitExceeded]\n" +
                     "        
rateLimit(\"${log.service}:${log.body.json.json}:${log.tags.getData(0).key}:${parsed?.commonProperties?.responseFlags}\")
 {\n" +
-                    "          qps 100\n" +
+                    "          rpm 100\n" +
                     "        }\n" +
                     "      } else {\n" +
                     "        // use service:responseCode as sampler id so that 
each service:responseCode has its own sampler,\n" +
                     "        // e.g. checkoutservice:500, 
checkoutservice:404.\n" +
                     "        
rateLimit(\"${log.service}:${log.body?.type}:${log.traceContext?.traceId}:${parsed?.response?.responseCode}\")
 {\n" +
-                    "          qps 100\n" +
+                    "          rpm 100\n" +
                     "        }\n" +
                     "      }\n" +
                     "    }\n" +
@@ -146,13 +146,13 @@ public class DSLTest {
                     "        // use service:errorCode as sampler id so that 
each service:errorCode has its own sampler,\n" +
                     "        // e.g. 
checkoutservice:[upstreamConnectionFailure], 
checkoutservice:[upstreamRetryLimitExceeded]\n" +
                     "        
rateLimit(\"${log.service}:${(parsed?.commonProperties?.responseFlags as 
Map)?.keySet()}\") {\n" +
-                    "          qps 100\n" +
+                    "          rpm 100\n" +
                     "        }\n" +
                     "      } else {\n" +
                     "        // use service:responseCode as sampler id so that 
each service:responseCode has its own sampler,\n" +
                     "        // e.g. checkoutservice:500, 
checkoutservice:404.\n" +
                     "        
rateLimit(\"${log.service}:${parsed?.response?.responseCode}\") {\n" +
-                    "          qps 100\n" +
+                    "          rpm 100\n" +
                     "        }\n" +
                     "      }\n" +
                     "    }\n" +
diff --git a/oap-server/server-bootstrap/src/main/resources/lal/envoy-als.yaml 
b/oap-server/server-bootstrap/src/main/resources/lal/envoy-als.yaml
index df4ac74..2da0292 100644
--- a/oap-server/server-bootstrap/src/main/resources/lal/envoy-als.yaml
+++ b/oap-server/server-bootstrap/src/main/resources/lal/envoy-als.yaml
@@ -33,13 +33,13 @@ rules:
               // use service:errorCode as sampler id so that each 
service:errorCode has its own sampler,
               // e.g. checkoutservice:[upstreamConnectionFailure], 
checkoutservice:[upstreamRetryLimitExceeded]
               
rateLimit("${log.service}:${parsed?.commonProperties?.responseFlags?.toString()}")
 {
-                qps 100
+                rpm 6000
               }
             } else {
               // use service:responseCode as sampler id so that each 
service:responseCode has its own sampler,
               // e.g. checkoutservice:500, checkoutservice:404.
               rateLimit("${log.service}:${parsed?.response?.responseCode}") {
-                qps 100
+                rpm 6000
               }
             }
           }
diff --git a/oap-server/server-core/src/main/proto/RemoteService.proto 
b/oap-server/server-core/src/main/proto/RemoteService.proto
index 7206b5b..60dceae 100644
--- a/oap-server/server-core/src/main/proto/RemoteService.proto
+++ b/oap-server/server-core/src/main/proto/RemoteService.proto
@@ -40,4 +40,4 @@ message RemoteData {
 }
 
 message Empty {
-}
\ No newline at end of file
+}

Reply via email to