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/04/27 04:05:33 UTC

[GitHub] [skywalking] wu-sheng commented on pull request #4719: Support histogram function in Meter system.

wu-sheng commented on pull request #4719:
URL: https://github.com/apache/skywalking/pull/4719#issuecomment-619701828


   @hanahmily I added the `infinite-` supported. FYI @Fine0830 
   
   ## Set Infinite negative as the bucket
   The Integer#MIN_VALUE could be the first bucket element to indicate there is no minimum value.
   
   ## Usage
   ```java
                       // Histogram Example
                       final AcceptableValue<BucketedValues> histogramMetrics = service.buildMetrics(
                           "test_histogram_metrics", BucketedValues.class);
                       value.setTimeBucket(TimeBucket.getMinuteTimeBucket(System.currentTimeMillis()));
                       histogramMetrics.accept(servEntity, new BucketedValues(
                           new int[] {
                               Integer.MIN_VALUE,
                               0,
                               50,
                               100,
                               250
                           },
                           new long[] {
                               3,
                               1,
                               4,
                               10,
                               10
                           }
                       ));
   ```
   
   ## Demonstration
   ```graphql
   {
     readHeatMap(condition : {
       name: "test_histogram_metrics",
       entity: {
         scope: Service,
         serviceName: "mock_service",
         normal: true,
       }
     }, duration: {step:MINUTE, start: "2020-04-27 1130", end: "2020-04-27 1135"}
     ) {
       values {
         id,
         values
       } 
       buckets {
         min,
         max
       }
     }
   }
   ```
   
   ```graphql
   {
     "data": {
       "readHeatMap": {
         "values": [
           {
             "id": "202004271130_bW9ja19zZXJ2aWNl.1",
             "values": [
               0,
               0,
               0,
               0,
               0
             ]
           },
           {
             "id": "202004271131_bW9ja19zZXJ2aWNl.1",
             "values": [
               0,
               0,
               0,
               0,
               0
             ]
           },
           {
             "id": "202004271132_bW9ja19zZXJ2aWNl.1",
             "values": [
               366,
               122,
               488,
               1220,
               1220
             ]
           },
           {
             "id": "202004271133_bW9ja19zZXJ2aWNl.1",
             "values": [
               0,
               0,
               0,
               0,
               0
             ]
           },
           {
             "id": "202004271134_bW9ja19zZXJ2aWNl.1",
             "values": [
               0,
               0,
               0,
               0,
               0
             ]
           },
           {
             "id": "202004271135_bW9ja19zZXJ2aWNl.1",
             "values": [
               0,
               0,
               0,
               0,
               0
             ]
           }
         ],
         "buckets": [
           {
             "min": "infinite-",
             "max": "0"
           },
           {
             "min": "0",
             "max": "50"
           },
           {
             "min": "50",
             "max": "100"
           },
           {
             "min": "100",
             "max": "250"
           },
           {
             "min": "250",
             "max": "infinite+"
           }
         ]
       }
     }
   }
   ```


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