Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#10299] Adding network metric for Pinpoint inspector #10300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions agent/src/main/resources/profiles/local/pinpoint.config
Original file line number Diff line number Diff line change
Expand Up @@ -1374,3 +1374,11 @@ profiler.kotlin.coroutines.record.threadName=false
#This is important information to check whether the developer's intention and the behavior of the coroutine match.
#Recommend that you use it in the development environment and not in the production environment.
profiler.kotlin.coroutines.record.cancel=false

###########################################################
# Network Metric #
###########################################################
profiler.network.metric.enable=false
profiler.network.metric.enable.udpstats=false
profiler.network.metric.enable.tcpstats=false
profiler.network.metric.collect.interval=5000
8 changes: 8 additions & 0 deletions agent/src/main/resources/profiles/release/pinpoint.config
Original file line number Diff line number Diff line change
Expand Up @@ -1399,3 +1399,11 @@ profiler.kotlin.coroutines.record.threadName=false
#This is important information to check whether the developer's intention and the behavior of the coroutine match.
#Recommend that you use it in the development environment and not in the production environment.
profiler.kotlin.coroutines.record.cancel=false

###########################################################
# Network Metric #
###########################################################
profiler.network.metric.enable=false
profiler.network.metric.enable.udpstats=false
profiler.network.metric.enable.tcpstats=false
profiler.network.metric.collect.interval=5000
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.navercorp.pinpoint.grpc.trace.PAgentStat;
import com.navercorp.pinpoint.grpc.trace.PAgentStatBatch;
import com.navercorp.pinpoint.grpc.trace.PAgentUriStat;
import com.navercorp.pinpoint.grpc.trace.PProfilerMetric;
import com.navercorp.pinpoint.io.request.ServerRequest;
import io.grpc.Status;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -73,7 +74,7 @@ public void handleSimple(ServerRequest<GeneratedMessageV3> serverRequest) {
handleAgentStat((PAgentStat) data);
} else if (data instanceof PAgentStatBatch) {
handleAgentStatBatch((PAgentStatBatch) data);
} else if (data instanceof PAgentUriStat) {
} else if ((data instanceof PAgentUriStat) || (data instanceof PProfilerMetric)) {
// do nothing
} else {
logger.warn("Invalid request type. serverRequest={}", serverRequest);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright 2023 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.navercorp.pinpoint.collector.handler.grpc.metric;

import com.google.protobuf.GeneratedMessageV3;
import com.navercorp.pinpoint.collector.handler.grpc.GrpcMetricHandler;
import com.navercorp.pinpoint.collector.mapper.grpc.stat.GrpcAgentProfilerMetricMapper;
import com.navercorp.pinpoint.collector.service.AgentStatService;
import com.navercorp.pinpoint.common.server.bo.stat.ProfilerMetricBo;
import com.navercorp.pinpoint.grpc.MessageFormatUtils;
import com.navercorp.pinpoint.grpc.trace.PProfilerMetric;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;

import java.util.Objects;

@Service
public class AgentProfilerMetricHandler implements GrpcMetricHandler {
private final Logger logger = LogManager.getLogger(this.getClass());

Check warning on line 34 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L34

Added line #L34 was not covered by tests
private final GrpcAgentProfilerMetricMapper agentProfilerMetricMapper;
private final AgentStatService[] agentStatServiceList;

public AgentProfilerMetricHandler(GrpcAgentProfilerMetricMapper agentProfilerMetricMapper,
AgentStatService[] agentStatServiceList) {
this.agentProfilerMetricMapper = Objects.requireNonNull(agentProfilerMetricMapper, "agentProfilerMetricMapper");
this.agentStatServiceList = Objects.requireNonNull(agentStatServiceList, "agentStatServiceList");

Check warning on line 41 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L39-L41

Added lines #L39 - L41 were not covered by tests

for (AgentStatService service : this.agentStatServiceList) {
logger.info("{}:{}", AgentStatService.class.getSimpleName(), service.getClass().getSimpleName());

Check warning on line 44 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L44

Added line #L44 was not covered by tests
}
}

Check warning on line 46 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L46

Added line #L46 was not covered by tests

@Override
public boolean accept(GeneratedMessageV3 message) {
return message instanceof PProfilerMetric;

Check warning on line 50 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L50

Added line #L50 was not covered by tests
}

@Override
public void handle(GeneratedMessageV3 message) {
if (logger.isDebugEnabled()) {
logger.debug("Handle PProfilerMetric={}", MessageFormatUtils.debugLog(message));

Check warning on line 56 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L56

Added line #L56 was not covered by tests
}

final PProfilerMetric profilerMetric = (PProfilerMetric) message;
final ProfilerMetricBo profilerMetricBo = this.agentProfilerMetricMapper.map(profilerMetric);

Check warning on line 60 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L59-L60

Added lines #L59 - L60 were not covered by tests
if (profilerMetricBo == null) {
return;

Check warning on line 62 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L62

Added line #L62 was not covered by tests
}

handleProfilerMetric(profilerMetricBo);
}

Check warning on line 66 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L65-L66

Added lines #L65 - L66 were not covered by tests

private void handleProfilerMetric(ProfilerMetricBo profilerMetricBo) {
for (AgentStatService agentStatService : agentStatServiceList) {
try {
agentStatService.save(profilerMetricBo);
} catch (Exception e) {
logger.warn("Failed to handle service={}, AgentStatBo={}", agentStatService, profilerMetricBo, e);
}

Check warning on line 74 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L71-L74

Added lines #L71 - L74 were not covered by tests
}
}

Check warning on line 76 in collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/handler/grpc/metric/AgentProfilerMetricHandler.java#L76

Added line #L76 was not covered by tests
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright 2023 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.collector.mapper.grpc.stat;

import com.navercorp.pinpoint.common.server.bo.stat.ProfilerMetricBo;
import com.navercorp.pinpoint.grpc.Header;
import com.navercorp.pinpoint.grpc.server.ServerContext;
import com.navercorp.pinpoint.grpc.trace.PProfilerMetric;
import com.navercorp.pinpoint.grpc.trace.PProfilerMetricField;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class GrpcAgentProfilerMetricMapper {

Check warning on line 28 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L28

Added line #L28 was not covered by tests

public ProfilerMetricBo map(PProfilerMetric profilerMetric) {
if (profilerMetric == null) {
return null;

Check warning on line 32 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L32

Added line #L32 was not covered by tests
}

final Header agentInfo = ServerContext.getAgentInfo();
final String agentId = agentInfo.getAgentId();
final long startTimestamp = agentInfo.getAgentStartTime();

Check warning on line 37 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L35-L37

Added lines #L35 - L37 were not covered by tests

final ProfilerMetricBo profilerMetricBo = new ProfilerMetricBo();
profilerMetricBo.setAgentId(agentId);
profilerMetricBo.setStartTimestamp(startTimestamp);
profilerMetricBo.setTimestamp(profilerMetric.getTimestamp());
profilerMetricBo.setMetricName(profilerMetric.getName());

Check warning on line 43 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L39-L43

Added lines #L39 - L43 were not covered by tests

List<PProfilerMetricField> tags = profilerMetric.getTagsList();

Check warning on line 45 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L45

Added line #L45 was not covered by tests
for (PProfilerMetricField tag : tags) {
profilerMetricBo.addTags(tag.getName(), tag.getStringValue());
}

Check warning on line 48 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L47-L48

Added lines #L47 - L48 were not covered by tests

List<PProfilerMetricField> fields = profilerMetric.getFieldsList();

Check warning on line 50 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L50

Added line #L50 was not covered by tests
for (PProfilerMetricField field : fields) {
profilerMetricBo.addValues(field.getName(), field.getLongValue());
}

Check warning on line 53 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L52-L53

Added lines #L52 - L53 were not covered by tests

return profilerMetricBo;

Check warning on line 55 in collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/mapper/grpc/stat/GrpcAgentProfilerMetricMapper.java#L55

Added line #L55 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private SimpleHandler<REQ> getSimpleHandler(Header header) {
// To change below code to switch table make it a little bit faster.
// FIXME (2014.08) Legacy - TAgentStats should not be sent over the wire.
final short type = header.getType();
if (type == DefaultTBaseLocator.AGENT_STAT || type == DefaultTBaseLocator.AGENT_STAT_BATCH || type == DefaultTBaseLocator.AGENT_URI_STAT) {
if (type == DefaultTBaseLocator.AGENT_STAT || type == DefaultTBaseLocator.AGENT_STAT_BATCH || type == DefaultTBaseLocator.AGENT_URI_STAT || type == DefaultTBaseLocator.AGENT_PROFILER_STAT) {
return new SimpleDualHandler<>(agentStatHandler, agentEventHandler);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.navercorp.pinpoint.grpc.trace.PAgentStatBatch;
import com.navercorp.pinpoint.grpc.trace.PAgentUriStat;
import com.navercorp.pinpoint.grpc.trace.PStatMessage;
import com.navercorp.pinpoint.grpc.trace.PProfilerMetric;
import com.navercorp.pinpoint.grpc.trace.StatGrpc;
import com.navercorp.pinpoint.io.header.Header;
import com.navercorp.pinpoint.io.header.HeaderEntity;
Expand Down Expand Up @@ -79,6 +80,9 @@
} else if (statMessage.hasAgentUriStat()) {
final Message<PAgentUriStat> message = newMessage(statMessage.getAgentUriStat(), DefaultTBaseLocator.AGENT_URI_STAT);
send(message, responseObserver);
} else if (statMessage.hasProfilerMetric()) {
final Message<PProfilerMetric> message = newMessage(statMessage.getProfilerMetric(), DefaultTBaseLocator.AGENT_PROFILER_STAT);
send(message, responseObserver);

Check warning on line 85 in collector/src/main/java/com/navercorp/pinpoint/collector/receiver/grpc/service/StatService.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/receiver/grpc/service/StatService.java#L84-L85

Added lines #L84 - L85 were not covered by tests
} else {
if (isDebug) {
logger.debug("Found empty stat message {}", MessageFormatUtils.debugLog(statMessage));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.navercorp.pinpoint.collector.service;

import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo;
import com.navercorp.pinpoint.common.server.bo.stat.ProfilerMetricBo;

import javax.validation.Valid;

Expand All @@ -24,4 +25,6 @@
*/
public interface AgentStatService {
void save(@Valid AgentStatBo agentStatBo);

void save(@Valid ProfilerMetricBo profilerMetricBo);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import com.navercorp.pinpoint.collector.dao.AgentStatDao;
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo;
import com.navercorp.pinpoint.common.server.bo.stat.ProfilerMetricBo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -55,4 +56,9 @@
}
}

@Override
public void save(ProfilerMetricBo profilerMetricBo) {
// Does nothing
}

Check warning on line 62 in collector/src/main/java/com/navercorp/pinpoint/collector/service/HBaseAgentStatService.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/service/HBaseAgentStatService.java#L62

Added line #L62 was not covered by tests

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.navercorp.pinpoint.collector.config.FlinkProperties;
import com.navercorp.pinpoint.collector.mapper.flink.TFAgentStatBatchMapper;
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo;
import com.navercorp.pinpoint.common.server.bo.stat.ProfilerMetricBo;
import com.navercorp.pinpoint.thrift.dto.flink.TFAgentStatBatch;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -51,4 +52,9 @@
TFAgentStatBatch tFAgentStatBatch = tFAgentStatBatchMapper.map(agentStatBo);
flinkService.sendData(tFAgentStatBatch);
}

@Override
public void save(ProfilerMetricBo profilerMetricBo) {
// does nothing
}

Check warning on line 59 in collector/src/main/java/com/navercorp/pinpoint/collector/service/SendAgentStatService.java

View check run for this annotation

Codecov / codecov/patch

collector/src/main/java/com/navercorp/pinpoint/collector/service/SendAgentStatService.java#L59

Added line #L59 was not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public enum AgentStatType {
FILE_DESCRIPTOR((byte) 9, "FileDescriptor", "fileDescriptor"),
DIRECT_BUFFER((byte) 10, "DirectBuffer", "directBuffer"),
TOTAL_THREAD((byte) 11, "Total Thread Count", "totalThreadCount"),
LOADED_CLASS((byte) 12, "Loaded Class", "loadedClass");
LOADED_CLASS((byte) 12, "Loaded Class", "loadedClass"),
PROFILER_METRIC((byte) 13, "Profiler Metric", "profilerMetric");

public static final int TYPE_CODE_BYTE_LENGTH = 1;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Copyright 2023 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.navercorp.pinpoint.common.server.bo.stat;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class ProfilerMetricBo implements AgentStatDataPoint {

Check warning on line 22 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L22

Added line #L22 was not covered by tests

public static final long UNCOLLECTED_VALUE = -1;

private String agentId;
private long startTimestamp;
private long timestamp;
private String metricName; // is this necessary?
private final Map<String, String> tags = new HashMap<>();
private final Map<String, Double> values = new HashMap<>();

Check warning on line 31 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L30-L31

Added lines #L30 - L31 were not covered by tests

@Override
public String getAgentId() {
return agentId;

Check warning on line 35 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L35

Added line #L35 was not covered by tests
}

@Override
public void setAgentId(String agentId) {
this.agentId = agentId;
}

Check warning on line 41 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L40-L41

Added lines #L40 - L41 were not covered by tests

@Override
public long getStartTimestamp() {
return startTimestamp;

Check warning on line 45 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L45

Added line #L45 was not covered by tests
}

@Override
public void setStartTimestamp(long startTimestamp) {
this.startTimestamp = startTimestamp;
}

Check warning on line 51 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L50-L51

Added lines #L50 - L51 were not covered by tests

@Override
public long getTimestamp() {
return timestamp;

Check warning on line 55 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L55

Added line #L55 was not covered by tests
}

@Override
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}

Check warning on line 61 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L60-L61

Added lines #L60 - L61 were not covered by tests

@Override
public AgentStatType getAgentStatType() {
return AgentStatType.PROFILER_METRIC;

Check warning on line 65 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L65

Added line #L65 was not covered by tests
}

public void addTags(String name, String value) {
tags.put(name, value);
}

Check warning on line 70 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L69-L70

Added lines #L69 - L70 were not covered by tests

public Map<String, String> getTags() {
return tags;

Check warning on line 73 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L73

Added line #L73 was not covered by tests
}

public void addValues(String name, double value) {
values.put(name, value);
}

Check warning on line 78 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L77-L78

Added lines #L77 - L78 were not covered by tests

public Map<String, Double> getValues() {
return values;

Check warning on line 81 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L81

Added line #L81 was not covered by tests
}

public void setMetricName(String metricName) {
this.metricName = Objects.requireNonNull(metricName);
}

Check warning on line 86 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L85-L86

Added lines #L85 - L86 were not covered by tests

public String getMetricName() {
return metricName;

Check warning on line 89 in commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java

View check run for this annotation

Codecov / codecov/patch

commons-server/src/main/java/com/navercorp/pinpoint/common/server/bo/stat/ProfilerMetricBo.java#L89

Added line #L89 was not covered by tests
}
}
2 changes: 1 addition & 1 deletion grpc/grpc-idl
Submodule grpc-idl updated 1 files
+17 −0 proto/v1/Stat.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.navercorp.pinpoint.common.server.bo.stat.AgentStatBo;
import com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint;
import com.navercorp.pinpoint.common.server.bo.stat.ProfilerMetricBo;
import org.springframework.stereotype.Repository;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public class DefaultAgentStatDao <T extends AgentStatDataPoint> implements Agent

private final Logger logger = LogManager.getLogger(DefaultAgentStatDao.class.getName());

private final Function<AgentStatBo, List<T>> dataPointFunction;
private final Function<AgentStatBo, List<T>> agentStatBoDataPointFunction;
private final Function<List<T>, List<AgentStat>> convertToKafkaModelFunction;
private final KafkaTemplate kafkaAgentStatTemplate;
private final String topic;

public DefaultAgentStatDao(Function<AgentStatBo, List<T>> dataPointFunction, KafkaTemplate kafkaAgentStatTemplate, Function<List<T>, List<AgentStat>> convertToKafkaModelFunction, String topic) {
this.dataPointFunction = Objects.requireNonNull(dataPointFunction, "dataPointFunction");
public DefaultAgentStatDao(Function<AgentStatBo, List<T>> agentStatBoDataPointFunction, KafkaTemplate kafkaAgentStatTemplate, Function<List<T>, List<AgentStat>> convertToKafkaModelFunction, String topic) {
this.agentStatBoDataPointFunction = Objects.requireNonNull(agentStatBoDataPointFunction, "dataPointFunction");
this.kafkaAgentStatTemplate = Objects.requireNonNull(kafkaAgentStatTemplate, "kafkaAgentStatTemplate");
this.convertToKafkaModelFunction = convertToKafkaModelFunction;
this.topic = topic;
Expand All @@ -64,7 +64,7 @@ private List<AgentStat> convertDataToKafkaModel(List<T> AgentStatDataPointList)
@Override
public void dispatch(AgentStatBo agentStatBo) {
Objects.requireNonNull(agentStatBo, "agentStatBo");
List<T> dataPointList = this.dataPointFunction.apply(agentStatBo);
List<T> dataPointList = this.agentStatBoDataPointFunction.apply(agentStatBo);
insert(agentStatBo.getAgentId(), dataPointList);
}

Expand Down