Search in sources :

Example 1 with AgentStatService

use of com.navercorp.pinpoint.collector.service.AgentStatService in project pinpoint by naver.

the class GrpcAgentUriStatHandlerV2Test method createMockHandler.

private GrpcAgentStatHandlerV2 createMockHandler(AgentUriStatService agentUriStatService, boolean enableUriStat) {
    GrpcAgentStatMapper mockAgentStatMapper = Mockito.mock(GrpcAgentStatMapper.class);
    GrpcAgentStatBatchMapper agentStatBatchMapper = new GrpcAgentStatBatchMapper(mockAgentStatMapper);
    AgentStatService[] agentStatServices = new AgentStatService[0];
    CollectorConfiguration collectorConfiguration = Mockito.mock(CollectorConfiguration.class);
    Mockito.when(collectorConfiguration.isUriStatEnable()).thenReturn(enableUriStat);
    return new GrpcAgentStatHandlerV2(mockAgentStatMapper, agentStatBatchMapper, new GrpcAgentUriStatMapper(), agentStatServices, agentUriStatService, collectorConfiguration);
}
Also used : AgentStatService(com.navercorp.pinpoint.collector.service.AgentStatService) CollectorConfiguration(com.navercorp.pinpoint.collector.config.CollectorConfiguration) GrpcAgentStatBatchMapper(com.navercorp.pinpoint.collector.mapper.grpc.stat.GrpcAgentStatBatchMapper) GrpcAgentUriStatMapper(com.navercorp.pinpoint.collector.mapper.grpc.stat.GrpcAgentUriStatMapper) GrpcAgentStatMapper(com.navercorp.pinpoint.collector.mapper.grpc.stat.GrpcAgentStatMapper)

Example 2 with AgentStatService

use of com.navercorp.pinpoint.collector.service.AgentStatService in project pinpoint by naver.

the class GrpcAgentStatHandlerV2 method handleAgentStatBatch.

private void handleAgentStatBatch(PAgentStatBatch agentStatBatch) {
    if (isDebug) {
        logger.debug("Handle PAgentStatBatch={}", MessageFormatUtils.debugLog(agentStatBatch));
    }
    Header header = ServerContext.getAgentInfo();
    final AgentStatBo agentStatBo = this.agentStatBatchMapper.map(agentStatBatch, header);
    if (agentStatBo == null) {
        return;
    }
    for (AgentStatService agentStatService : agentStatServiceList) {
        try {
            agentStatService.save(agentStatBo);
        } catch (Exception e) {
            logger.warn("Failed to handle service={}, AgentStatBatch={}", agentStatService, MessageFormatUtils.debugLog(agentStatBatch), e);
        }
    }
}
Also used : AgentStatService(com.navercorp.pinpoint.collector.service.AgentStatService) AgentStatBo(com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo) Header(com.navercorp.pinpoint.grpc.Header)

Aggregations

AgentStatService (com.navercorp.pinpoint.collector.service.AgentStatService)2 CollectorConfiguration (com.navercorp.pinpoint.collector.config.CollectorConfiguration)1 GrpcAgentStatBatchMapper (com.navercorp.pinpoint.collector.mapper.grpc.stat.GrpcAgentStatBatchMapper)1 GrpcAgentStatMapper (com.navercorp.pinpoint.collector.mapper.grpc.stat.GrpcAgentStatMapper)1 GrpcAgentUriStatMapper (com.navercorp.pinpoint.collector.mapper.grpc.stat.GrpcAgentUriStatMapper)1 AgentStatBo (com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo)1 Header (com.navercorp.pinpoint.grpc.Header)1