Search in sources :

Example 1 with AgentCustomMetricSnapshotBatch

use of com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch in project pinpoint by naver.

the class GrpcStatMessageConverter method toMessage.

@Override
public GeneratedMessageV3 toMessage(MetricType message) {
    if (message instanceof AgentStatMetricSnapshotBatch) {
        final AgentStatMetricSnapshotBatch agentStatMetricSnapshotBatch = (AgentStatMetricSnapshotBatch) message;
        final PAgentStatBatch.Builder agentStatBatchBuilder = PAgentStatBatch.newBuilder();
        // Skip agentId, startTimestamp
        for (AgentStatMetricSnapshot agentStatMetricSnapshot : agentStatMetricSnapshotBatch.getAgentStats()) {
            final PAgentStat agentStat = converAgentStat(agentStatMetricSnapshot);
            agentStatBatchBuilder.addAgentStat(agentStat);
        }
        return agentStatBatchBuilder.build();
    } else if (message instanceof AgentStatMetricSnapshot) {
        final AgentStatMetricSnapshot agentStatMetricSnapshot = (AgentStatMetricSnapshot) message;
        final PAgentStat agentStat = converAgentStat(agentStatMetricSnapshot);
        return agentStat;
    } else if (message instanceof AgentCustomMetricSnapshotBatch) {
        final AgentCustomMetricSnapshotBatch agentCustomMetricSnapshotBatch = (AgentCustomMetricSnapshotBatch) message;
        final PCustomMetricMessage pCustomMetricMessage = customMetricMessageConverter.toMessage(agentCustomMetricSnapshotBatch);
        return pCustomMetricMessage;
    } else if (message instanceof AgentUriStatData) {
        final AgentUriStatData agentUriStatData = (AgentUriStatData) message;
        final PAgentUriStat agentUriStat = uriStatMessageConverter.toMessage(agentUriStatData);
        return agentUriStat;
    }
    return null;
}
Also used : AgentStatMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshot) PAgentStatBatch(com.navercorp.pinpoint.grpc.trace.PAgentStatBatch) AgentUriStatData(com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData) PAgentStat(com.navercorp.pinpoint.grpc.trace.PAgentStat) PCustomMetricMessage(com.navercorp.pinpoint.grpc.trace.PCustomMetricMessage) PAgentUriStat(com.navercorp.pinpoint.grpc.trace.PAgentUriStat) AgentStatMetricSnapshotBatch(com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshotBatch) AgentCustomMetricSnapshotBatch(com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch)

Example 2 with AgentCustomMetricSnapshotBatch

use of com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch in project pinpoint by naver.

the class CustomMetricCollectingJob method send.

private void send() {
    final AgentCustomMetricSnapshotBatch agentCustomMetricSnapshotBatch = new AgentCustomMetricSnapshotBatch(agentCustomMetricSnapshotList);
    logger.trace("collect agentCustomMetric:{}", agentCustomMetricSnapshotBatch);
    dataSender.send(agentCustomMetricSnapshotBatch);
    this.agentCustomMetricSnapshotList = new ArrayList<AgentCustomMetricSnapshot>(numCollectionsPerBatch);
}
Also used : AgentCustomMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshot) AgentCustomMetricSnapshotBatch(com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch)

Example 3 with AgentCustomMetricSnapshotBatch

use of com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch in project pinpoint by naver.

the class GrpcCustomMetricMessageConverter method toMessage.

@Override
public PCustomMetricMessage toMessage(MetricType message) {
    Objects.requireNonNull(message, "message");
    if (message instanceof AgentCustomMetricSnapshotBatch) {
        AgentCustomMetricSnapshotBatch agentCustomMetricSnapshotBatch = (AgentCustomMetricSnapshotBatch) message;
        List<AgentCustomMetricSnapshot> agentCustomMetricSnapshotList = agentCustomMetricSnapshotBatch.getAgentCustomMetricSnapshotList();
        Set<String> metricNameSet = new HashSet<>();
        for (AgentCustomMetricSnapshot agentCustomMetricSnapshot : agentCustomMetricSnapshotList) {
            metricNameSet.addAll(agentCustomMetricSnapshot.getMetricNameSet());
        }
        PCustomMetricMessage.Builder builder = PCustomMetricMessage.newBuilder();
        for (int i = 0; i < agentCustomMetricSnapshotList.size(); i++) {
            AgentCustomMetricSnapshot agentCustomMetricSnapshot = agentCustomMetricSnapshotList.get(i);
            builder.addTimestamp(agentCustomMetricSnapshot.getTimestamp());
            builder.addCollectInterval(agentCustomMetricSnapshot.getCollectInterval());
        }
        for (String metricName : metricNameSet) {
            PCustomMetric pCustomMetric = create(metricName, agentCustomMetricSnapshotList);
            if (pCustomMetric != null) {
                builder.addCustomMetrics(pCustomMetric);
            }
        }
        return builder.build();
    } else {
        throw new IllegalArgumentException("Not supported Object. clazz:" + message.getClass());
    }
}
Also used : AgentCustomMetricSnapshot(com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshot) PCustomMetricMessage(com.navercorp.pinpoint.grpc.trace.PCustomMetricMessage) PCustomMetric(com.navercorp.pinpoint.grpc.trace.PCustomMetric) AgentCustomMetricSnapshotBatch(com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch) HashSet(java.util.HashSet)

Aggregations

AgentCustomMetricSnapshotBatch (com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshotBatch)3 PCustomMetricMessage (com.navercorp.pinpoint.grpc.trace.PCustomMetricMessage)2 AgentCustomMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.AgentCustomMetricSnapshot)2 PAgentStat (com.navercorp.pinpoint.grpc.trace.PAgentStat)1 PAgentStatBatch (com.navercorp.pinpoint.grpc.trace.PAgentStatBatch)1 PAgentUriStat (com.navercorp.pinpoint.grpc.trace.PAgentUriStat)1 PCustomMetric (com.navercorp.pinpoint.grpc.trace.PCustomMetric)1 AgentStatMetricSnapshot (com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshot)1 AgentStatMetricSnapshotBatch (com.navercorp.pinpoint.profiler.monitor.metric.AgentStatMetricSnapshotBatch)1 AgentUriStatData (com.navercorp.pinpoint.profiler.monitor.metric.uri.AgentUriStatData)1 HashSet (java.util.HashSet)1