You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "RuslanHryn (via GitHub)" <gi...@apache.org> on 2023/08/29 11:05:26 UTC

[GitHub] [camel] RuslanHryn opened a new pull request, #11231: CAMEL-19776 for main(camel-4)

RuslanHryn opened a new pull request, #11231:
URL: https://github.com/apache/camel/pull/11231

   …sors
   
   # Description
   
   Migrated https://github.com/apache/camel/pull/11213 for main branch
   
   # Target
   
   - [ ] I checked that the commit is targeting the correct branch (note that Camel 3 uses `camel-3.x`, whereas Camel 4 uses the `main` branch)
   
   # Tracking
   - [ ] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
   
   <!--
   # *Note*: trivial changes like, typos, minor documentation fixes and other small items do not require a JIRA issue. In this case your pull request should address just this issue, without pulling in other changes.
   -->
   
   # Apache Camel coding standards and style
   
   - [ ] I checked that each commit in the pull request has a meaningful subject line and body.
   
   <!--
   If you're unsure, you can format the pull request title like `[CAMEL-XXX] Fixes bug in camel-file component`, where you replace `CAMEL-XXX` with the appropriate JIRA issue.
   -->
   
   - [ ] I have run `mvn clean install -DskipTests` locally and I have committed all auto-generated changes
   
   <!--
   You can run the aforementioned command in your module so that the build auto-formats your code. This will also be verified as part of the checks and your PR may be rejected if if there are uncommited changes after running `mvn clean install -DskipTests`.
   
   You can learn more about the contribution guidelines at https://github.com/apache/camel/blob/main/CONTRIBUTING.md
   -->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] davsclaus merged pull request #11231: CAMEL-19776 for main(camel-4)

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #11231:
URL: https://github.com/apache/camel/pull/11231


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] orpiske commented on a diff in pull request #11231: CAMEL-19776 for main(camel-4)

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #11231:
URL: https://github.com/apache/camel/pull/11231#discussion_r1308904844


