From 5bc8638af7381367a61b738c6852bc3f189a2f96 Mon Sep 17 00:00:00 2001 From: mike_xwm Date: Sun, 13 Mar 2022 14:57:52 +0800 Subject: [PATCH] [MINOR] Add trace switch (#812) * update some docs Signed-off-by: qqeasonchen * Update java sdk docs (#663) * Add files via upload add pluggable-protocols.png * add trace switch * fix typos * *fix CommonConfigurationTest Co-authored-by: qqeasonchen Co-authored-by: Wenjun Ruan --- docs/en/intro.md | 34 +++++++++---------- .../common/config/CommonConfiguration.java | 8 +++-- .../test/resources/configuration.properties | 2 +- .../http/demo/sub/service/SubService.java | 2 +- eventmesh-runtime/conf/eventmesh.properties | 5 +-- .../runtime/boot/EventMeshHTTPServer.java | 2 +- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/docs/en/intro.md b/docs/en/intro.md index ae9a154890..4ffaef53ff 100644 --- a/docs/en/intro.md +++ b/docs/en/intro.md @@ -1,17 +1,17 @@ -![logo](../../docs/images/logo2.png) -## Features - -### [SPI](features/spi.md) - -### [protocol](instructions/eventmesh-runtime-protocol.md) - -### [cloudevents](features/eventmesh-cloudevents-sdk-binding.md) - -### [trace](features/eventmesh-trace-design.md) - -### [metrics](features/eventmesh-metrics-export-design.md) - -### [SchemaRegistry](features/eventmesh-schemaregistry-design.md) - - -### [Workflow](features/eventmesh-workflow-design.md) +![logo](../../docs/images/logo2.png) +## Features + +### [SPI](features/spi.md) + +### [protocol](instructions/eventmesh-runtime-protocol.md) + +### [cloudevents](features/eventmesh-cloudevents-sdk-binding.md) + +### [trace](features/eventmesh-trace-design.md) + +### [metrics](features/eventmesh-metrics-export-design.md) + +### [SchemaRegistry](features/eventmesh-schemaregistry-design.md) + + +### [Workflow](features/eventmesh-workflow-design.md) diff --git a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java index 2c7a00a108..39d932413d 100644 --- a/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java +++ b/eventmesh-common/src/main/java/org/apache/eventmesh/common/config/CommonConfiguration.java @@ -47,6 +47,7 @@ public class CommonConfiguration { public String eventMeshServerIp = null; public boolean eventMeshServerSecurityEnable = false; public boolean eventMeshServerRegistryEnable = false; + public boolean eventMeshServerTraceEnable = false; protected ConfigurationWrapper configurationWrapper; public String eventMeshWebhookOrigin = "eventmesh." + eventMeshIDC; @@ -88,6 +89,7 @@ public void init() { .collect(Collectors.toList()); } + eventMeshServerTraceEnable = Boolean.parseBoolean(get(ConfKeys.KEYS_EVENTMESH_TRACE_ENABLED, () -> "false")); eventMeshTracePluginType = checkNotEmpty(ConfKeys.KEYS_EVENTMESH_TRACE_PLUGIN_TYPE); } } @@ -147,8 +149,10 @@ static class ConfKeys { public static String KEYS_ENENTMESH_REGISTRY_PLUGIN_TYPE = "eventMesh.registry.plugin.type"; - public static String KEYS_EVENTMESH_METRICS_PLUGIN_TYPE = "eventmesh.metrics.plugin"; + public static String KEYS_EVENTMESH_METRICS_PLUGIN_TYPE = "eventMesh.metrics.plugin"; - public static String KEYS_EVENTMESH_TRACE_PLUGIN_TYPE = "eventmesh.trace.plugin"; + public static String KEYS_EVENTMESH_TRACE_ENABLED = "eventMesh.server.trace.enabled"; + + public static String KEYS_EVENTMESH_TRACE_PLUGIN_TYPE = "eventMesh.trace.plugin"; } } \ No newline at end of file diff --git a/eventmesh-common/src/test/resources/configuration.properties b/eventmesh-common/src/test/resources/configuration.properties index b04eab6ddd..052de895e3 100644 --- a/eventmesh-common/src/test/resources/configuration.properties +++ b/eventmesh-common/src/test/resources/configuration.properties @@ -23,4 +23,4 @@ eventMesh.server.hostIp=value6 eventMesh.connector.plugin.type=rocketmq eventMesh.security.plugin.type=acl eventMesh.registry.plugin.type=namesrv -eventmesh.trace.plugin=zipkin \ No newline at end of file +eventMesh.trace.plugin=zipkin \ No newline at end of file diff --git a/eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java b/eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java index bb1eaaae11..b825bc979c 100644 --- a/eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java +++ b/eventmesh-examples/src/main/java/org/apache/eventmesh/http/demo/sub/service/SubService.java @@ -54,7 +54,7 @@ public class SubService implements InitializingBean { final Properties properties = Utils.readPropertiesFile(ExampleConstants.CONFIG_FILE_NAME); final List topicList = Lists.newArrayList( - new SubscriptionItem(ExampleConstants.EVENTMESH_HTTP_SYNC_TEST_TOPIC, SubscriptionMode.CLUSTERING, SubscriptionType.ASYNC) + new SubscriptionItem(ExampleConstants.EVENTMESH_HTTP_ASYNC_TEST_TOPIC, SubscriptionMode.CLUSTERING, SubscriptionType.ASYNC) ); final String localIp = IPUtils.getLocalAddress(); final String localPort = properties.getProperty("server.port"); diff --git a/eventmesh-runtime/conf/eventmesh.properties b/eventmesh-runtime/conf/eventmesh.properties index 877f9087b2..2f03bec71c 100644 --- a/eventmesh-runtime/conf/eventmesh.properties +++ b/eventmesh-runtime/conf/eventmesh.properties @@ -82,7 +82,8 @@ eventMesh.server.registry.enabled=false eventMesh.registry.plugin.type=namesrv # metrics plugin, if you have multiple plugin, you can use ',' to split -eventmesh.metrics.plugin=prometheus +eventMesh.metrics.plugin=prometheus # trace plugin -eventmesh.trace.plugin=zipkin \ No newline at end of file +eventMesh.server.trace.enabled=false +eventMesh.trace.plugin=zipkin \ No newline at end of file diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java index 07ec0a420c..9f29248ef8 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java @@ -225,7 +225,7 @@ public void init() throws Exception { registerHTTPRequestProcessor(); //get the trace-plugin - if (StringUtils.isNotEmpty(eventMeshHttpConfiguration.eventMeshTracePluginType)) { + if (StringUtils.isNotEmpty(eventMeshHttpConfiguration.eventMeshTracePluginType) && eventMeshHttpConfiguration.eventMeshServerTraceEnable) { traceService = TracePluginFactory.getTraceService(eventMeshHttpConfiguration.eventMeshTracePluginType);