This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push: new bc8e373d07 feat(extension): onboard Observability Services bc8e373d07 is described below commit bc8e373d07ea17bc23df4e41fe1a3500130d89be Author: Pasquale Congiusti <pasquale.congiu...@gmail.com> AuthorDate: Tue Dec 10 14:50:52 2024 +0100 feat(extension): onboard Observability Services Closes #6790 --- catalog/pom.xml | 13 ++ .../examples/others/observability-services.yml | 13 ++ docs/modules/ROOT/nav.adoc | 1 + .../extensions/observability-services.adoc | 102 ++++++++++++++ .../observability-services/deployment/pom.xml | 83 ++++++++++++ .../deployment/ObservabilityServicesProcessor.java | 30 +++++ extensions/observability-services/pom.xml | 39 ++++++ extensions/observability-services/runtime/pom.xml | 117 ++++++++++++++++ .../runtime/src/main/doc/usage.adoc | 56 ++++++++ .../main/resources/META-INF/quarkus-extension.yaml | 33 +++++ .../src/main/resources/application.properties | 20 +++ extensions/pom.xml | 1 + integration-tests/observability-services/pom.xml | 149 +++++++++++++++++++++ .../ObservabilityServicesHealthRouteBuilder.java | 40 ++++++ .../src/main/resources/application.properties | 24 ++++ .../it/ObservabilityServicesDefaultTest.java | 70 ++++++++++ .../it/ObservabilityServicesIT.java | 24 ++++ integration-tests/pom.xml | 1 + poms/bom/pom.xml | 15 +++ poms/bom/src/main/generated/flattened-full-pom.xml | 15 +++ .../src/main/generated/flattened-reduced-pom.xml | 10 ++ .../generated/flattened-reduced-verbose-pom.xml | 10 ++ tooling/scripts/test-categories.yaml | 1 + 23 files changed, 867 insertions(+) diff --git a/catalog/pom.xml b/catalog/pom.xml index df7d74b3b2..fcabb09df6 100644 --- a/catalog/pom.xml +++ b/catalog/pom.xml @@ -2866,6 +2866,19 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-ognl</artifactId> diff --git a/docs/modules/ROOT/examples/others/observability-services.yml b/docs/modules/ROOT/examples/others/observability-services.yml new file mode 100644 index 0000000000..293a3fd7c8 --- /dev/null +++ b/docs/modules/ROOT/examples/others/observability-services.yml @@ -0,0 +1,13 @@ +# Do not edit directly! +# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page +cqArtifactId: camel-quarkus-observability-services +cqArtifactIdBase: observability-services +cqNativeSupported: true +cqStatus: Stable +cqDeprecated: false +cqJvmSince: 3.18.0 +cqNativeSince: 3.18.0 +cqCamelPartName: observability-services +cqCamelPartTitle: Observability Services +cqCamelPartDescription: Camel Observability Services +cqExtensionPageTitle: Observability Services diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc index 6710c88c6b..15fce24d7a 100644 --- a/docs/modules/ROOT/nav.adoc +++ b/docs/modules/ROOT/nav.adoc @@ -228,6 +228,7 @@ *** xref:reference/extensions/nitrite.adoc[Nitrite] *** xref:reference/extensions/oaipmh.adoc[OAI-PMH] *** xref:reference/extensions/ognl.adoc[OGNL] +*** xref:reference/extensions/observability-services.adoc[Observability Services] *** xref:reference/extensions/olingo4.adoc[Olingo4] *** xref:reference/extensions/openapi-java.adoc[OpenAPI Java] *** xref:reference/extensions/opensearch.adoc[OpenSearch] diff --git a/docs/modules/ROOT/pages/reference/extensions/observability-services.adoc b/docs/modules/ROOT/pages/reference/extensions/observability-services.adoc new file mode 100644 index 0000000000..8adcc19466 --- /dev/null +++ b/docs/modules/ROOT/pages/reference/extensions/observability-services.adoc @@ -0,0 +1,102 @@ +// Do not edit directly! +// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page +[id="extensions-observability-services"] += Observability Services +:linkattrs: +:cq-artifact-id: camel-quarkus-observability-services +:cq-native-supported: true +:cq-status: Stable +:cq-status-deprecation: Stable +:cq-description: Camel Observability Services +:cq-deprecated: false +:cq-jvm-since: 3.19.0 +:cq-native-since: 3.19.0 + +ifeval::[{doc-show-badges} == true] +[.badges] +[.badge-key]##JVM since##[.badge-supported]##3.19.0## [.badge-key]##Native since##[.badge-supported]##3.19.0## +endif::[] + +Camel Observability Services + +[id="extensions-observability-services-maven-coordinates"] +== Maven coordinates + +https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-observability-services[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"] + +Or add the coordinates to your existing project: + +[source,xml] +---- +<dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services</artifactId> +</dependency> +---- +ifeval::[{doc-show-user-guide-link} == true] +Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications. +endif::[] + +[id="extensions-observability-services-usage"] +== Usage +This extension is used to provide a set of opinionated components and configuration which simplify operations such as observability on cloud environments. Although the component is mainly targeted for cloud, it can be used in any other environment, giving to the Camel application the capability to expose a set of observability features by default. + +All you need to do is to add the dependency to the classpath. There's no need to add any further configuration. Each individual component will be configured using each own default settings except the endpoint which will be exposed in */observe/<service>* by default. + +If you need to customize each of the different components provided within this service, then, you can specify in the *application.properties* each of the configuration as it would be done normally when you provide the individual component. + +[id="extensions-observability-services-usage-components"] +== Components + +The presence of this dependency will provide the following extensions: + +* Camel Quarkus MicroProfile Health - for health checks +* Camel Quarkus Management - for JMX +* Camel Quarkus Micrometer - for Camel Micrometer metrics +* Camel Quarkus OpenTelemetry - for tracing Camel messages (events/spans) +* Quarkus Micrometer Registry Prometheus - for exporting metrics in Prometheus format + +[id="extensions-observability-services-usage-list-of-known-endpoints"] +=== List of known endpoints + +The presence of this dependency will expose the following endpoints: + +|==== +|Endpoint | Description + +| `/observe/health` | startup probe endpoint +| `/observe/health/live` | liveness probe endpoint +| `/observe/health/ready` | readiness probe endpoint +| `/observe/metrics` | metrics exposed as in Micrometer Prometheus Registry + +|==== + +NOTE: You can configure the endpoints as you'd do normally within each extension configuration. + +[id="extensions-observability-services-usage-opentelemetry-configuration"] +== OpenTelemetry configuration + +The presence of this component will provide the required instrumentation to easily enable the collection of Opentelemetry metrics. The Camel Quarkus Opentelemetry extension instrument your application with a service which periodically pushes OTEL traces to the collector. This is disabled by default in order to prevent the application to push traces when no telemetry server is available. + +In order to turn it on, you need to specify the following configuration explicitly: + +``` +quarkus.otel.sdk.disabled=false +``` + +Beside that, you can change any further parameter, like, for instance, the server where to push the traces (default, `http://localhost:4317`) + +``` +quarkus.otel.exporter.otlp.traces.endpoint=http://my-otel-collector.svc:4317 +``` + +NOTE: Quarkus runtime defaults to gRPC protocol (port 4317). + +[id="extensions-observability-services-usage-jmx-configuration"] +== JMX configuration + +The presence of this component implies the presence of `camel-management` component. This is in charge to include information about Camel application status in JMX format. + +NOTE: The presence of this components automatically enable the collection of the JMX metrics. This should be negligible from performance point of view, however, you may want to disable that running the application with `-Dorg.apache.camel.jmx.disabled=true` JVM option. + + diff --git a/extensions/observability-services/deployment/pom.xml b/extensions/observability-services/deployment/pom.xml new file mode 100644 index 0000000000..7b45e223ac --- /dev/null +++ b/extensions/observability-services/deployment/pom.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services-parent</artifactId> + <version>3.19.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-observability-services-deployment</artifactId> + <name>Camel Quarkus :: Observability Services :: Deployment</name> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-micrometer-deployment</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-micrometer-registry-prometheus-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-microprofile-health-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-opentelemetry-deployment</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-management-deployment</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/extensions/observability-services/deployment/src/main/java/org/apache/camel/quarkus/component/observabilityservices/deployment/ObservabilityServicesProcessor.java b/extensions/observability-services/deployment/src/main/java/org/apache/camel/quarkus/component/observabilityservices/deployment/ObservabilityServicesProcessor.java new file mode 100644 index 0000000000..b599823fd1 --- /dev/null +++ b/extensions/observability-services/deployment/src/main/java/org/apache/camel/quarkus/component/observabilityservices/deployment/ObservabilityServicesProcessor.java @@ -0,0 +1,30 @@ +/* + * 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.quarkus.component.observabilityservices.deployment; + +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.builditem.FeatureBuildItem; + +class ObservabilityServicesProcessor { + + private static final String FEATURE = "camel-observability-services"; + + @BuildStep + FeatureBuildItem feature() { + return new FeatureBuildItem(FEATURE); + } +} diff --git a/extensions/observability-services/pom.xml b/extensions/observability-services/pom.xml new file mode 100644 index 0000000000..0682215389 --- /dev/null +++ b/extensions/observability-services/pom.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-extensions</artifactId> + <version>3.19.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-observability-services-parent</artifactId> + <name>Camel Quarkus :: Observability Services</name> + <packaging>pom</packaging> + + <modules> + <module>deployment</module> + <module>runtime</module> + </modules> +</project> diff --git a/extensions/observability-services/runtime/pom.xml b/extensions/observability-services/runtime/pom.xml new file mode 100644 index 0000000000..f27fcbb42e --- /dev/null +++ b/extensions/observability-services/runtime/pom.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services-parent</artifactId> + <version>3.19.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-observability-services</artifactId> + <name>Camel Quarkus :: Observability Services :: Runtime</name> + <description>Camel Observability Services</description> + + <properties> + <camel.quarkus.jvmSince>3.19.0</camel.quarkus.jvmSince> + <camel.quarkus.nativeSince>3.19.0</camel.quarkus.nativeSince> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-micrometer</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-micrometer-registry-prometheus</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-microprofile-health</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-opentelemetry</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-management</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-extension-processor</artifactId> + <version>${quarkus.version}</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + + + <profiles> + <profile> + <id>full</id> + <activation> + <property> + <name>!quickly</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-maven-plugin</artifactId> + <executions> + <execution> + <id>update-extension-doc-page</id> + <goals> + <goal>update-extension-doc-page</goal> + </goals> + <phase>process-classes</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/extensions/observability-services/runtime/src/main/doc/usage.adoc b/extensions/observability-services/runtime/src/main/doc/usage.adoc new file mode 100644 index 0000000000..868c7059ad --- /dev/null +++ b/extensions/observability-services/runtime/src/main/doc/usage.adoc @@ -0,0 +1,56 @@ +This extension is used to provide a set of opinionated components and configuration which simplify operations such as observability on cloud environments. Although the component is mainly targeted for cloud, it can be used in any other environment, giving to the Camel application the capability to expose a set of observability features by default. + +All you need to do is to add the dependency to the classpath. There's no need to add any further configuration. Each individual component will be configured using each own default settings except the endpoint which will be exposed in */observe/<service>* by default. + +If you need to customize each of the different components provided within this service, then, you can specify in the *application.properties* each of the configuration as it would be done normally when you provide the individual component. + +== Components + +The presence of this dependency will provide the following extensions: + +* Camel Quarkus MicroProfile Health - for health checks +* Camel Quarkus Management - for JMX +* Camel Quarkus Micrometer - for Camel Micrometer metrics +* Camel Quarkus OpenTelemetry - for tracing Camel messages (events/spans) +* Quarkus Micrometer Registry Prometheus - for exporting metrics in Prometheus format + +=== List of known endpoints + +The presence of this dependency will expose the following endpoints: + +|==== +|Endpoint | Description + +| `/observe/health` | startup probe endpoint +| `/observe/health/live` | liveness probe endpoint +| `/observe/health/ready` | readiness probe endpoint +| `/observe/metrics` | metrics exposed as in Micrometer Prometheus Registry + +|==== + +NOTE: You can configure the endpoints as you'd do normally within each extension configuration. + +== OpenTelemetry configuration + +The presence of this component will provide the required instrumentation to easily enable the collection of Opentelemetry metrics. The Camel Quarkus Opentelemetry extension instrument your application with a service which periodically pushes OTEL traces to the collector. This is disabled by default in order to prevent the application to push traces when no telemetry server is available. + +In order to turn it on, you need to specify the following configuration explicitly: + +``` +quarkus.otel.sdk.disabled=false +``` + +Beside that, you can change any further parameter, like, for instance, the server where to push the traces (default, `http://localhost:4317`) + +``` +quarkus.otel.exporter.otlp.traces.endpoint=http://my-otel-collector.svc:4317 +``` + +NOTE: Quarkus runtime defaults to gRPC protocol (port 4317). + +== JMX configuration + +The presence of this component implies the presence of `camel-management` component. This is in charge to include information about Camel application status in JMX format. + +NOTE: The presence of this components automatically enable the collection of the JMX metrics. This should be negligible from performance point of view, however, you may want to disable that running the application with `-Dorg.apache.camel.jmx.disabled=true` JVM option. + diff --git a/extensions/observability-services/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/observability-services/runtime/src/main/resources/META-INF/quarkus-extension.yaml new file mode 100644 index 0000000000..d6b2f1d219 --- /dev/null +++ b/extensions/observability-services/runtime/src/main/resources/META-INF/quarkus-extension.yaml @@ -0,0 +1,33 @@ +# +# 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. +# + +# This is a generated file. Do not edit directly! +# To re-generate, run the following command from the top level directory: +# +# mvn -N cq:update-quarkus-metadata +# +--- +name: "Camel Observability Services" +description: "Camel Observability Services" +metadata: + icon-url: "https://raw.githubusercontent.com/apache/camel-website/main/antora-ui-camel/src/img/logo-d.svg" + sponsor: "Apache Software Foundation" + guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/observability-services.html" + categories: + - "integration" + status: + - "stable" diff --git a/extensions/observability-services/runtime/src/main/resources/application.properties b/extensions/observability-services/runtime/src/main/resources/application.properties new file mode 100644 index 0000000000..37437c7b2c --- /dev/null +++ b/extensions/observability-services/runtime/src/main/resources/application.properties @@ -0,0 +1,20 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- +quarkus.micrometer.export.prometheus.path=/observe/metrics +quarkus.smallrye-health.root-path=/observe/health +# Default is disabled: the user must enable it to push traces to the given server +quarkus.otel.sdk.disabled=true \ No newline at end of file diff --git a/extensions/pom.xml b/extensions/pom.xml index a3475910e6..9368ae6f8e 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -193,6 +193,7 @@ <module>netty-http</module> <module>nitrite</module> <module>oaipmh</module> + <module>observability-services</module> <module>ognl</module> <module>olingo4</module> <module>openapi-java</module> diff --git a/integration-tests/observability-services/pom.xml b/integration-tests/observability-services/pom.xml new file mode 100644 index 0000000000..ea73469981 --- /dev/null +++ b/integration-tests/observability-services/pom.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-build-parent-it</artifactId> + <version>3.19.0-SNAPSHOT</version> + <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-integration-test-observability-services</artifactId> + <name>Camel Quarkus :: Integration Tests :: Observability Services</name> + <description>Integration tests for Camel Quarkus Observability Services extension</description> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-log</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services</artifactId> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> + </dependency> + + <!-- test dependencies --> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>native</id> + <activation> + <property> + <name>native</name> + </property> + </activation> + <properties> + <quarkus.native.enabled>true</quarkus.native.enabled> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>virtualDependencies</id> + <activation> + <property> + <name>!noVirtualDependencies</name> + </property> + </activation> + <dependencies> + <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory --> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-log-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + </profile> + </profiles> + +</project> diff --git a/integration-tests/observability-services/src/main/java/org/apache/camel/quarkus/component/observabilityservices/it/health/ObservabilityServicesHealthRouteBuilder.java b/integration-tests/observability-services/src/main/java/org/apache/camel/quarkus/component/observabilityservices/it/health/ObservabilityServicesHealthRouteBuilder.java new file mode 100644 index 0000000000..0156316ab3 --- /dev/null +++ b/integration-tests/observability-services/src/main/java/org/apache/camel/quarkus/component/observabilityservices/it/health/ObservabilityServicesHealthRouteBuilder.java @@ -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.camel.quarkus.component.observabilityservices.it.health; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.spi.SupervisingRouteController; + +public class ObservabilityServicesHealthRouteBuilder extends RouteBuilder { + @Override + public void configure() { + from("direct:start").routeId("healthyRoute") + .setBody(constant("Hello Camel Quarkus")); + + from("direct:disabled").routeId("disabledHealthRoute") + .log("This route will not show up in health checks as it is disabled in application.properties"); + + if (getContext().getRouteController() instanceof SupervisingRouteController) { + from("direct:supervising").routeId("supervisingRoute") + .to("log:end"); + + // Force a failure for SupervisingRouteController to try and recover (duplicate consumer on the same endpoint) + from("direct:supervising?timeout=100").routeId("brokenRoute") + .to("log:end"); + } + } +} diff --git a/integration-tests/observability-services/src/main/resources/application.properties b/integration-tests/observability-services/src/main/resources/application.properties new file mode 100644 index 0000000000..526e9a9a8d --- /dev/null +++ b/integration-tests/observability-services/src/main/resources/application.properties @@ -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. +## --------------------------------------------------------------------------- + +# +# Camel +# +camel.context.name = quarkus-camel-example + +# Prevent unwanted routes appearing in the health check output +camel.health.exclude-pattern = disabledHealthRoute diff --git a/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesDefaultTest.java b/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesDefaultTest.java new file mode 100644 index 0000000000..cd1589aefc --- /dev/null +++ b/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesDefaultTest.java @@ -0,0 +1,70 @@ +/* + * 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.quarkus.component.observabilityservices.it; + +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; +import org.apache.http.HttpStatus; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; + +@QuarkusTest +class ObservabilityServicesDefaultTest { + + @Test + public void testHealthUpStatus() { + RestAssured.when().get("/observe/health").then() + .contentType(ContentType.JSON) + .header("Content-Type", containsString("charset=UTF-8")) + .body("status", is("UP"), + "checks.status.findAll().unique()", contains("UP"), + "checks.find { it.name == 'camel-routes' }", notNullValue(), + "checks.find { it.name == 'camel-consumers' }", notNullValue(), + "checks.find { it.name == 'context' }", notNullValue(), + "checks.find { it.name == 'context' }.data.'context.name'", notNullValue()); + } + + @Test + public void testLivenessUpStatus() { + RestAssured.when().get("/observe/health/live").then() + .contentType(ContentType.JSON) + .header("Content-Type", containsString("charset=UTF-8")) + .body("status", is("UP"), + "checks.status.findAll().unique()", contains("UP")); + } + + @Test + public void testReadinessUpStatus() { + RestAssured.when().get("/observe/health/ready").then() + .contentType(ContentType.JSON) + .header("Content-Type", containsString("charset=UTF-8")) + .body("status", is("UP"), + "checks.status.findAll().unique()", contains("UP")); + } + + @Test + public void testMetricsStatus() { + RestAssured.when().get("/observe/metrics").then() + .header("Content-Type", containsString("application/openmetrics-text")) + .statusCode(HttpStatus.SC_OK); + } +} diff --git a/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesIT.java b/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesIT.java new file mode 100644 index 0000000000..c1a786b925 --- /dev/null +++ b/integration-tests/observability-services/src/test/java/org/apache/camel/quarkus/component/observabilityservices/it/ObservabilityServicesIT.java @@ -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.camel.quarkus.component.observabilityservices.it; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +class ObservabilityServicesIT extends ObservabilityServicesDefaultTest { + +} diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index b86d24021f..1d08f66102 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -173,6 +173,7 @@ <module>netty</module> <module>nitrite</module> <module>oaipmh</module> + <module>observability-services</module> <module>ognl</module> <module>olingo4</module> <module>openapi-java</module> diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml index d157354f08..c2440e8e06 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -2075,6 +2075,11 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-observability-services</artifactId> + <version>${camel.version}</version> + </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-ognl</artifactId> @@ -5117,6 +5122,16 @@ <artifactId>camel-quarkus-oaipmh-deployment</artifactId> <version>${camel-quarkus.version}</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services-deployment</artifactId> + <version>${camel-quarkus.version}</version> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-ognl</artifactId> diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml b/poms/bom/src/main/generated/flattened-full-pom.xml index 2a21010968..8a78ab2f2c 100644 --- a/poms/bom/src/main/generated/flattened-full-pom.xml +++ b/poms/bom/src/main/generated/flattened-full-pom.xml @@ -2012,6 +2012,11 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-observability-services</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>4.9.0</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-ognl</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> @@ -5042,6 +5047,16 @@ <artifactId>camel-quarkus-oaipmh-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>3.19.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-observability-services</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.19.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-observability-services-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.19.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-quarkus-ognl</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml b/poms/bom/src/main/generated/flattened-reduced-pom.xml index 56211de18e..674a812468 100644 --- a/poms/bom/src/main/generated/flattened-reduced-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml @@ -5037,6 +5037,16 @@ <artifactId>camel-quarkus-oaipmh-deployment</artifactId> <version>3.19.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services</artifactId> + <version>3.19.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services-deployment</artifactId> + <version>3.19.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-ognl</artifactId> diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml index f60ed19471..2af22074e2 100644 --- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml @@ -5037,6 +5037,16 @@ <artifactId>camel-quarkus-oaipmh-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>3.19.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-observability-services</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.19.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <artifactId>camel-quarkus-observability-services-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + <version>3.19.0-SNAPSHOT</version><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <artifactId>camel-quarkus-ognl</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml index a1c6419487..e280e67051 100644 --- a/tooling/scripts/test-categories.yaml +++ b/tooling/scripts/test-categories.yaml @@ -85,6 +85,7 @@ group-04: - mongodb-grouped - mybatis - sjms-artemis-client + - observability-services group-05: - avro - base64