Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move metrics from common to dubbo-metrics #11386

Merged
merged 14 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dubbo-config/dubbo-config-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-api</artifactId>
<artifactId>dubbo-metrics-default</artifactId>
<version>${project.parent.version}</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
import org.apache.dubbo.common.lang.ShutdownHookCallbacks;
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.metrics.MetricsReporter;
import org.apache.dubbo.common.metrics.MetricsReporterFactory;
import org.apache.dubbo.common.metrics.collector.DefaultMetricsCollector;
import org.apache.dubbo.common.metrics.service.MetricsServiceExporter;
import org.apache.dubbo.common.threadpool.manager.ExecutorRepository;
import org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository;
import org.apache.dubbo.common.utils.ArrayUtils;
Expand All @@ -54,6 +50,10 @@
import org.apache.dubbo.config.utils.ConfigValidationUtils;
import org.apache.dubbo.metadata.report.MetadataReportFactory;
import org.apache.dubbo.metadata.report.MetadataReportInstance;
import org.apache.dubbo.metrics.collector.DefaultMetricsCollector;
import org.apache.dubbo.metrics.report.MetricsReporter;
import org.apache.dubbo.metrics.report.MetricsReporterFactory;
import org.apache.dubbo.metrics.service.MetricsServiceExporter;
import org.apache.dubbo.registry.client.metadata.ServiceInstanceMetadataUtils;
import org.apache.dubbo.registry.support.RegistryManager;
import org.apache.dubbo.rpc.model.ApplicationModel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.apache.dubbo.common.constants.LoggerCodeConstants;
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.metrics.service.MetricsService;
import org.apache.dubbo.common.metrics.service.MetricsServiceExporter;
import org.apache.dubbo.metrics.service.MetricsService;
import org.apache.dubbo.metrics.service.MetricsServiceExporter;
import org.apache.dubbo.config.MetricsConfig;
import org.apache.dubbo.config.ServiceConfig;
import org.apache.dubbo.config.bootstrap.builders.InternalServiceConfigBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-default</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-otel</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-default</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-otel</artifactId>
Expand Down
16 changes: 12 additions & 4 deletions dubbo-distribution/dubbo-all/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
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.
Expand Down Expand Up @@ -183,6 +183,13 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-default</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-prometheus</artifactId>
Expand Down Expand Up @@ -481,6 +488,7 @@
<include>org.apache.dubbo:dubbo-metadata-report-redis</include>
<include>org.apache.dubbo:dubbo-metadata-report-zookeeper</include>
<include>org.apache.dubbo:dubbo-metrics-api</include>
<include>org.apache.dubbo:dubbo-metrics-default</include>
<include>org.apache.dubbo:dubbo-metrics-prometheus</include>
<include>org.apache.dubbo:dubbo-monitor-api</include>
<include>org.apache.dubbo:dubbo-monitor-default</include>
Expand Down Expand Up @@ -1169,19 +1177,19 @@
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.metrics.service.MetricsService
META-INF/dubbo/internal/org.apache.dubbo.metrics.service.MetricsService
</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.metrics.service.MetricsServiceExporter
META-INF/dubbo/internal/org.apache.dubbo.metrics.service.MetricsServiceExporter
</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>
META-INF/dubbo/internal/org.apache.dubbo.common.metrics.MetricsReporterFactory
META-INF/dubbo/internal/org.apache.dubbo.metrics.report.MetricsReporterFactory
</resource>
</transformer>
<transformer
Expand Down
5 changes: 5 additions & 0 deletions dubbo-distribution/dubbo-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@
<artifactId>dubbo-metrics-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-default</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-prometheus</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions dubbo-distribution/dubbo-core-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-metrics-default</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-monitor-api</artifactId>
Expand Down Expand Up @@ -133,6 +140,7 @@
<include>org.apache.dubbo:dubbo-config-api</include>
<include>org.apache.dubbo:dubbo-metadata-api</include>
<include>org.apache.dubbo:dubbo-metrics-api</include>
<include>org.apache.dubbo:dubbo-metrics-default</include>
<include>org.apache.dubbo:dubbo-monitor-api</include>
<include>org.apache.dubbo:dubbo-registry-api</include>
<include>org.apache.dubbo:dubbo-remoting-api</include>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

