wu-sheng commented on a change in pull request #5523:
URL: https://github.com/apache/skywalking/pull/5523#discussion_r491692763



##########
File path: docs/en/guides/Java-Plugin-Development-Guide.md
##########
@@ -443,3 +443,44 @@ Please follow there steps:
 1. Send the pull request and ask for review. 
 1. The plugin committers approve your plugins, plugin CI-with-IT, e2e and 
plugin tests passed.
 1. The plugin accepted by SkyWalking. 
+
+### Plugin Meter reporter
+Java agent also supports customize meter report to backend. We provide Java 
Agent Core level API such as [Application Toolkit 
meter](../setup/service-agent/java-agent/Application-toolkit-meter.md).
+
+* `Counter` API represents a single monotonically increasing counter, 
automatic collect data and report to backend.
+```java
+import org.apache.skywalking.apm.agent.core.meter.MeterFactory;
+
+Counter counter = MeterFactory.counter(meterName).tag("tagKey", 
"tagValue").mode(Counter.Mode.INCREMENT).build();
+counter.increment(1d);
+```
+1. `MeterFactory.counter` Create a new counter builder with the meter name.
+1. `Counter.Builder.tag(String key, String value)` Mark a tag key/value pair.
+1. `Counter.Builder.mode(Counter.Mode mode)` Change the counter mode, `RATE` 
mode means reporting rate to the backend.
+1. `Counter.Builder.build()` Build a new `Counter` which is collected and 
reported to the backend.
+1. `Counter.increment(double count)` Increment count to the `Counter`, It 
could be a positive/negative value.

Review comment:
       I feel accepting the `negative` value is conflicting with the definition 
of the counter. `a single monotonically increasing counter`. 
   
   Please recheck.

##########
File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/meter/builder/Histogram.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.agent.core.meter.builder;
+
+import java.util.List;
+
+/**
+ * Similar to a histogram, a summary sample observations (usual things like 
request durations and response sizes).

Review comment:
       What does this `similar to a histogram` mean? Isn't this a histogram 
already?

##########
File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/meter/builder/Histogram.java
##########
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.agent.core.meter.builder;
+
+import java.util.List;
+
+/**
+ * Similar to a histogram, a summary sample observations (usual things like 
request durations and response sizes).
+ * While it also provides a total count of observations and a sum of all 
observed values, it calculates configurable quartiles over a sliding time 
window.

Review comment:
       Are you copying this from Prometheus or somewhere? Also, at the same 
time, `HistogramImpl`'s comments don't make sense.

##########
File path: 
apm-application-toolkit/apm-toolkit-meter/src/main/java/org/apache/skywalking/apm/toolkit/meter/impl/CounterImpl.java
##########
@@ -51,30 +48,13 @@ public void increment(double count) {
     /**
      * Get count value
      */
-    public double get() {
+    public double getCount() {

Review comment:
       Why change this name? But such as in `GuageImpl`, still, use `get`? 
Seems inconsistent to me.
   

##########
File path: docs/en/guides/Java-Plugin-Development-Guide.md
##########
@@ -443,3 +443,44 @@ Please follow there steps:
 1. Send the pull request and ask for review. 
 1. The plugin committers approve your plugins, plugin CI-with-IT, e2e and 
plugin tests passed.
 1. The plugin accepted by SkyWalking. 
+
+### Plugin Meter reporter

Review comment:
       ```suggestion
   ### Plugin Meter Plugin
   ```

##########
File path: docs/en/guides/Java-Plugin-Development-Guide.md
##########
@@ -443,3 +443,44 @@ Please follow there steps:
 1. Send the pull request and ask for review. 
 1. The plugin committers approve your plugins, plugin CI-with-IT, e2e and 
plugin tests passed.
 1. The plugin accepted by SkyWalking. 
+
+### Plugin Meter reporter
+Java agent also supports customize meter report to backend. We provide Java 
Agent Core level API such as [Application Toolkit 
meter](../setup/service-agent/java-agent/Application-toolkit-meter.md).

Review comment:
       ```suggestion
   Java agent plugin could use meter APIs to collect the metrics for backend 
analysis.
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to