marcingrzejszczak commented on code in PR #11021: URL: https://github.com/apache/dubbo/pull/11021#discussion_r1084090540
########## dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/filter/observation/DefaultDubboClientObservationConvention.java: ########## @@ -0,0 +1,75 @@ +/* + * 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.dubbo.metrics.filter.observation; + +import io.micrometer.common.KeyValues; +import org.apache.dubbo.common.URL; +import org.apache.dubbo.rpc.RpcContextAttachment; + +import static org.apache.dubbo.metrics.filter.observation.DubboObservation.LowCardinalityKeyNames.NET_PEER_NAME; +import static org.apache.dubbo.metrics.filter.observation.DubboObservation.LowCardinalityKeyNames.NET_PEER_PORT; + +/** + * Default implementation of the {@link DubboClientObservationConvention}. + */ +public class DefaultDubboClientObservationConvention extends AbstractDefaultDubboObservationConvention implements DubboClientObservationConvention { + /** + * Singleton instance of {@link DefaultDubboClientObservationConvention}. + */ + public static final DubboClientObservationConvention INSTANCE = new DefaultDubboClientObservationConvention(); + + @Override + public String getName() { + return "rpc.client.duration"; + } + + @Override + public KeyValues getLowCardinalityKeyValues(DubboClientContext context) { + KeyValues keyValues = super.getLowCardinalityKeyValues(context.getInvocation()); + RpcContextAttachment rpcContextAttachment = context.getRpcContextAttachment(); + URL url = context.getInvoker().getUrl(); Review Comment: I see. So what I did for now is to attach tags only from the first invoker. We could think of adding more tags for additional ones later once there's demand for this, WDYT? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
