-
Notifications
You must be signed in to change notification settings - Fork 640
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
1. Add Metrics plugin module 2. Implement opentelemetry metrics module related issue #696
- Loading branch information
1 parent
e7edf59
commit bcbcd8d
Showing
51 changed files
with
1,407 additions
and
1,438 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
16 changes: 16 additions & 0 deletions
16
eventmesh-metrics-plugin/eventmesh-metrics-api/gradle.properties
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,16 @@ | ||
# | ||
# 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. | ||
# |
41 changes: 41 additions & 0 deletions
41
...mesh-metrics-api/src/main/java/org/apache/eventmesh/metrics/api/MetricsPluginFactory.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,41 @@ | ||
/* | ||
* 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.eventmesh.metrics.api; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
import org.apache.eventmesh.spi.EventMeshExtensionFactory; | ||
|
||
import lombok.experimental.UtilityClass; | ||
|
||
@UtilityClass | ||
public class MetricsPluginFactory { | ||
|
||
/** | ||
* Get {@code MetricsRegistry}. | ||
* | ||
* @param metricsRegistryType | ||
* @return | ||
*/ | ||
public static MetricsRegistry getMetricsRegistry(String metricsRegistryType) { | ||
checkNotNull(metricsRegistryType, "MetricsRegistryType cannot be null"); | ||
|
||
MetricsRegistry metricsRegistry = EventMeshExtensionFactory.getExtension(MetricsRegistry.class, metricsRegistryType); | ||
return checkNotNull(metricsRegistry, "MetricsRegistryType: " + metricsRegistryType + " is not supported"); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...eventmesh-metrics-api/src/main/java/org/apache/eventmesh/metrics/api/MetricsRegistry.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,56 @@ | ||
/* | ||
* 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.eventmesh.metrics.api; | ||
|
||
import org.apache.eventmesh.metrics.api.model.Metric; | ||
import org.apache.eventmesh.spi.EventMeshExtensionType; | ||
import org.apache.eventmesh.spi.EventMeshSPI; | ||
|
||
/** | ||
* The top-level interface of metrics registry, used to register different metrics. | ||
* It should have multiple sub implementation, e.g. JVM, Prometheus, i.g. | ||
* | ||
* @since 1.4.0 | ||
*/ | ||
@EventMeshSPI(isSingleton = true, eventMeshExtensionType = EventMeshExtensionType.METRICS) | ||
public interface MetricsRegistry { | ||
|
||
/** | ||
* Start the metrics registry. | ||
*/ | ||
void start(); | ||
|
||
/** | ||
* Close the metrics registry. | ||
*/ | ||
void showdown(); | ||
|
||
/** | ||
* Register a new Metric, if the metric is already exist, it will do nothing. | ||
* | ||
* @param metric | ||
*/ | ||
void register(Metric metric); | ||
|
||
/** | ||
* Remove a metric, if the metric is not exist, it will do nothing. | ||
* | ||
* @param metric | ||
*/ | ||
void unRegister(Metric metric); | ||
} |
Oops, something went wrong.