當前位置: 首頁>>代碼示例>>Java>>正文


Java MetricsSnapshotInterface類代碼示例

本文整理匯總了Java中org.pentaho.di.core.metrics.MetricsSnapshotInterface的典型用法代碼示例。如果您正苦於以下問題:Java MetricsSnapshotInterface類的具體用法?Java MetricsSnapshotInterface怎麽用?Java MetricsSnapshotInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MetricsSnapshotInterface類屬於org.pentaho.di.core.metrics包,在下文中一共展示了MetricsSnapshotInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testBasics

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
public void testBasics() throws Exception {
  LogChannel log = new LogChannel("BASICS");
  log.setGatheringMetrics(true);
  
  log.snap(METRIC_START);
  Thread.sleep(50);
  log.snap(METRIC_STOP);
  
  Deque<MetricsSnapshotInterface> snapshotList = MetricsRegistry.getInstance().getSnapshotList(log.getLogChannelId());
  assertEquals(2, snapshotList.size());
  
  List<MetricsDuration> durationList = MetricsUtil.getDuration(log.getLogChannelId(), METRIC_START);
  assertEquals(1, durationList.size());
  
  MetricsDuration duration = durationList.get(0);
  assertTrue(duration.getDuration()>=50 && duration.getDuration()<=100);
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:18,代碼來源:MetricsTest.java

示例2: testTransformation

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
public void testTransformation() throws Exception {
  
  TransMeta transMeta = new TransMeta("testfiles/metrics/simple-test.ktr");
  Trans trans = new Trans(transMeta);
  trans.setGatheringMetrics(true);
  trans.execute(null);
  trans.waitUntilFinished();
  
  LogChannelInterface log = trans.getLogChannel();
  
  Deque<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(log.getLogChannelId());
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:24,代碼來源:MetricsTest.java

示例3: addSnapshot

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
public void addSnapshot(LogChannelInterface logChannel, MetricsSnapshotInterface snapshot) {
  MetricsInterface metric = snapshot.getMetric();
  String channelId = logChannel.getLogChannelId();
  switch(metric.getType()) {
  case START:
  case STOP:
    {
      Deque<MetricsSnapshotInterface> list = getSnapshotList(channelId);
      list.add(snapshot);
    }
    break;
  case MIN:
  case MAX:
  case SUM:
  case COUNT:
    {
      Map<String, MetricsSnapshotInterface> map = getSnapshotMap(channelId);
      map.put(snapshot.getKey(), snapshot);
    }
    break;
  }
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:23,代碼來源:MetricsRegistry.java

示例4: testBasics

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
@Test
public void testBasics() throws Exception {
  LogChannel log = new LogChannel( "BASICS" );
  log.setGatheringMetrics( true );

  log.snap( METRIC_START );
  Thread.sleep( 50 );
  log.snap( METRIC_STOP );

  Queue<MetricsSnapshotInterface> snapshotList =
    MetricsRegistry.getInstance().getSnapshotList( log.getLogChannelId() );
  assertEquals( 2, snapshotList.size() );

  List<MetricsDuration> durationList = MetricsUtil.getDuration( log.getLogChannelId(), METRIC_START );
  assertEquals( 1, durationList.size() );

  MetricsDuration duration = durationList.get( 0 );
  assertTrue( duration.getDuration() >= 50 && duration.getDuration() <= 100 );
}
 
開發者ID:pentaho,項目名稱:pentaho-kettle,代碼行數:20,代碼來源:MetricsIT.java

示例5: addSnapshot

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
public void addSnapshot( LogChannelInterface logChannel, MetricsSnapshotInterface snapshot ) {
  MetricsInterface metric = snapshot.getMetric();
  String channelId = logChannel.getLogChannelId();
  switch ( metric.getType() ) {
    case START:
    case STOP:
      Queue<MetricsSnapshotInterface> list = getSnapshotList( channelId );
      list.add( snapshot );

      break;
    case MIN:
    case MAX:
    case SUM:
    case COUNT:
      Map<String, MetricsSnapshotInterface> map = getSnapshotMap( channelId );
      map.put( snapshot.getKey(), snapshot );

      break;
    default:
      break;
  }
}
 
開發者ID:pentaho,項目名稱:pentaho-kettle,代碼行數:23,代碼來源:MetricsRegistry.java

示例6: getLogRecord

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
/**
 * This method calculates all the values that are required
 * @param id the id to use or -1 if no id is needed
 * @param status the log status to use
 */
public RowMetaAndData getLogRecord(LogStatus status, Object subject, Object parent) {
  if (subject==null || subject instanceof LoggingMetric) {

    LoggingMetric loggingMetric = (LoggingMetric) subject;
    MetricsSnapshotInterface snapshot = null;
    if (subject!=null) snapshot = loggingMetric.getSnapshot();
    
    RowMetaAndData row = new RowMetaAndData();
    
    for (LogTableField field : fields) {
      if (field.isEnabled()) {
        Object value = null;
        if (subject!=null) {
          switch(ID.valueOf(field.getId())){
          case ID_BATCH : value = new Long(loggingMetric.getBatchId()); break;
          case CHANNEL_ID : value = snapshot.getLogChannelId(); break;
          case LOG_DATE : value = new Date(); break;
          case METRICS_DATE: value = snapshot.getDate(); break;
          case METRICS_CODE: value = snapshot.getMetric().getCode(); break;
          case METRICS_DESCRIPTION : value = snapshot.getMetric().getDescription(); break;
          case METRICS_SUBJECT: value = snapshot.getSubject(); break;
          case METRICS_TYPE: value = snapshot.getMetric().getType().name(); break;
          case METRICS_VALUE: value = snapshot.getValue(); break;
          }
        }

        row.addValue(field.getFieldName(), field.getDataType(), value);
        row.getRowMeta().getValueMeta(row.size()-1).setLength(field.getLength());
      }
    }
      
    return row;
  } else {
    return null;
  }
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:42,代碼來源:MetricsLogTable.java

示例7: getSnapshotList

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
/**
 * Get the snapshot list for the given log channel ID.
 * If no list is available, one is created (and stored).
 * 
 * @param logChannelId The log channel to use.
 * @return an existing or a new metrics snapshot list.
 */
public Deque<MetricsSnapshotInterface> getSnapshotList(String logChannelId) {
  Deque<MetricsSnapshotInterface> list = snapshotLists.get(logChannelId);
  if (list==null) {
    list = new ArrayDeque<MetricsSnapshotInterface>();
    snapshotLists.put(logChannelId, list);
  }
  return list;
  
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:17,代碼來源:MetricsRegistry.java

示例8: getSnapshotMap

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
/**
 * Get the snapshot map for the given log channel ID.
 * If no map is available, one is created (and stored).
 * 
 * @param logChannelId The log channel to use.
 * @return an existing or a new metrics snapshot map.
 */
public Map<String, MetricsSnapshotInterface> getSnapshotMap(String logChannelId) {
  Map<String, MetricsSnapshotInterface> map = snapshotMaps.get(logChannelId);
  if (map==null) {
    map = Collections.synchronizedMap(new HashMap<String, MetricsSnapshotInterface>());
    snapshotMaps.put(logChannelId, map);
  }
  return map;
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:16,代碼來源:MetricsRegistry.java

示例9: testTransformation

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
@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());

}
 
開發者ID:pentaho,項目名稱:pentaho-kettle,代碼行數:29,代碼來源:MetricsIT.java

示例10: getSnapshotList

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
/**
 * Get the snapshot list for the given log channel ID. If no list is available, one is created (and stored).
 *
 * @param logChannelId
 *          The log channel to use.
 * @return an existing or a new metrics snapshot list.
 */
public Queue<MetricsSnapshotInterface> getSnapshotList( String logChannelId ) {
  Queue<MetricsSnapshotInterface> list = snapshotLists.get( logChannelId );
  if ( list == null ) {
    list = new ConcurrentLinkedQueue<MetricsSnapshotInterface>();
    snapshotLists.put( logChannelId, list );
  }
  return list;

}
 
開發者ID:pentaho,項目名稱:pentaho-kettle,代碼行數:17,代碼來源:MetricsRegistry.java

示例11: getSnapshotMap

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
/**
 * Get the snapshot map for the given log channel ID. If no map is available, one is created (and stored).
 *
 * @param logChannelId
 *          The log channel to use.
 * @return an existing or a new metrics snapshot map.
 */
public Map<String, MetricsSnapshotInterface> getSnapshotMap( String logChannelId ) {
  Map<String, MetricsSnapshotInterface> map = snapshotMaps.get( logChannelId );
  if ( map == null ) {
    map = new ConcurrentHashMap<String, MetricsSnapshotInterface>();
    snapshotMaps.put( logChannelId, map );
  }
  return map;
}
 
開發者ID:pentaho,項目名稱:pentaho-kettle,代碼行數:16,代碼來源:MetricsRegistry.java

示例12: LoggingMetric

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
/**
 * @param batchId
 * @param snapshot
 */
public LoggingMetric(long batchId, MetricsSnapshotInterface snapshot) {
  this.batchId = batchId;
  this.snapshot = snapshot;
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:9,代碼來源:LoggingMetric.java

示例13: getSnapshot

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
/**
 * @return the snapshot
 */
public MetricsSnapshotInterface getSnapshot() {
  return snapshot;
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:7,代碼來源:LoggingMetric.java

示例14: testDatabaseGetRow

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
public void testDatabaseGetRow() throws Exception {
  
  MetricsRegistry metricsRegistry = MetricsRegistry.getInstance();
  
  TransMeta insertTransMeta = new TransMeta("testfiles/metrics/insert-data.ktr");
  Trans insertTrans = new Trans(insertTransMeta);
  insertTrans.setGatheringMetrics(true);
  insertTrans.execute(null);
  insertTrans.waitUntilFinished();
  
  LogChannelInterface log = insertTrans.getLogChannel();
  Deque<MetricsSnapshotInterface> snapshotList = metricsRegistry.getSnapshotList(log.getLogChannelId());
  assertTrue(snapshotList.size()>=4);
  

  TransMeta readTransMeta = new TransMeta("testfiles/metrics/read-data.ktr");
  Trans readTrans = new Trans(readTransMeta);
  readTrans.setGatheringMetrics(true);
  readTrans.execute(null);
  readTrans.waitUntilFinished();

  log = readTrans.getLogChannel();
  snapshotList = metricsRegistry.getSnapshotList(log.getLogChannelId());
  assertTrue(snapshotList.size()>=4);

  Long rowCount = MetricsUtil.getResult(Metrics.METRIC_DATABASE_GET_ROW_COUNT);
  assertNotNull(rowCount);
  assertEquals(Long.valueOf(1001), rowCount);
  
  Long sumTime = MetricsUtil.getResult(Metrics.METRIC_DATABASE_GET_ROW_SUM_TIME);
  assertNotNull(sumTime);
  assertTrue(sumTime>0);

  Long minTime = MetricsUtil.getResult(Metrics.METRIC_DATABASE_GET_ROW_MIN_TIME);
  assertNotNull(minTime);
  assertTrue(minTime<sumTime);

  Long maxTime = MetricsUtil.getResult(Metrics.METRIC_DATABASE_GET_ROW_MAX_TIME);
  assertNotNull(maxTime);
  assertTrue(maxTime>=minTime);

}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:43,代碼來源:MetricsTest.java

示例15: MetricsRegistry

import org.pentaho.di.core.metrics.MetricsSnapshotInterface; //導入依賴的package包/類
private MetricsRegistry() {
  snapshotMaps = new HashMap<String, Map<String,MetricsSnapshotInterface>>();
  snapshotLists = new HashMap<String, Deque<MetricsSnapshotInterface>>();
}
 
開發者ID:jjeb,項目名稱:kettle-trunk,代碼行數:5,代碼來源:MetricsRegistry.java


注:本文中的org.pentaho.di.core.metrics.MetricsSnapshotInterface類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。