wankai123 commented on issue #9472:
URL: https://github.com/apache/skywalking/issues/9472#issuecomment-1220382753
>`pg_locks_count.tag({tags -> tags.mode = tags.datname +
tags.mode}).sum(['mode' , 'server'])`
This expression should be correct, I have tried it in
https://github.com/apache/skywalking/blob/master/oap-server/analyzer/meter-analyzer/src/test/java/org/apache/skywalking/oap/meter/analyzer/dsl/AggregationTest.java.
``` java
{
"sum-by",
of("http_success_request", SampleFamilyBuilder.newBuilder(
Sample.builder().labels(of("idc",
"t1")).value(50).name("http_success_request").build(),
Sample.builder().labels(of("idc", "t3", "region", "cn",
"svc", "catalog")).value(50).name("http_success_request").build(),
Sample.builder().labels(of("idc", "t1", "region", "us",
"svc", "product")).value(50).name("http_success_request").build(),
Sample.builder().labels(of("idc", "t1", "region", "us",
"instance", "10.0.0.1")).name("http_success_request").value(50).build(),
Sample.builder().labels(of("idc", "t3", "region", "cn",
"instance", "10.0.0.1")).name("http_success_request").value(3).build()
).build()),
"http_success_request.tag({tags -> tags.idc = tags.idc +
tags.region }).sum(['region', 'idc'])",
Result.success(SampleFamilyBuilder.newBuilder(
Sample.builder().labels(of("idc", "t1", "region",
"")).value(50).name("http_success_request").build(),
Sample.builder().labels(of("idc", "t1", "region",
"us")).value(100).name("http_success_request").build(),
Sample.builder().labels(of("idc", "t3", "region",
"cn")).value(53).name("http_success_request").build()
).build()),
false,
}
```
the result is
```
<Result(success=true, isThrowable=false, error=null,
data=SampleFamily(samples=[Sample(name=http_success_request, labels={region=us,
idc=t1us}, value=100.0, timestamp=0), Sample(name=http_success_request,
labels={region=, idc=t1null}, value=50.0, timestamp=0),
Sample(name=http_success_request, labels={region=cn, idc=t3cn}, value=53.0,
timestamp=0)], context=SampleFamily.RunningContext(meterSamples=null,
histogramType=CUMULATIVE, defaultHistogramBucketUnit=SECONDS)))>
```
you could try it by yourself.
I think if the OAP receives nothing, you might need to check the other place.
--
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]