This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch camel-main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 3d9e0176ca3af9b39cfbb5d9f16fdd7bccd1e929 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 | 109 +++++++++++++++ .../observability-services/deployment/pom.xml | 99 ++++++++++++++ .../deployment/ObservabilityServicesProcessor.java | 30 +++++ .../deployment/MicroProfileHealthEnabledTest.java | 72 ++++++++++ .../MicrometerMetricsConfigDefaultsTest.java | 111 +++++++++++++++ .../deployment/OpenTelemetryEnabledTest.java | 62 +++++++++ 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 + 26 files changed, 1135 insertions(+) diff --git a/catalog/pom.xml b/catalog/pom.xml index 0e900a5ed1..5563067cf2 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 e5da3c0da7..8640204e61 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..061c73255c --- /dev/null +++ b/docs/modules/ROOT/pages/reference/extensions/observability-services.adoc @@ -0,0 +1,109 @@ +// 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.18.0 +:cq-native-since: 3.18.0 + +ifeval::[{doc-show-badges} == true] +[.badges] +[.badge-key]##JVM since##[.badge-supported]##3.18.0## [.badge-key]##Native since##[.badge-supported]##3.18.0## +endif::[] + +Camel Observability Services + +[id="extensions-observability-services-whats-inside"] +== What's inside + +* xref:{cq-camel-components}:others:observability-services.adoc[Observability Services] + +Please refer to the above link for usage and configuration details. + +[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 +* Camel Quarkus Management +* Camel Quarkus Micrometer +* Camel Quarkus OpenTelemetry +* Quarkus Micrometer Registry Prometheus + +[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..308de647f3 --- /dev/null +++ b/extensions/observability-services/deployment/pom.xml @@ -0,0 +1,99 @@ +<?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.18.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> + + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit5-internal</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-security-deployment</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-vertx-http</artifactId> + <scope>test</scope> + </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/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicroProfileHealthEnabledTest.java b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicroProfileHealthEnabledTest.java new file mode 100644 index 0000000000..e8c1b50d43 --- /dev/null +++ b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicroProfileHealthEnabledTest.java @@ -0,0 +1,72 @@ +/* + * 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.test.QuarkusUnitTest; +import jakarta.inject.Inject; +import org.apache.camel.CamelContext; +import org.apache.camel.health.HealthCheckRegistry; +import org.apache.camel.impl.health.ConsumersHealthCheckRepository; +import org.apache.camel.impl.health.ContextHealthCheck; +import org.apache.camel.impl.health.RoutesHealthCheckRepository; +import org.apache.camel.microprofile.health.CamelMicroProfileHealthCheckRegistry; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class MicroProfileHealthEnabledTest { + + @RegisterExtension + static final QuarkusUnitTest CONFIG = new QuarkusUnitTest() + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); + + @Inject + CamelContext context; + + @Test + public void healthCheckRegistryNotNull() { + HealthCheckRegistry registry = HealthCheckRegistry.get(context); + assertNotNull(registry); + assertTrue(registry instanceof CamelMicroProfileHealthCheckRegistry); + assertEquals("camel-microprofile-health", registry.getId()); + } + + @Test + public void contextHealthCheckNotNull() { + ContextHealthCheck contextHealthCheck = context.getRegistry().lookupByNameAndType("context", ContextHealthCheck.class); + assertNotNull(contextHealthCheck); + } + + @Test + public void routesHealthCheckNotNull() { + RoutesHealthCheckRepository routesRepository = context.getRegistry().lookupByNameAndType("routes", + RoutesHealthCheckRepository.class); + assertNotNull(routesRepository); + } + + @Test + public void consumersHealthCheckNotNull() { + ConsumersHealthCheckRepository consumersRepository = context.getRegistry().lookupByNameAndType("consumers", + ConsumersHealthCheckRepository.class); + assertNotNull(consumersRepository); + } +} diff --git a/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicrometerMetricsConfigDefaultsTest.java b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicrometerMetricsConfigDefaultsTest.java new file mode 100644 index 0000000000..048ea8110b --- /dev/null +++ b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/MicrometerMetricsConfigDefaultsTest.java @@ -0,0 +1,111 @@ +/* + * 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 java.util.List; +import java.util.Optional; + +import io.quarkus.test.QuarkusUnitTest; +import jakarta.inject.Inject; +import org.apache.camel.CamelContext; +import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifier; +import org.apache.camel.component.micrometer.eventnotifier.MicrometerExchangeEventNotifierNamingStrategy; +import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifier; +import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifierNamingStrategy; +import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyConfiguration; +import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyFactory; +import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyNamingStrategy; +import org.apache.camel.component.micrometer.spi.InstrumentedThreadPoolFactory; +import org.apache.camel.impl.engine.DefaultMessageHistoryFactory; +import org.apache.camel.spi.EventNotifier; +import org.apache.camel.spi.MessageHistoryFactory; +import org.apache.camel.spi.RoutePolicyFactory; +import org.apache.camel.spi.ThreadPoolFactory; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class MicrometerMetricsConfigDefaultsTest { + + @RegisterExtension + static final QuarkusUnitTest CONFIG = new QuarkusUnitTest() + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); + + @Inject + CamelContext context; + + @Test + public void testMicrometerMetricsConfiguration() { + List<RoutePolicyFactory> routePolicyFactories = context.getRoutePolicyFactories(); + assertEquals(1, routePolicyFactories.size()); + RoutePolicyFactory routePolicyFactory = routePolicyFactories.get(0); + assertInstanceOf(MicrometerRoutePolicyFactory.class, routePolicyFactory); + MicrometerRoutePolicyFactory micrometerRoutePolicyFactory = (MicrometerRoutePolicyFactory) routePolicyFactory; + assertEquals(MicrometerRoutePolicyNamingStrategy.DEFAULT, micrometerRoutePolicyFactory.getNamingStrategy()); + + MicrometerRoutePolicyConfiguration policyConfiguration = micrometerRoutePolicyFactory.getPolicyConfiguration(); + assertTrue(policyConfiguration.isContextEnabled()); + assertTrue(policyConfiguration.isRouteEnabled()); + assertNull(policyConfiguration.getExcludePattern()); + + MessageHistoryFactory messageHistoryFactory = context.getMessageHistoryFactory(); + assertNotNull(messageHistoryFactory); + assertInstanceOf(DefaultMessageHistoryFactory.class, messageHistoryFactory); + + List<EventNotifier> eventNotifiers = context.getManagementStrategy() + .getEventNotifiers() + .stream() + .filter(eventNotifier -> !eventNotifier.getClass().getName().contains("BaseMainSupport")) + .toList(); + assertEquals(3, eventNotifiers.size()); + + Optional<EventNotifier> optionalExchangeEventNotifier = context.getManagementStrategy() + .getEventNotifiers() + .stream() + .filter(eventNotifier -> eventNotifier.getClass().equals(MicrometerExchangeEventNotifier.class)) + .findFirst(); + assertTrue(optionalExchangeEventNotifier.isPresent()); + + MicrometerExchangeEventNotifier micrometerExchangeEventNotifier = (MicrometerExchangeEventNotifier) optionalExchangeEventNotifier + .get(); + assertEquals(MicrometerExchangeEventNotifierNamingStrategy.DEFAULT, + micrometerExchangeEventNotifier.getNamingStrategy()); + + Optional<EventNotifier> optionalRouteEventNotifier = context.getManagementStrategy() + .getEventNotifiers() + .stream() + .filter(eventNotifier -> eventNotifier.getClass().equals(MicrometerRouteEventNotifier.class)) + .findFirst(); + assertTrue(optionalRouteEventNotifier.isPresent()); + + MicrometerRouteEventNotifier micrometerRouteEventNotifier = (MicrometerRouteEventNotifier) optionalRouteEventNotifier + .get(); + assertEquals(MicrometerRouteEventNotifierNamingStrategy.DEFAULT, micrometerRouteEventNotifier.getNamingStrategy()); + + ThreadPoolFactory threadPoolFactory = context.getExecutorServiceManager().getThreadPoolFactory(); + assertNotNull(threadPoolFactory); + assertFalse(threadPoolFactory instanceof InstrumentedThreadPoolFactory); + } +} diff --git a/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/OpenTelemetryEnabledTest.java b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/OpenTelemetryEnabledTest.java new file mode 100644 index 0000000000..b4c3f01062 --- /dev/null +++ b/extensions/observability-services/deployment/src/test/java/org/apache/camel/quarkus/component/observabilityservices/deployment/OpenTelemetryEnabledTest.java @@ -0,0 +1,62 @@ +/* + * 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 java.util.Set; + +import io.quarkus.test.QuarkusUnitTest; +import jakarta.inject.Inject; +import org.apache.camel.CamelContext; +import org.apache.camel.opentelemetry.CamelQuarkusOpenTelemetryTracer; +import org.apache.camel.opentelemetry.OpenTelemetryTracer; +import org.apache.camel.opentelemetry.OpenTelemetryTracingStrategy; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class OpenTelemetryEnabledTest { + + private static final String EXCLUDE_PATTERNS = "platform-http:*,platform-http:/prefix/.*"; + + @RegisterExtension + static final QuarkusUnitTest CONFIG = new QuarkusUnitTest() + .overrideConfigKey("quarkus.otel.sdk.disabled", "false") + .overrideConfigKey("quarkus.camel.opentelemetry.encoding", "true") + .overrideConfigKey("quarkus.camel.opentelemetry.exclude-patterns", EXCLUDE_PATTERNS) + .overrideConfigKey("quarkus.camel.opentelemetry.trace-processors", "true") + .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)); + + @Inject + CamelContext context; + + @Test + public void camelOpenTelemetryTracerRegistryBeanNotNull() { + Set<OpenTelemetryTracer> tracers = context.getRegistry().findByType(OpenTelemetryTracer.class); + assertEquals(1, tracers.size()); + + OpenTelemetryTracer tracer = tracers.iterator().next(); + assertInstanceOf(CamelQuarkusOpenTelemetryTracer.class, tracer); + assertInstanceOf(OpenTelemetryTracingStrategy.class, tracer.getTracingStrategy()); + assertTrue(tracer.isEncoding()); + assertEquals(EXCLUDE_PATTERNS, tracer.getExcludePatterns()); + } +} diff --git a/extensions/observability-services/pom.xml b/extensions/observability-services/pom.xml new file mode 100644 index 0000000000..01f15c6a60 --- /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.18.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..c4d65748b4 --- /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.18.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.18.0</camel.quarkus.jvmSince> + <camel.quarkus.nativeSince>3.18.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..2718ae7d0e --- /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 +* Camel Quarkus Management +* Camel Quarkus Micrometer +* Camel Quarkus OpenTelemetry +* Quarkus Micrometer Registry Prometheus + +=== 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 11786faa73..9a7f657bb2 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..2dca8a7ebd --- /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.18.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 11aafa3676..b4ae52a2ad 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 e2c274a7b0..dc8d2a428b 100644 --- a/poms/bom/pom.xml +++ b/poms/bom/pom.xml @@ -2072,6 +2072,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> @@ -5099,6 +5104,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 22537b4c25..9b9d7c46fa 100644 --- a/poms/bom/src/main/generated/flattened-full-pom.xml +++ b/poms/bom/src/main/generated/flattened-full-pom.xml @@ -2008,6 +2008,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.10.0-SNAPSHOT</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} --> @@ -5023,6 +5028,16 @@ <artifactId>camel-quarkus-oaipmh-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>3.18.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.18.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.18.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 b0686888bf..a074fa909b 100644 --- a/poms/bom/src/main/generated/flattened-reduced-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml @@ -5018,6 +5018,16 @@ <artifactId>camel-quarkus-oaipmh-deployment</artifactId> <version>3.18.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services</artifactId> + <version>3.18.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-observability-services-deployment</artifactId> + <version>3.18.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 72960a34dc..0ae5b55fea 100644 --- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml +++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml @@ -5018,6 +5018,16 @@ <artifactId>camel-quarkus-oaipmh-deployment</artifactId><!-- org.apache.camel.quarkus:camel-quarkus-bom:${project.version} --> <version>3.18.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.18.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.18.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