use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementGroupConfig in project incubator-servicecomb-java-chassis by apache.
the class PublishModelFactory method createMeasurementGroupConfig.
protected MeasurementGroupConfig createMeasurementGroupConfig() {
MeasurementGroupConfig groupConfig = new MeasurementGroupConfig();
groupConfig.addGroup(MeterInvocationConst.INVOCATION_NAME, MeterInvocationConst.TAG_ROLE, MeterInvocationConst.TAG_TRANSPORT, MeterInvocationConst.TAG_OPERATION, MeterInvocationConst.TAG_STATUS, MeterInvocationConst.TAG_STAGE, MeterInvocationConst.TAG_STATISTIC);
return groupConfig;
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementGroupConfig in project java-chassis by ServiceComb.
the class PublishModelFactory method createMeasurementTree.
protected MeasurementTree createMeasurementTree(List<Meter> meters) {
MeasurementGroupConfig groupConfig = createMeasurementGroupConfig();
MeasurementTree tree = new MeasurementTree();
tree.from(meters.iterator(), groupConfig);
return tree;
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementGroupConfig in project incubator-servicecomb-java-chassis by apache.
the class TestDefaultMetricsInitializer method producerInvocation.
@Test
public void producerInvocation(@Mocked InvocationFinishEvent event) {
new Expectations() {
{
invocation.isConsumer();
result = false;
invocation.getInvocationType();
result = InvocationType.PRODUCER;
invocation.getRealTransportName();
result = Const.RESTFUL;
invocation.getMicroserviceQualifiedName();
result = "m.s.o";
invocation.getStartTime();
result = 1;
invocation.getStartExecutionTime();
result = 3;
event.getNanoCurrent();
result = 10;
event.getInvocation();
result = invocation;
}
};
eventBus.post(event);
eventBus.post(event);
MeasurementTree tree = new MeasurementTree();
tree.from(globalRegistry.iterator(), new MeasurementGroupConfig(MeterInvocationConst.INVOCATION_NAME));
Assert.assertEquals("[Measurement(servicecomb.invocation:operation=m.s.o:role=PRODUCER:stage=execution:statistic=count:status=0:transport=rest,0,2.0), " + "Measurement(servicecomb.invocation:operation=m.s.o:role=PRODUCER:stage=execution:statistic=totalTime:status=0:transport=rest,0,14.0), " + "Measurement(servicecomb.invocation:operation=m.s.o:role=PRODUCER:stage=total:statistic=count:status=0:transport=rest,0,2.0), " + "Measurement(servicecomb.invocation:operation=m.s.o:role=PRODUCER:stage=total:statistic=totalTime:status=0:transport=rest,0,18.0), " + "Measurement(servicecomb.invocation:operation=m.s.o:role=PRODUCER:stage=queue:statistic=count:status=0:transport=rest,0,2.0), " + "Measurement(servicecomb.invocation:operation=m.s.o:role=PRODUCER:stage=queue:statistic=totalTime:status=0:transport=rest,0,4.0)]", tree.findChild(MeterInvocationConst.INVOCATION_NAME).getMeasurements().toString());
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementGroupConfig in project incubator-servicecomb-java-chassis by apache.
the class TestDefaultMetricsInitializer method consumerInvocation.
@Test
public void consumerInvocation(@Mocked InvocationFinishEvent event) {
new Expectations() {
{
invocation.isConsumer();
result = true;
invocation.getInvocationType();
result = InvocationType.CONSUMER;
invocation.getRealTransportName();
result = Const.RESTFUL;
invocation.getMicroserviceQualifiedName();
result = "m.s.o";
invocation.getStartTime();
result = 1;
event.getInvocation();
result = invocation;
event.getNanoCurrent();
result = 10;
}
};
eventBus.post(event);
eventBus.post(event);
MeasurementTree tree = new MeasurementTree();
tree.from(globalRegistry.iterator(), new MeasurementGroupConfig(MeterInvocationConst.INVOCATION_NAME));
Assert.assertEquals("[Measurement(servicecomb.invocation:operation=m.s.o:role=CONSUMER:stage=total:statistic=count:status=0:transport=rest,0,2.0), " + "Measurement(servicecomb.invocation:operation=m.s.o:role=CONSUMER:stage=total:statistic=totalTime:status=0:transport=rest,0,18.0)]", tree.findChild(MeterInvocationConst.INVOCATION_NAME).getMeasurements().toString());
}
use of org.apache.servicecomb.foundation.metrics.publish.spectator.MeasurementGroupConfig in project incubator-servicecomb-java-chassis by apache.
the class PublishModelFactory method createMeasurementTree.
protected MeasurementTree createMeasurementTree(List<Meter> meters) {
MeasurementGroupConfig groupConfig = createMeasurementGroupConfig();
MeasurementTree tree = new MeasurementTree();
tree.from(meters.iterator(), groupConfig);
return tree;
}
Aggregations