##########
components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/OpenTelemetryTracingStrategyTest.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.camel.opentelemetry;
+
+import java.util.function.Function;
+
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.api.trace.SpanKind;
+import io.opentelemetry.context.Scope;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.InterceptStrategy;
+import org.junit.jupiter.api.Test;
+
+class OpenTelemetryTracingStrategyTest extends CamelOpenTelemetryTestSupport {
+
+    private static SpanTestData[] testdata = {
+            new SpanTestData().setLabel("camel-process").setOperation("third-party-span")
+                    .setParentId(1),
+            new SpanTestData().setLabel("camel-process").setOperation("third-party-processor")
+                    .setParentId(6),
+            new SpanTestData().setLabel("camel-process").setOperation("direct-processor")
+                    .setParentId(3),
+            new SpanTestData().setLabel("direct:serviceB").setOperation("serviceB")
+                    .setParentId(4),
+            new SpanTestData().setLabel("direct:serviceB").setOperation("serviceB")
+                    .setKind(SpanKind.CLIENT)
+                    .setParentId(5),
+            new SpanTestData().setLabel("to:serviceB").setOperation("to-serviceB")
+                    .setParentId(6),
+            new SpanTestData().setLabel("direct:serviceA").setUri("direct://start").setOperation("serviceA")
+                    .setParentId(7),
+            new SpanTestData().setLabel("direct:serviceA").setUri("direct://start").setOperation("serviceA")
+                    .setKind(SpanKind.CLIENT)
+    };
+
+    OpenTelemetryTracingStrategyTest() {
+        super(testdata);
+    }
+
+    @Test
+    void testTracingOfProcessors() {
+        template.requestBody("direct:serviceA", "Hello");
+
+        verify();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:serviceA").routeId("serviceA")
+                        .process(exchange -> {
+                            callThirdPartyInstrumentation();
+                        }).id("third-party-processor")
+                        .to("direct:serviceB").id("to-serviceB");
+
+                from("direct:serviceB").routeId("serviceB")
+                        .process(exchange -> {
+                            Thread.sleep(100);

Review Comment:
   Also, the same note for the other sleep below.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] orpiske commented on a diff in pull request #11231: CAMEL-19776 for main(camel-4)

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #11231:
URL: https://github.com/apache/camel/pull/11231#discussion_r1308899923


##########
components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/OpenTelemetryTracingStrategyTest.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.camel.opentelemetry;
+
+import java.util.function.Function;
+
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.api.trace.SpanKind;
+import io.opentelemetry.context.Scope;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.InterceptStrategy;
+import org.junit.jupiter.api.Test;
+
+class OpenTelemetryTracingStrategyTest extends CamelOpenTelemetryTestSupport {
+
+    private static SpanTestData[] testdata = {
+            new SpanTestData().setLabel("camel-process").setOperation("third-party-span")
+                    .setParentId(1),
+            new SpanTestData().setLabel("camel-process").setOperation("third-party-processor")
+                    .setParentId(6),
+            new SpanTestData().setLabel("camel-process").setOperation("direct-processor")
+                    .setParentId(3),
+            new SpanTestData().setLabel("direct:serviceB").setOperation("serviceB")
+                    .setParentId(4),
+            new SpanTestData().setLabel("direct:serviceB").setOperation("serviceB")
+                    .setKind(SpanKind.CLIENT)
+                    .setParentId(5),
+            new SpanTestData().setLabel("to:serviceB").setOperation("to-serviceB")
+                    .setParentId(6),
+            new SpanTestData().setLabel("direct:serviceA").setUri("direct://start").setOperation("serviceA")
+                    .setParentId(7),
+            new SpanTestData().setLabel("direct:serviceA").setUri("direct://start").setOperation("serviceA")
+                    .setKind(SpanKind.CLIENT)
+    };
+
+    OpenTelemetryTracingStrategyTest() {
+        super(testdata);
+    }
+
+    @Test
+    void testTracingOfProcessors() {
+        template.requestBody("direct:serviceA", "Hello");
+
+        verify();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:serviceA").routeId("serviceA")
+                        .process(exchange -> {
+                            callThirdPartyInstrumentation();
+                        }).id("third-party-processor")
+                        .to("direct:serviceB").id("to-serviceB");
+
+                from("direct:serviceB").routeId("serviceB")
+                        .process(exchange -> {
+                            Thread.sleep(100);

Review Comment:
   Thanks for your contribution!
   
   Please, is there a way, maybe this can be done without the `Thread.sleep`? These hard-coded sleeps are almost always a pain in our CI. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] RuslanHryn commented on a diff in pull request #11231: CAMEL-19776 for main(camel-4)

Posted by "RuslanHryn (via GitHub)" <gi...@apache.org>.
RuslanHryn commented on code in PR #11231:
URL: https://github.com/apache/camel/pull/11231#discussion_r1308955260


##########
components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/OpenTelemetryTracingStrategyTest.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.camel.opentelemetry;
+
+import java.util.function.Function;
+
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.api.trace.SpanKind;
+import io.opentelemetry.context.Scope;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.InterceptStrategy;
+import org.junit.jupiter.api.Test;
+
+class OpenTelemetryTracingStrategyTest extends CamelOpenTelemetryTestSupport {
+
+    private static SpanTestData[] testdata = {
+            new SpanTestData().setLabel("camel-process").setOperation("third-party-span")
+                    .setParentId(1),
+            new SpanTestData().setLabel("camel-process").setOperation("third-party-processor")
+                    .setParentId(6),
+            new SpanTestData().setLabel("camel-process").setOperation("direct-processor")
+                    .setParentId(3),
+            new SpanTestData().setLabel("direct:serviceB").setOperation("serviceB")
+                    .setParentId(4),
+            new SpanTestData().setLabel("direct:serviceB").setOperation("serviceB")
+                    .setKind(SpanKind.CLIENT)
+                    .setParentId(5),
+            new SpanTestData().setLabel("to:serviceB").setOperation("to-serviceB")
+                    .setParentId(6),
+            new SpanTestData().setLabel("direct:serviceA").setUri("direct://start").setOperation("serviceA")
+                    .setParentId(7),
+            new SpanTestData().setLabel("direct:serviceA").setUri("direct://start").setOperation("serviceA")
+                    .setKind(SpanKind.CLIENT)
+    };
+
+    OpenTelemetryTracingStrategyTest() {
+        super(testdata);
+    }
+
+    @Test
+    void testTracingOfProcessors() {
+        template.requestBody("direct:serviceA", "Hello");
+
+        verify();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:serviceA").routeId("serviceA")
+                        .process(exchange -> {
+                            callThirdPartyInstrumentation();
+                        }).id("third-party-processor")
+                        .to("direct:serviceB").id("to-serviceB");
+
+                from("direct:serviceB").routeId("serviceB")
+                        .process(exchange -> {
+                            Thread.sleep(100);

Review Comment:
   Thanks. 
   I've removed sleeps and test is working fine



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] orpiske commented on a diff in pull request #11231: CAMEL-19776 for main(camel-4)

Posted by "orpiske (via GitHub)" <gi...@apache.org>.
orpiske commented on code in PR #11231:
URL: https://github.com/apache/camel/pull/11231#discussion_r1309043383


##########
components/camel-opentelemetry/src/test/java/org/apache/camel/opentelemetry/OpenTelemetryTracingStrategyTest.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.camel.opentelemetry;
+
+import java.util.function.Function;
+
+import io.opentelemetry.api.trace.Span;
+import io.opentelemetry.api.trace.SpanKind;
+import io.opentelemetry.context.Scope;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.spi.InterceptStrategy;
+import org.junit.jupiter.api.Test;
+
+class OpenTelemetryTracingStrategyTest extends CamelOpenTelemetryTestSupport {
+
+    private static SpanTestData[] testdata = {
+            new SpanTestData().setLabel("camel-process").setOperation("third-party-span")
+                    .setParentId(1),
+            new SpanTestData().setLabel("camel-process").setOperation("third-party-processor")
+                    .setParentId(6),
+            new SpanTestData().setLabel("camel-process").setOperation("direct-processor")
+                    .setParentId(3),
+            new SpanTestData().setLabel("direct:serviceB").setOperation("serviceB")
+                    .setParentId(4),
+            new SpanTestData().setLabel("direct:serviceB").setOperation("serviceB")
+                    .setKind(SpanKind.CLIENT)
+                    .setParentId(5),
+            new SpanTestData().setLabel("to:serviceB").setOperation("to-serviceB")
+                    .setParentId(6),
+            new SpanTestData().setLabel("direct:serviceA").setUri("direct://start").setOperation("serviceA")
+                    .setParentId(7),
+            new SpanTestData().setLabel("direct:serviceA").setUri("direct://start").setOperation("serviceA")
+                    .setKind(SpanKind.CLIENT)
+    };
+
+    OpenTelemetryTracingStrategyTest() {
+        super(testdata);
+    }
+
+    @Test
+    void testTracingOfProcessors() {
+        template.requestBody("direct:serviceA", "Hello");
+
+        verify();
+    }
+
+    @Override
+    protected RoutesBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:serviceA").routeId("serviceA")
+                        .process(exchange -> {
+                            callThirdPartyInstrumentation();
+                        }).id("third-party-processor")
+                        .to("direct:serviceB").id("to-serviceB");
+
+                from("direct:serviceB").routeId("serviceB")
+                        .process(exchange -> {
+                            Thread.sleep(100);

Review Comment:
   Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [camel] github-actions[bot] commented on pull request #11231: CAMEL-19776 for main(camel-4)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11231:
URL: https://github.com/apache/camel/pull/11231#issuecomment-1697231010

   :star2: Thank you for your contribution to the Apache Camel project! :star2: 
   
   :camel: Maintainers, please note that first-time contributors *require manual approval* for the GitHub Actions to run.
   
   :warning: Please note that the changes on this PR may be **tested automatically** if they change components.
   
   :robot: Use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot.
   
   If necessary Apache Camel Committers may access logs and test results in the job summaries!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org