chengaofeng opened a new issue #5935:
URL: https://github.com/apache/skywalking/issues/5935


   I am using ```GraphQL``` to query the ```service_relation_server_cpm``` 
metric from OAP, It's ok when  the ```Duration``` is step by ```MINUTE```. 
while set the step by ```HOUR``` or ```DAY```, the        ```value``` is always 
```0```.
   
   OAP version ```7.0.0```
   
   ## query
   
   ```
        
   query: quryTopoInfo($duration: Duration!) {
        cpmS: getLinearIntValues(metric:{
                name: "service_relation_server_cpm"
                id: "9_10"
        }, duration: $duration) {
         values {
           id
           value
         }
       }
   }
        
   ```
   
   ## step by minute 
   
   ##### Variables
   
   ```
   {"duration":{"start":"2020-12-02 0930","end":"2020-12-02 
0935","step":"MINUTE"}}
   
   ```
   
   ##### Response
   
   ```
   
{"data":{"cpmS":{"values":[{"id":"202012020930_9_10","value":5},{"id":"202012020931_9_10","value":3},{"id":"202012020932_9_10","value":3},{"id":"202012020933_9_10","value":7},{"id":"202012020934_9_10","value":2},{"id":"202012020935_9_10","value":8}]}}}
   ```
   
   
   ## step by hour
   
   ##### Variables
   
   ```
   {"duration":{"start":"2020-12-02 09","end":"2020-12-02 10","step":"HOUR"}}
   
   ```
   
   ##### Response
   
   ```
   
{"data":{"cpmS":{"values":[{"id":"2020120209_9_10","value":0},{"id":"2020120210_9_10","value":0}]}}}
   
   ```
   
   ## step by day
   
   ##### Variables
   
   ```
   {"duration":{"start":"2020-12-01","end":"2020-12-02","step":"DAY"}}
   
   ```
   
   ##### Response
   
   ```
   
{"data":{"cpmS":{"values":[{"id":"20201201_9_10","value":0},{"id":"20201202_9_10","value":0}]}}}
   
   ```
   
   
   ## the data store in the es
   
   ```
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"202012020935_9_10","_score":5.6863337,"_source":{"total":8,"time_bucket":202012020935,"entity_id":"9_10","value":8}},
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"202012020936_9_10","_score":5.6863337,"_source":{"total":3,"time_bucket":202012020936,"entity_id":"9_10","value":3}},
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"20201202_9_10","_score":5.6863337,"_source":{"total":30,"time_bucket":20201202,"entity_id":"9_10","value":0}},
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"202012020931_9_10","_score":5.6863337,"_source":{"total":3,"time_bucket":202012020931,"entity_id":"9_10","value":3}},
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"202012020932_9_10","_score":5.6863337,"_source":{"total":3,"time_bucket":202012020932,"entity_id":"9_10","value":3}},
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"202012020933_9_10","_score":5.6863337,"_source":{"total":7,"time_bucket":202012020933,"entity_id":"9_10","value":7}},
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"202012020934_9_10","_score":5.6863337,"_source":{"total":2,"time_bucket":202012020934,"entity_id":"9_10","value":2}},
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"202012020930_9_10","_score":3.5491176,"_source":{"total":5,"time_bucket":202012020930,"entity_id":"9_10","value":5}},
   
{"_index":"service_relation_server_cpm-20201202","_type":"_doc","_id":"2020120209_9_10","_score":3.5491176,"_source":{"total":30,"time_bucket":2020120209,"entity_id":"9_10","value":0}},
   
   ```
   
   there are two problems i am confused
   
   1. the ```value``` field of item ```_id: 20201202_9_10``` and ```_id: 
2020120209_9_10``` is ```0```.
   
   1. the ```total``` field of item ```_id: 20201202_9_10``` and ```_id: 
2020120209_9_10``` is ```30``` , which is not equals ```8 + 3 + 3 + 3 + 7+ 2 + 
5 = 31 ```
   
   
   Please winder me if I am wrong, and point me the right way to get 
```service_relation_server_cpm``` metric by ```HOUR``` and ```DAY```
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to