[ https://issues.apache.org/jira/browse/SCB-150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16328120#comment-16328120 ]
ASF GitHub Bot commented on SCB-150: ------------------------------------ seanyinx commented on a change in pull request #508: [SCB-150] Add Status(success/failed) dimension to operation call count and tps URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/508#discussion_r161936935 ########## File path: metrics/metrics-common/src/main/java/org/apache/servicecomb/metrics/common/DoubleMetricValue.java ########## @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 org.apache.servicecomb.metrics.common; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.servicecomb.foundation.common.exceptions.ServiceCombException; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class DoubleMetricValue extends MetricValue<Double> { + public DoubleMetricValue(Double value, Map<String, String> dimensions) { + super(value, dimensions); + } + + public DoubleMetricValue(@JsonProperty("key") String key, + @JsonProperty("value") Double value, + @JsonProperty("dimensions") Map<String, String> dimensions) { + super(key, value, dimensions); + } + + private DoubleMetricValue merge(DoubleMetricValue value) { + if (this.getKey().equals(value.getKey())) { + return new DoubleMetricValue(this.getKey(), this.getValue() + value.getValue(), this.getDimensions()); + } + throw new ServiceCombException("unable merge different key values,source key :" + value.getKey() + Review comment: any place to catch this exception? we don't want to interrupt user business logic ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add Success / Fail Dimension for Invocation > ------------------------------------------- > > Key: SCB-150 > URL: https://issues.apache.org/jira/browse/SCB-150 > Project: Apache ServiceComb > Issue Type: Sub-task > Components: Java-Chassis > Reporter: yangyongzheng > Assignee: yangyongzheng > Priority: Major > Fix For: java-chassis-1.0.0-m1 > > Attachments: screenshot-1.png > > > Add Success / Fail Dimension for Invocation,new metric available : > !screenshot-1.png! -- This message was sent by Atlassian JIRA (v7.6.3#76005)