Skip to content

Commit

Permalink
fix: 修复错误率error_rate计算错误 (#3002)
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 18581
  • Loading branch information
liuwenping authored Sep 16, 2024
1 parent 8330503 commit d6ccc85
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def get_mapping(cls, metric):
total_mapping.setdefault(span, 0)
total_mapping[span] += value

error_mapping.setdefault(span, 0)
if status_code == str(StatusCode.ERROR.value):
error_mapping.setdefault(span, 0)
error_mapping[span] += value

endpoint_names.add(span)
Expand All @@ -132,7 +132,6 @@ def get_mapping(cls, metric):
def convert_mapping_to_list(self, total_mapping, error_mapping, endpoint_names):
res = []
for index, name in enumerate(endpoint_names, 1):

error_rate = round(error_mapping[name] / total_mapping[name], 2) if total_mapping[name] else 0
if error_rate == 0:
color = NodeColor.Color.GREEN
Expand Down Expand Up @@ -240,7 +239,6 @@ class ApdexList(EndpointList):
metric = ApdexInstance

def list(self):

response = self.metric(
**self.common_params, **{"filter_dict": self.get_filter_dict(), "group_by": ["span_name"]}
).get_instance_calculate_values_mapping(
Expand Down

0 comments on commit d6ccc85

Please sign in to comment.