Exemplo n.º 1
0
  // FIXME (2014.08) Legacy support for TAgentStat Thrift DTO stored directly into hbase.
  private List<AgentStat> readAgentStatThriftDto(byte[] tAgentStatByteArray) throws TException {
    // CompactProtocol used
    TDeserializer deserializer = new TDeserializer(factory);
    TAgentStat tAgentStat = new TAgentStat();
    deserializer.deserialize(tAgentStat, tAgentStatByteArray);
    TJvmGc gc = tAgentStat.getGc();
    if (gc == null) {
      return Collections.emptyList();
    }
    AgentStatMemoryGcBo.Builder memoryGcBoBuilder =
        new AgentStatMemoryGcBo.Builder(
            tAgentStat.getAgentId(), tAgentStat.getStartTimestamp(), tAgentStat.getTimestamp());
    memoryGcBoBuilder.gcType(gc.getType().name());
    memoryGcBoBuilder.jvmMemoryHeapUsed(gc.getJvmMemoryHeapUsed());
    memoryGcBoBuilder.jvmMemoryHeapMax(gc.getJvmMemoryHeapMax());
    memoryGcBoBuilder.jvmMemoryNonHeapUsed(gc.getJvmMemoryNonHeapUsed());
    memoryGcBoBuilder.jvmMemoryNonHeapMax(gc.getJvmMemoryNonHeapMax());
    memoryGcBoBuilder.jvmGcOldCount(gc.getJvmGcOldCount());
    memoryGcBoBuilder.jvmGcOldTime(gc.getJvmGcOldTime());

    AgentStat agentStat = new AgentStat();
    agentStat.setMemoryGc(memoryGcBoBuilder.build());

    List<AgentStat> result = new ArrayList<AgentStat>(1);
    result.add(agentStat);
    return result;
  }
Exemplo n.º 2
0
  @Override
  public TJvmGc collect() {

    final TJvmGc gc = new TJvmGc();
    gc.setType(GC_TYPE);
    gc.setJvmMemoryHeapMax(heapMax.getValue());
    gc.setJvmMemoryHeapUsed(heapUsed.getValue());

    gc.setJvmMemoryNonHeapMax(heapNonHeapMax.getValue());
    gc.setJvmMemoryNonHeapUsed(heapNonHeapUsed.getValue());

    gc.setJvmGcOldCount(gcCount.getValue());
    gc.setJvmGcOldTime(gcTime.getValue());
    return gc;
  }