-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '3.3' into feat/support_springboot3_native
# Conflicts: # dubbo-test/dubbo-test-modules/src/test/java/org/apache/dubbo/dependency/FileTest.java
- Loading branch information
Showing
38 changed files
with
648 additions
and
674 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
...bo-metrics-api/src/main/java/org/apache/dubbo/metrics/collector/CombMetricsCollector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* 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.collector; | ||
|
||
import org.apache.dubbo.metrics.data.BaseStatComposite; | ||
import org.apache.dubbo.metrics.event.MetricsEventMulticaster; | ||
import org.apache.dubbo.metrics.event.TimeCounterEvent; | ||
import org.apache.dubbo.metrics.model.MetricsCategory; | ||
import org.apache.dubbo.metrics.model.key.MetricsKey; | ||
import org.apache.dubbo.metrics.model.sample.GaugeMetricSample; | ||
|
||
import java.util.List; | ||
|
||
import static org.apache.dubbo.metrics.MetricsConstants.SELF_INCREMENT_SIZE; | ||
|
||
public abstract class CombMetricsCollector<E extends TimeCounterEvent> implements ApplicationMetricsCollector<E>, ServiceMetricsCollector<E> { | ||
|
||
private final BaseStatComposite stats; | ||
private MetricsEventMulticaster eventMulticaster; | ||
|
||
|
||
public CombMetricsCollector(BaseStatComposite stats) { | ||
this.stats = stats; | ||
} | ||
|
||
protected void setEventMulticaster(MetricsEventMulticaster eventMulticaster) { | ||
this.eventMulticaster = eventMulticaster; | ||
} | ||
|
||
@Override | ||
public void setNum(MetricsKey metricsKey, String applicationName, String serviceKey, int num) { | ||
this.stats.setServiceKey(metricsKey, applicationName, serviceKey, num); | ||
} | ||
|
||
@Override | ||
public void increment(String applicationName, MetricsKey metricsKey) { | ||
this.stats.incrementApp(metricsKey, applicationName, SELF_INCREMENT_SIZE); | ||
} | ||
|
||
public void increment(String applicationName, String serviceKey, MetricsKey metricsKey, int size) { | ||
this.stats.incrementServiceKey(metricsKey, applicationName, serviceKey, size); | ||
} | ||
|
||
@Override | ||
public void addRt(String applicationName, String registryOpType, Long responseTime) { | ||
stats.calcApplicationRt(applicationName, registryOpType, responseTime); | ||
} | ||
|
||
public void addRt(String applicationName, String serviceKey, String registryOpType, Long responseTime) { | ||
stats.calcServiceKeyRt(applicationName, serviceKey, registryOpType, responseTime); | ||
} | ||
|
||
@SuppressWarnings({"rawtypes"}) | ||
protected List<GaugeMetricSample> export(MetricsCategory category) { | ||
return stats.export(category); | ||
} | ||
|
||
@Override | ||
public void onEvent(TimeCounterEvent event) { | ||
eventMulticaster.publishEvent(event); | ||
} | ||
|
||
|
||
@Override | ||
public void onEventFinish(TimeCounterEvent event) { | ||
eventMulticaster.publishFinishEvent(event); | ||
} | ||
|
||
@Override | ||
public void onEventError(TimeCounterEvent event) { | ||
eventMulticaster.publishErrorEvent(event); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.