You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/09/20 13:41:24 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #5523: Provide metrics APIs for agent plugin

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.




----------------------------------------------------------------
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:
users@infra.apache.org