Search in sources :

Example 6 with MetricsSnapshotInterface

use of org.pentaho.di.core.metrics.MetricsSnapshotInterface in project pentaho-kettle by pentaho.

the class MetricsIT method testTransformation.

@Test
public void testTransformation() throws Exception {
    TransMeta transMeta = new TransMeta("src/it/resources/metrics/simple-test.ktr");
    transMeta.setGatheringMetrics(true);
    Trans trans = new Trans(transMeta);
    trans.setGatheringMetrics(true);
    trans.execute(null);
    trans.waitUntilFinished();
    LogChannelInterface log = trans.getLogChannel();
    Queue<MetricsSnapshotInterface> snapshotList = MetricsRegistry.getInstance().getSnapshotList(log.getLogChannelId());
    assertTrue(snapshotList.size() >= 4);
    List<MetricsDuration> durationList = MetricsUtil.getDuration(log.getLogChannelId(), Metrics.METRIC_TRANSFORMATION_EXECUTION_START);
    assertEquals(1, durationList.size());
    MetricsDuration duration = durationList.get(0);
    assertTrue(duration.getDuration() >= 20 && duration.getDuration() <= 5000);
    assertEquals(Long.valueOf(1L), duration.getCount());
// Get all durations...
// 
// durationList = MetricsUtil.getDurations(trans.getLogChannelId());
}
Also used : MetricsSnapshotInterface(org.pentaho.di.core.metrics.MetricsSnapshotInterface) TransMeta(org.pentaho.di.trans.TransMeta) Trans(org.pentaho.di.trans.Trans) MetricsDuration(org.pentaho.di.core.metrics.MetricsDuration) Test(org.junit.Test)

Aggregations

MetricsSnapshotInterface (org.pentaho.di.core.metrics.MetricsSnapshotInterface)6 Test (org.junit.Test)3 MetricsDuration (org.pentaho.di.core.metrics.MetricsDuration)3 Date (java.util.Date)2 Trans (org.pentaho.di.trans.Trans)2 TransMeta (org.pentaho.di.trans.TransMeta)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)1 Database (org.pentaho.di.core.database.Database)1 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)1 KettleException (org.pentaho.di.core.exception.KettleException)1 KettleFileException (org.pentaho.di.core.exception.KettleFileException)1 KettleTransException (org.pentaho.di.core.exception.KettleTransException)1 KettleValueException (org.pentaho.di.core.exception.KettleValueException)1 LoggingMetric (org.pentaho.di.core.logging.LoggingMetric)1 MetricsLogTable (org.pentaho.di.core.logging.MetricsLogTable)1 MetricsSnapshot (org.pentaho.di.core.metrics.MetricsSnapshot)1 DuplicateParamException (org.pentaho.di.core.parameters.DuplicateParamException)1 UnknownParamException (org.pentaho.di.core.parameters.UnknownParamException)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1