You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "wxbty (via GitHub)" <gi...@apache.org> on 2023/03/16 14:23:23 UTC

[GitHub] [dubbo] wxbty commented on a diff in pull request #11798: Observability task: add metadata buried points at the provider responder interface level

wxbty commented on code in PR #11798:
URL: https://github.com/apache/dubbo/pull/11798#discussion_r1138755013


##########
dubbo-metrics/dubbo-metrics-metadata/src/main/java/org/apache/dubbo/metrics/metadata/event/StoreProviderMetadataListener.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.metadata.event;
+
+import org.apache.dubbo.metrics.event.MetricsEvent;
+import org.apache.dubbo.metrics.listener.MetricsLifeListener;
+
+import static org.apache.dubbo.metrics.metadata.collector.stat.MetadataStatComposite.OP_TYPE_STORE_PROVIDER;
+
+public class StoreProviderMetadataListener implements MetricsLifeListener<MetadataEvent.StoreProviderMetadataEvent> {
+
+
+    @Override
+    public boolean isSupport(MetricsEvent event) {
+        return event instanceof MetadataEvent.StoreProviderMetadataEvent && ((MetadataEvent) event).isAvailable();
+    }
+
+    @Override
+    public void onEvent(MetadataEvent.StoreProviderMetadataEvent event) {
+        event.getCollector().increment(event.getSource().getApplicationName(), MetadataEvent.Type.S_P_TOTAL);

Review Comment:
   Why does the interface level store applicationName?



##########
dubbo-metrics/dubbo-metrics-metadata/src/test/java/org/apache/dubbo/metrics/metadata/MetadataStatCompositeTest.java:
##########
@@ -37,8 +37,8 @@ public class MetadataStatCompositeTest {
     void testInit() {
         MetadataStatComposite statComposite = new MetadataStatComposite();
         Assertions.assertEquals(statComposite.numStats.size(), MetadataEvent.Type.values().length);
-        //(rt)5 * (push,subscribe)2
-        Assertions.assertEquals(5 * 2, statComposite.rtStats.size());
+        //(rt)5 * (push,subscribe,store provider)2

Review Comment:
   Shouldn't the assertion here be 5*4



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org