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

[#10704] add sortKey about inspector data #10745

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions inspector-module/inspector-collector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@


<dependencies>
<dependency>
<groupId>com.navercorp.pinpoint</groupId>
<artifactId>pinpoint-inspector-commons</artifactId>
</dependency>
<dependency>
<groupId>com.navercorp.pinpoint</groupId>
<artifactId>pinpoint-collector</artifactId>
Expand Down Expand Up @@ -55,5 +59,9 @@
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.navercorp.pinpoint</groupId>
<artifactId>pinpoint-inspector-commons</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public DefaultAgentStatDao(Function<AgentStatBo, List<T>> dataPointFunction, Kaf
public void insert(String agentId, List<T> agentStatData) {
List<AgentStat> agentStatList = convertDataToKafkaModel(agentStatData);
for (AgentStat agentStat : agentStatList) {
String kafkaKey = generateKafkaKey(agentStat);
kafkaAgentStatTemplate.send(topic, kafkaKey, agentStat);
kafkaAgentStatTemplate.send(topic, agentStat.getSortKey(), agentStat);
}
}

Expand All @@ -71,14 +70,4 @@ public void dispatch(AgentStatBo agentStatBo) {
List<T> dataPointList = this.dataPointFunction.apply(agentStatBo);
insert(agentStatBo.getAgentId(), dataPointList);
}

private String generateKafkaKey(AgentStat agentStat) {
StringBuilder sb = new StringBuilder();
sb.append(agentStat.getApplicationName());
sb.append("_");
sb.append(agentStat.getAgentId());
sb.append("_");
sb.append(agentStat.getMetricName());
return sb.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,22 @@
public class AgentStat {

private final String tenantId;
private final String sortKey;
private final String applicationName;
private final String agentId;

private final String metricName;
private final String fieldName;
private final double fieldValue;
private final List<Tag> tags;

private final long eventTime;

public AgentStat(String tenantId, String applicationName, String agentId, String metricName, String fieldName, double fieldValue, long eventTime) {
this(tenantId, applicationName, agentId, metricName, fieldName, fieldValue, eventTime, Collections.emptyList());
public AgentStat(String tenantId, String sortKey, String applicationName, String agentId, String metricName, String fieldName, double fieldValue, long eventTime) {
this(tenantId, sortKey, applicationName, agentId, metricName, fieldName, fieldValue, eventTime, Collections.emptyList());
}

public AgentStat(String tenantId, String applicationName, String agentId, String metricName, String fieldName, double fieldValue, long eventTime, List<Tag> tags) {
public AgentStat(String tenantId, String sortKey, String applicationName, String agentId, String metricName, String fieldName, double fieldValue, long eventTime, List<Tag> tags) {
this.tenantId = tenantId;
this.sortKey = sortKey;
this.applicationName = applicationName;
this.agentId = agentId;
this.metricName = metricName;
Expand Down Expand Up @@ -88,5 +88,9 @@ public List<Tag> getTags() {
return tags;
}

public String getSortKey() {
return sortKey;
}


}
Loading
Loading