当前位置: 首页>>代码示例>>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;未经允许,请勿转载。