weixiang1862 opened a new issue, #11029:
URL: https://github.com/apache/skywalking/issues/11029

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no 
similar feature requirement.
   
   
   ### Description
   
   I was working on mongodb-monitoring recently:
   |MongoDB|skywalking|
   |-----------|------------|
   |cluster|service|
   |Node|Instance|
   |ReplSet|Endpoint|
   
   The targets in otel-collector is every node in cluster:
   ```
   scrape_configs:
       - job_name: 'mongodb-monitoring'
         static_configs:
         - targets: ['localhost:19216',''localhost:29216'',''localhost:39216'']
            labels:
                cluster: test-cluster
   ```
   The /metric endpoint provide connection metrics:
   ```
   mongodb_ss_connections{conn_type="current"} 10
   ```
   I want to monitoring `connection` in cluster dimension, the mal is defined 
like this:
   ```
   - name: connections
      exp: mongodb_ss_connections.tagEqual('conn_type', 
'current').sum(['cluster'])
   ```
   I excepted cluster connection metric aggregated like this:
   ```
   mongodb_ss_connections{conn_type="current", 
service_instance_id="localhost:19216"} 10
   mongodb_ss_connections{conn_type="current", 
service_instance_id="localhost:29216"} 10   --sum(['cluster'])-->  30  --avg--> 
30
   mongodb_ss_connections{conn_type="current", 
service_instance_id="localhost:39216"} 10
   ```
   But the rea like this, because mal aggregate metric by every target: 
   ```
   mongodb_ss_connections{conn_type="current", 
service_instance_id="localhost:19216"} 10   --sum(['cluster'])-->  10
   mongodb_ss_connections{conn_type="current", 
service_instance_id="localhost:29216"} 10   --sum(['cluster'])-->  10   
--avg--> 10
   mongodb_ss_connections{conn_type="current", 
service_instance_id="localhost:39216"} 10   --sum(['cluster'])-->  10
   ```
   So I change the mal to this, store every node connections in labeld value:
   ```
   - name: connections
      exp: mongodb_ss_connections.tagEqual('conn_type', 
'current').sum(['cluster','service_instance_id'])
   ```
   Now I have connection sum of every node in labelvalue mode:
   ```
   localhost:19216,10|localhost:29216,10|localhost:39216,10
   ```
   I want the labeled value cant be query like this:
   ```
   localhost:19216,10|localhost:29216,10|localhost:39216,10  --> 30
   ```
   There are two place we could modify to support above:
   **1.MQE**
   ```
   # reducingDimension is a function cal labeldvalue in sum alg and turned 
labeledvalue to value
   reducingDimension(mongodb_cluster_connections, SUM)
   ```
   **2.graphQL readLabeledMetricsValues**
   ```
   # add a parameter ReducingDimensionAlg in readLabeledMetricsValues method
   readLabeledMetricsValues(MetricsCondition condition,List<String> 
labels,ReducingDimensionAlg alg,Duration duration) 
   ```
   
   
   ### Use case
   
   _No response_
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to