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

[#10776] Sort metric property data. #11570

Merged
merged 1 commit into from
Oct 14, 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.navercorp.pinpoint.otlp.common.web.definition.property;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
Expand Down Expand Up @@ -44,6 +45,7 @@ public String getFieldName() {

public void addTagGroup(String tagGroup) {
tagGroupList.add(tagGroup);
tagGroupList.sort(Comparator.naturalOrder());
}

public List<String> getTagGroupList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.navercorp.pinpoint.otlp.common.web.definition.property;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
* @author minwoo-jung
Expand All @@ -31,8 +31,8 @@ public class Metric {

public Metric(String metricName) {
this.metricName = metricName;
this.tagMap = new HashMap<>();
this.fieldMap = new HashMap<>();
this.tagMap = new TreeMap<>();
this.fieldMap = new TreeMap<>();
}

public void addTagAndField(String tag, String fieldName, String unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package com.navercorp.pinpoint.otlp.common.web.definition.property;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
* @author minwoo-jung
Expand All @@ -30,7 +30,7 @@ public class MetricGroup {

public MetricGroup(String metricGroupName) {
this.metricGroupName = metricGroupName;
this.metricMap = new HashMap<>();
this.metricMap = new TreeMap<>();
}

public void addUniqueMetric(MetricDescriptor metricDescriptor) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.navercorp.pinpoint.otlp.common.web.definition.property;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
Expand All @@ -34,6 +35,7 @@ public TagCluster(String tag) {
public void addFieldAndUnit(String fieldName, String unit) {
FieldAndUnit fieldAndUnit = new FieldAndUnit(fieldName, unit);
fieldAndUnitList.add(fieldAndUnit);
fieldAndUnitList.sort(Comparator.comparing(FieldAndUnit::fieldName));
}

public List<FieldAndUnit> getFieldAndUnitList() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;

/**
* @author minwoo-jung
Expand All @@ -46,7 +46,7 @@
public List<MetricGroup> getMetricGroupList(String applicationName) {
List<MetricDescriptor> MetricDescriptorList = syncTemplate.selectList(NAMESPACE + "selectMetricDescriptorList", applicationName);

Map<String, MetricGroup> metricGroupMap = new HashMap<>();
Map<String, MetricGroup> metricGroupMap = new TreeMap<>();

Check warning on line 49 in otlpmetric/otlpmetric-web/src/main/java/com/navercorp/pinpoint/otlp/web/dao/pinot/PinotMetricMetaDataDao.java

View check run for this annotation

Codecov / codecov/patch

otlpmetric/otlpmetric-web/src/main/java/com/navercorp/pinpoint/otlp/web/dao/pinot/PinotMetricMetaDataDao.java#L49

Added line #L49 was not covered by tests

for (MetricDescriptor metricDescriptor : MetricDescriptorList) {
MetricGroup metricGroup = metricGroupMap.computeIfAbsent(metricDescriptor.metricGroupName(), k -> new MetricGroup(metricDescriptor.metricGroupName()));
Expand Down