Skip to content

Commit

Permalink
Merge branch 'master' into pil0txia/action_4720
Browse files Browse the repository at this point in the history
# Conflicts:
#	tools/dependency-check/known-dependencies.txt
  • Loading branch information
Pil0tXia committed Apr 22, 2024
2 parents 0261ef6 + 2e4fc1b commit 4893cea
Show file tree
Hide file tree
Showing 121 changed files with 5,860 additions and 1,818 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,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
16 changes: 7 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,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
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";


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

package org.apache.eventmesh.runtime.common;
package org.apache.eventmesh.common;

public class Pair<T1, T2> {
public class Pair<Left, Right> {

private T1 object1;
private T2 object2;
private Left left;

public Pair(T1 object1, T2 object2) {
this.object1 = object1;
this.object2 = object2;
private Right right;

public Pair(Left left, Right right) {
this.left = left;
this.right = right;
}

public T1 getObject1() {
return object1;
public Left getLeft() {
return left;
}

public void setObject1(T1 object1) {
this.object1 = object1;
public void setLeft(Left left) {
this.left = left;
}

public T2 getObject2() {
return object2;
public Right getRight() {
return right;
}

public void setObject2(T2 object2) {
this.object2 = object2;
public void setRight(Right right) {
this.right = right;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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.enums;

public enum ProtocolType {
TCP,
HTTP,
GRPC
}
28 changes: 28 additions & 0 deletions eventmesh-connectors/eventmesh-connector-chatgpt/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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.
*/

dependencies {
api project(":eventmesh-openconnect:eventmesh-openconnect-java")
implementation project(":eventmesh-common")
implementation 'com.theokanning.openai-gpt3-java:service:0.18.2'
implementation 'io.cloudevents:cloudevents-http-vertx:2.3.0'
implementation 'io.vertx:vertx-web:4.4.6'

testImplementation "org.apache.httpcomponents:httpclient"
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}
18 changes: 18 additions & 0 deletions eventmesh-connectors/eventmesh-connector-chatgpt/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# 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.
#
pluginType=connector
pluginName=chatgpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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.connector.chatgpt.config;

import org.apache.eventmesh.openconnect.api.config.Config;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ChatGPTServerConfig extends Config {

private boolean sourceEnable;

private boolean sinkEnable;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.connector.chatgpt.server;

import org.apache.eventmesh.connector.chatgpt.config.ChatGPTServerConfig;
import org.apache.eventmesh.connector.chatgpt.source.connector.ChatGPTSourceConnector;
import org.apache.eventmesh.openconnect.Application;
import org.apache.eventmesh.openconnect.util.ConfigUtil;

public class ChatGPTConnectServer {

public static void main(String[] args) throws Exception {
ChatGPTServerConfig serverConfig = ConfigUtil.parse(ChatGPTServerConfig.class, "server-config.yml");

if (serverConfig.isSourceEnable()) {
Application chatGPTSourceApp = new Application();
chatGPTSourceApp.run(ChatGPTSourceConnector.class);
}

if (serverConfig.isSinkEnable()) {
// TODO support sink connector
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.connector.chatgpt.source.config;

import org.apache.eventmesh.openconnect.api.config.SourceConfig;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ChatGPTSourceConfig extends SourceConfig {

public ChatGPTSourceConnectorConfig connectorConfig;

public OpenaiProxyConfig openaiProxyConfig;

public OpenaiConfig openaiConfig;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.connector.chatgpt.source.config;

import lombok.Data;

@Data
public class ChatGPTSourceConnectorConfig {

private String connectorName = "chatgptSource";

private String path = "/chatgpt";

private int port = 3756;

private int idleTimeout;

private boolean proxyEnable = false;

private String parsePromptFileName = "prompt";

}
Loading

0 comments on commit 4893cea

Please sign in to comment.