use of org.apache.servicecomb.core.metrics.InvocationStartExecutionEvent in project incubator-servicecomb-java-chassis by apache.
the class TestMonitorManager method setup.
@BeforeClass
public static void setup() throws InterruptedException {
System.getProperties().setProperty(MetricsConfig.METRICS_WINDOW_TIME, "2000");
// ==========================================================================
// fun1 is a PRODUCER invocation call 2 time and all is completed
// two time success
EventBus.getInstance().triggerEvent(new InvocationStartedEvent("fun1", InvocationType.PRODUCER, System.nanoTime()));
EventBus.getInstance().triggerEvent(new InvocationStartExecutionEvent("fun1"));
EventBus.getInstance().triggerEvent(new InvocationFinishedEvent("fun1", InvocationType.PRODUCER, TimeUnit.MILLISECONDS.toNanos(100), TimeUnit.MILLISECONDS.toNanos(200), TimeUnit.MILLISECONDS.toNanos(300), 200));
EventBus.getInstance().triggerEvent(new InvocationStartedEvent("fun1", InvocationType.PRODUCER, System.nanoTime()));
EventBus.getInstance().triggerEvent(new InvocationStartExecutionEvent("fun1"));
EventBus.getInstance().triggerEvent(new InvocationFinishedEvent("fun1", InvocationType.PRODUCER, TimeUnit.MILLISECONDS.toNanos(300), TimeUnit.MILLISECONDS.toNanos(400), TimeUnit.MILLISECONDS.toNanos(700), 200));
EventBus.getInstance().triggerEvent(new InvocationStartedEvent("fun1", InvocationType.PRODUCER, System.nanoTime()));
EventBus.getInstance().triggerEvent(new InvocationStartExecutionEvent("fun1"));
EventBus.getInstance().triggerEvent(new InvocationFinishedEvent("fun1", InvocationType.PRODUCER, TimeUnit.MILLISECONDS.toNanos(300), TimeUnit.MILLISECONDS.toNanos(400), TimeUnit.MILLISECONDS.toNanos(700), 500));
// ==========================================================================
// fun2 is a CONSUMER invocation call once and completed
EventBus.getInstance().triggerEvent(new InvocationFinishedEvent("fun2", InvocationType.CONSUMER, 0, 0, TimeUnit.MILLISECONDS.toNanos(300), 200));
// ==========================================================================
// fun3 is a PRODUCER invocation call uncompleted
EventBus.getInstance().triggerEvent(new InvocationStartedEvent("fun3", InvocationType.PRODUCER, System.nanoTime()));
EventBus.getInstance().triggerEvent(new InvocationStartExecutionEvent("fun3"));
// ==========================================================================
// fun4 is a PRODUCER call only started and no processing start and finished
EventBus.getInstance().triggerEvent(new InvocationStartedEvent("fun4", InvocationType.PRODUCER, System.nanoTime()));
Map<String, Double> metrics = MonitorManager.getInstance().measure();
currentWindowMetricsLoader = new MetricsLoader(metrics);
// sim at lease one window time
Thread.sleep(2000);
metrics = MonitorManager.getInstance().measure();
nextWindowMetricsLoader = new MetricsLoader(metrics);
}
use of org.apache.servicecomb.core.metrics.InvocationStartExecutionEvent in project incubator-servicecomb-java-chassis by apache.
the class Invocation method triggerStartExecutionEvent.
private void triggerStartExecutionEvent() {
if (InvocationType.PRODUCER.equals(invocationType)) {
this.startExecutionTime = System.nanoTime();
EventBus.getInstance().triggerEvent(new InvocationStartExecutionEvent(operationMeta.getMicroserviceQualifiedName()));
}
}
Aggregations