Skip to content

Commit

Permalink
Merge branch 'master' into pil0txia/admin_4847
Browse files Browse the repository at this point in the history
# Conflicts:
#	eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
#	eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshServer.java
  • Loading branch information
Pil0tXia committed Apr 22, 2024
2 parents 74b2fbb + 2e4fc1b commit 947ddba
Show file tree
Hide file tree
Showing 147 changed files with 6,088 additions and 2,083 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
exempt-issue-labels: 'pinned,discussion,help wanted,WIP,weopen-star,GLCC,summer of code'
exempt-pr-labels: 'help wanted,dependencies'
exempt-all-milestones: true # Exempt all issues/PRs with milestones from stale
operations-per-run: 30
operations-per-run: 300
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ node_modules
h2/db.mv.db

# license check tmp file
all-dependencies.txt
/tools/dependency-check/all-dependencies.txt
self-modules.txt
third-party-dependencies.txt

Expand All @@ -50,4 +50,4 @@ bld/
**/org/apache/eventmesh/connector/jdbc/antlr4/autogeneration/*

#rust
Cargo.lock
Cargo.lock
214 changes: 90 additions & 124 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,58 @@ allprojects {
}
}

task tar(type: Tar) {
tasks.register('dist') {
subprojects.forEach { subProject ->
dependsOn("${subProject.path}:jar")
}
def includedProjects =
["eventmesh-common",
"eventmesh-meta:eventmesh-meta-api",
"eventmesh-metrics-plugin:eventmesh-metrics-api",
"eventmesh-protocol-plugin:eventmesh-protocol-api",
"eventmesh-retry:eventmesh-retry-api",
"eventmesh-runtime",
"eventmesh-security-plugin:eventmesh-security-api",
"eventmesh-spi",
"eventmesh-starter",
"eventmesh-storage-plugin:eventmesh-storage-api",
"eventmesh-trace-plugin:eventmesh-trace-api",
"eventmesh-webhook:eventmesh-webhook-api",
"eventmesh-webhook:eventmesh-webhook-admin",
"eventmesh-webhook:eventmesh-webhook-receive"]
doLast {
includedProjects.each {
def subProject = findProject(it)
logger.lifecycle('Install module: module: {}', subProject.name)
copy {
from subProject.jar.archivePath
into rootProject.file('dist/apps')
}
copy {
from subProject.file('bin')
into rootProject.file('dist/bin')
}
copy {
from subProject.file('conf')
from subProject.sourceSets.main.resources.srcDirs
into rootProject.file('dist/conf')
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude 'META-INF'
}
copy {
from subProject.configurations.runtimeClasspath
into rootProject.file('dist/lib')
exclude 'eventmesh-*'
}
}
copy {
from 'tools/third-party-licenses'
into rootProject.file('dist')
}
}
}

tasks.register('tar', Tar) {
archiveBaseName.set(project.name)
archiveVersion.set(project.version.toString())
archiveExtension.set('tar.gz')
Expand All @@ -150,7 +201,7 @@ task tar(type: Tar) {
}
}

task zip(type: Zip) {
tasks.register('zip', Zip) {
archiveBaseName.set(project.name)
archiveVersion.set(project.version.toString())
archiveExtension.set('zip')
Expand All @@ -160,50 +211,39 @@ task zip(type: Zip) {
}
}

task installPlugin() {
if (!new File("${rootDir}/dist").exists()) {
return
tasks.register('installPlugin') {
var pluginProjects = subprojects.findAll {
it.file('gradle.properties').exists()
&& it.properties.containsKey('pluginType')
&& it.properties.containsKey('pluginName')
}
doLast {
String[] libJars = java.util.Optional.ofNullable(file('dist/lib').list()).orElse(new String[0])
pluginProjects.forEach(subProject -> {
var pluginType = subProject.properties.get('pluginType')
var pluginName = subProject.properties.get('pluginName')
logger.lifecycle('Install plugin: pluginType: {}, pluginInstanceName: {}, module: {}', pluginType,
pluginName, subProject.name)
copy {
from subProject.jar.archivePath
into rootProject.file("dist/plugin/${pluginType}/${pluginName}")
}
copy {
from subProject.configurations.runtimeClasspath
into rootProject.file("dist/plugin/${pluginType}/${pluginName}")
exclude(libJars)
}
copy {
from subProject.file('conf')
from subProject.sourceSets.main.resources.srcDirs
into rootProject.file("dist/conf")
exclude 'META-INF'
}
})
}
String[] libJars = java.util.Optional.ofNullable(new File("${rootDir}/dist/lib").list()).orElseGet(() -> new String[0])
getAllprojects().forEach(subProject -> {
var file = new File("${subProject.projectDir}/gradle.properties")
if (!file.exists()) {
return
}
var properties = new Properties()
properties.load(new FileInputStream(file))
var pluginType = properties.getProperty("pluginType")
var pluginName = properties.getProperty("pluginName")
if (pluginType == null || pluginName == null) {
return
}
var pluginFile = new File("${rootDir}/dist/plugin/${pluginType}/${pluginName}")
if (pluginFile.exists()) {
return
}
pluginFile.mkdirs()
println String.format(
"install plugin, pluginType: %s, pluginInstanceName: %s, module: %s", pluginType, pluginName, subProject.getName()
)

copy {
into "${rootDir}/dist/plugin/${pluginType}/${pluginName}"
from "${subProject.getProjectDir()}/dist/apps"
}
copy {
into "${rootDir}/dist/plugin/${pluginType}/${pluginName}"
from "${subProject.getProjectDir()}/dist/lib/"
exclude(libJars)
}
copy {
into "${rootDir}/dist/conf"
from "${subProject.getProjectDir()}/dist/conf"
exclude 'META-INF'
}
})
}

task printProjects() {
tasks.register('printProjects') {
getAllprojects().forEach(subProject -> {
if ("EventMesh".equals(subProject.getName())) {
return
Expand Down Expand Up @@ -303,77 +343,6 @@ subprojects {
}
}

task dist(dependsOn: ['jar']) {
doFirst {
new File("${projectDir}/dist/bin").mkdirs()
new File("${projectDir}/dist/apps").mkdirs()
new File("${projectDir}/dist/conf").mkdirs()
new File("${projectDir}/dist/lib").mkdirs()
new File("${projectDir}/dist/licenses").mkdirs()
}
Set<String> rootProject = ["eventmesh-common",
"eventmesh-storage-api",
"eventmesh-metrics-api",
"eventmesh-meta-api",
"eventmesh-trace-api",
"eventmesh-retry-api",
"eventmesh-runtime",
"eventmesh-security-api",
"eventmesh-protocol-api",
"eventmesh-starter",
"eventmesh-spi",
"eventmesh-webhook-api",
"eventmesh-webhook-admin",
"eventmesh-webhook-receive"]
doLast {
copy {
into("${projectDir}/dist/apps")
from project.jar.getArchivePath()
}
copy {
into("${projectDir}/dist/lib")
from project.configurations.runtimeClasspath
}
copy {
into("${projectDir}/dist/bin")
from 'bin'
}
copy {
into("${projectDir}/dist/conf")
from 'conf', sourceSets.main.resources.srcDirs
setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE)
exclude 'META-INF'
}
if (rootProject.contains(project.name)) {
new File("${rootDir}/dist/apps").mkdirs()
new File("${rootDir}/dist/lib").mkdirs()
new File("${rootDir}/dist/bin").mkdirs()
new File("${rootDir}/dist/conf").mkdirs()
copy {
into("${rootDir}/dist/apps")
from "${projectDir}/dist/apps"
}
copy {
into "${rootDir}/dist/lib"
from "${projectDir}/dist/lib"
exclude "eventmesh-*"
}
copy {
into "${rootDir}/dist/bin"
from "${projectDir}/dist/bin"
}
copy {
into "${rootDir}/dist/conf"
from "${projectDir}/dist/conf"
}
}
copy {
into "${rootDir}/dist"
from "${rootDir}/tools/third-party-licenses"
}
}
}

javadoc {
source = sourceSets.main.java
destinationDir = reporting.file("javadoc")
Expand Down Expand Up @@ -491,7 +460,6 @@ subprojects {
dependency "org.apache.logging.log4j:log4j-api:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-core:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
dependency "org.apache.logging.log4j:log4j-slf4j-impl:${log4jVersion}" // used with SLF4J 1.7.x or older for third-party dependencies

dependency "com.lmax:disruptor:3.4.2"

Expand All @@ -513,15 +481,13 @@ subprojects {
dependency "io.dropwizard.metrics:metrics-annotation:4.1.0"
dependency "io.dropwizard.metrics:metrics-json:4.1.0"

dependency 'io.opentelemetry:opentelemetry-api:1.3.0'
dependency 'io.opentelemetry:opentelemetry-sdk:1.3.0'
dependency 'io.opentelemetry:opentelemetry-sdk-metrics:1.3.0-alpha'
dependency 'io.opentelemetry:opentelemetry-exporter-prometheus:1.3.0-alpha'
dependency 'io.prometheus:simpleclient:0.8.1'
dependency 'io.prometheus:simpleclient_httpserver:0.8.1'
dependency 'io.opentelemetry:opentelemetry-exporter-zipkin:1.3.0'
dependency 'io.opentelemetry:opentelemetry-semconv:1.3.0-alpha'
dependency 'io.opentelemetry:opentelemetry-exporter-jaeger:1.4.0'
dependency 'io.opentelemetry:opentelemetry-api:1.36.0'
dependency 'io.opentelemetry:opentelemetry-sdk:1.36.0'
dependency 'io.opentelemetry:opentelemetry-sdk-metrics:1.36.0'
dependency 'io.opentelemetry:opentelemetry-exporter-prometheus:1.36.0-alpha'
dependency 'io.opentelemetry:opentelemetry-exporter-zipkin:1.36.0'
dependency 'io.opentelemetry:opentelemetry-semconv:1.30.1-alpha'
dependency 'io.opentelemetry:opentelemetry-exporter-jaeger:1.34.1'

dependency "io.openmessaging:openmessaging-api:2.2.1-pubsub"

Expand Down
5 changes: 2 additions & 3 deletions eventmesh-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ dependencies {

api "com.alibaba.fastjson2:fastjson2"

implementation "org.apache.logging.log4j:log4j-api"
implementation "org.apache.logging.log4j:log4j-core"
implementation "org.apache.logging.log4j:log4j-slf4j2-impl"
runtimeOnly "org.apache.logging.log4j:log4j-core"
runtimeOnly "org.apache.logging.log4j:log4j-slf4j2-impl"

implementation 'com.github.seancfoley:ipaddress'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.common;


public class MetricsConstants {

private MetricsConstants() {

}

public static final String UNKOWN = "unkown";

public static final String LABEL_PROCESSOR = "processor";

public static final String CLIENT_ADDRESS = "client.address";

public static final String RPC_SYSTEM = "rpc.system";

public static final String RPC_SERVICE = "rpc.service";

//GRPC-https://opentelemetry.io/docs/reference/specification/metrics/semantic_conventions/rpc-metrics/
public static final String GRPC_NET_PEER_PORT = "net.peer.port";

public static final String GRPC_NET_PEER_NAME = "net.peer.name";

public static final String GRPC_NET_SOCK_PEER_ADDR = "net.sock.peer.addr";

public static final String GRPC_NET_SOCK_PEER_PORT = "net.sock.peer.port";

// HTTP https://opentelemetry.io/docs/reference/specification/metrics/semantic_conventions/http-metrics/

public static final String HTTP_HTTP_SCHEME = "http.scheme";

public static final String HTTP_HTTP_FLAVOR = "http.flavor";

public static final String HTTP_NET_HOST_NAME = "net.host.name";

public static final String HTTP_NET_HOST_PORT = "net.host.port";

//TCP
public static final String TCP_NET_HOST_NAME = "net.host.name";

public static final String TCP_NET_HOST_PORT = "net.host.port";


public static final String CLIENT_PROTOCOL_TYPE = "client.protocol.type";


}
Loading

0 comments on commit 947ddba

Please sign in to comment.