public class DubboMetrics implements MeterBinder {

protected static volatile MeterRegistry globalRegistry = null;
public static volatile MeterRegistry globalRegistry = null;
@Override
public void bindTo(MeterRegistry registry) {
this.globalRegistry = registry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.collector;
package org.apache.dubbo.metrics.collector;

import org.apache.dubbo.common.metrics.model.sample.MetricSample;
import org.apache.dubbo.metrics.model.sample.MetricSample;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.collector.stat;
package org.apache.dubbo.metrics.collector.stat;

import org.apache.dubbo.metrics.model.MethodMetric;

import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;

import org.apache.dubbo.common.metrics.model.MethodMetric;

public interface MetricsStatHandler {
Map<MethodMetric, AtomicLong> get();
void increase(String interfaceName, String methodName, String group, String version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.event;
package org.apache.dubbo.metrics.event;

import org.apache.dubbo.metrics.model.MethodMetric;

/**
* BaseMetricsEvent.
*/
public abstract class MetricsEvent {

/**
* Metric object. (eg. {@link org.apache.dubbo.common.metrics.model.MethodMetric})
* Metric object. (eg. {@link MethodMetric})
*/
protected transient Object source;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.event;
package org.apache.dubbo.metrics.event;

/**
* RtEvent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.event;
package org.apache.dubbo.metrics.event;

/**
* RequestEvent.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.listener;
package org.apache.dubbo.metrics.listener;

import org.apache.dubbo.common.metrics.event.MetricsEvent;
import org.apache.dubbo.metrics.event.MetricsEvent;

/**
* Metrics Listener.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.model;
package org.apache.dubbo.metrics.model;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.model;
package org.apache.dubbo.metrics.model;

/**
* Metric category.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.model;
package org.apache.dubbo.metrics.model;

public enum MetricsKey {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.model.sample;
package org.apache.dubbo.metrics.model.sample;

import org.apache.dubbo.common.metrics.model.MetricsCategory;
import org.apache.dubbo.common.metrics.model.MetricsKey;
import org.apache.dubbo.metrics.model.MetricsCategory;
import org.apache.dubbo.metrics.model.MetricsKey;

import java.util.Map;
import java.util.function.Supplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.model.sample;
package org.apache.dubbo.metrics.model.sample;

import org.apache.dubbo.common.metrics.model.MetricsCategory;
import org.apache.dubbo.metrics.model.MetricsCategory;

import java.util.Map;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* limitations under the License.
*/

package org.apache.dubbo.metrics;
package org.apache.dubbo.metrics.report;

import org.apache.dubbo.common.metrics.MetricsReporterFactory;
import org.apache.dubbo.rpc.model.ApplicationModel;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics;
package org.apache.dubbo.metrics.report;

/**
* Metrics Reporter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics;
package org.apache.dubbo.metrics.report;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.Adaptive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.service;
package org.apache.dubbo.metrics.service;

import org.apache.dubbo.common.metrics.model.MetricsCategory;
import org.apache.dubbo.metrics.model.MetricsCategory;

import java.util.Map;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.service;
package org.apache.dubbo.metrics.service;

import org.apache.dubbo.common.extension.ExtensionScope;
import org.apache.dubbo.common.extension.SPI;
import org.apache.dubbo.common.metrics.model.MetricsCategory;
import org.apache.dubbo.metrics.model.MetricsCategory;
import org.apache.dubbo.metrics.collector.MetricsCollector;

import java.util.List;
import java.util.Map;

import static org.apache.dubbo.common.metrics.service.MetricsService.DEFAULT_EXTENSION_NAME;
import static org.apache.dubbo.metrics.service.MetricsService.DEFAULT_EXTENSION_NAME;

/**
* Metrics Service.
* Provide an interface to get metrics from {@link org.apache.dubbo.common.metrics.collector.MetricsCollector}
* Provide an interface to get metrics from {@link MetricsCollector}
*/
@SPI(value = DEFAULT_EXTENSION_NAME, scope = ExtensionScope.APPLICATION)
public interface MetricsService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.dubbo.common.metrics.service;
package org.apache.dubbo.metrics.service;

import org.apache.dubbo.common.extension.ExtensionScope;
import org.apache.dubbo.common.extension.SPI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
metrics-beta=org.apache.dubbo.metrics.filter.MetricsFilter
observationsender=org.apache.dubbo.metrics.filter.observation.ObservationSenderFilter
Loading