From ad2bcd0a8f36053a35954205bb212ef1f9fd750f Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Thu, 14 Nov 2024 12:29:51 +0100 Subject: [PATCH] feat(components): add camel-observability-services Closes CAMEL-21384 --- bom/camel-bom/pom.xml | 5 ++ catalog/camel-allcomponents/pom.xml | 5 ++ .../camel-observability-services/pom.xml | 46 +++++++++++++++++++ .../src/main/docs/observability-services.adoc | 39 ++++++++++++++++ .../observability-services.properties | 21 +++++++++ components/pom.xml | 4 +- .../apache/camel/main/BaseMainSupport.java | 3 +- .../org/apache/camel/main/MainConstants.java | 1 + docs/components/modules/others/nav.adoc | 1 + .../others/pages/observability-services.adoc | 1 + parent/pom.xml | 9 +++- 11 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 components/camel-observability-services/pom.xml create mode 100644 components/camel-observability-services/src/main/docs/observability-services.adoc create mode 100644 components/camel-observability-services/src/main/resources/observability-services.properties create mode 120000 docs/components/modules/others/pages/observability-services.adoc diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 76070c7d72dfc..98040001f2085 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -1512,6 +1512,11 @@ camel-oaipmh 4.9.0-SNAPSHOT + + org.apache.camel + camel-observability-services + 4.9.0-SNAPSHOT + org.apache.camel camel-observation diff --git a/catalog/camel-allcomponents/pom.xml b/catalog/camel-allcomponents/pom.xml index b2a24b6b6df1b..c7298fa629561 100644 --- a/catalog/camel-allcomponents/pom.xml +++ b/catalog/camel-allcomponents/pom.xml @@ -1326,6 +1326,11 @@ camel-oaipmh ${project.version} + + org.apache.camel + camel-observability-services + ${project.version} + org.apache.camel camel-observation diff --git a/components/camel-observability-services/pom.xml b/components/camel-observability-services/pom.xml new file mode 100644 index 0000000000000..3e3fd3b81e58e --- /dev/null +++ b/components/camel-observability-services/pom.xml @@ -0,0 +1,46 @@ + + + + 4.0.0 + + + org.apache.camel + components + 4.9.0-SNAPSHOT + + + camel-observability-services + jar + Camel :: Observability Services + Camel Observability Services for Camel Main + + + 4.9.0 + + + + + org.apache.camel + camel-micrometer-prometheus + + + + diff --git a/components/camel-observability-services/src/main/docs/observability-services.adoc b/components/camel-observability-services/src/main/docs/observability-services.adoc new file mode 100644 index 0000000000000..94905c8255187 --- /dev/null +++ b/components/camel-observability-services/src/main/docs/observability-services.adoc @@ -0,0 +1,39 @@ += Observability Services Component +:doctitle: Observability Services +:shortname: observability-services +:artifactid: camel-observability-services +:description: Camel Observability Services for Camel Main +:since: 4.9 +:supportlevel: Stable +:tabs-sync-option: + +*Since Camel {since}* + +The Camel Observability Services component is used to run Camel standalone (Camel Main) and 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. + +== Usage + +=== Auto-detection from classpath + +All you need to do is to add the `camel-observability-services` 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 `/camel/` 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. + +WARNING: the customization of the configuration for this component is not available for Spring Boot runtime due to a https://github.com/spring-projects/spring-boot/issues/24688[known limitation]. You can use this component in Spring Boot runtime with the default settings only. If you need to provide any customization, you'll need to provide each component and configuration accordingly. + +== Components available + +The presence of this dependency will provide the following components: + +* camel-micrometer-prometheus + +=== List of known endpoints + +The presence of this dependency will expose the following endpoints: + +|==== +|Endpoint | Description + +| `/camel/metrics` | metrics exposed as in Micrometer Prometheus Registry + +|==== diff --git a/components/camel-observability-services/src/main/resources/observability-services.properties b/components/camel-observability-services/src/main/resources/observability-services.properties new file mode 100644 index 0000000000000..01a3c5a8139a5 --- /dev/null +++ b/components/camel-observability-services/src/main/resources/observability-services.properties @@ -0,0 +1,21 @@ +## --------------------------------------------------------------------------- +## 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.server.enabled=true +camel.server.metricsEnabled=true +camel.metrics.enabled=true +# Default metrics endpoint +camel.metrics.path=/camel/metrics \ No newline at end of file diff --git a/components/pom.xml b/components/pom.xml index 60e932d39b81e..a27c356df0ef3 100644 --- a/components/pom.xml +++ b/components/pom.xml @@ -278,7 +278,7 @@ camel-snakeyaml camel-snmp camel-soap - camel-solr + camel-solr camel-splunk camel-splunk-hec camel-spring-batch @@ -337,6 +337,8 @@ camel-rest-openapi camel-jooq + + camel-observability-services diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java index 109877699da3e..566f8ed3a2725 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java @@ -145,7 +145,8 @@ public abstract class BaseMainSupport extends BaseService { protected final OrderedLocationProperties wildcardProperties = new OrderedLocationProperties(); protected RoutesCollector routesCollector = new DefaultRoutesCollector(); protected String propertyPlaceholderLocations; - protected String defaultPropertyPlaceholderLocation = MainConstants.DEFAULT_PROPERTY_PLACEHOLDER_LOCATION; + protected String defaultPropertyPlaceholderLocation + = MainConstants.DEFAULT_PROPERTY_PLACEHOLDER_LOCATION + "," + MainConstants.DEFAULT_OBSERVABILITY_SERVICES_PROPERTY_LOCATION ; protected Properties initialProperties; protected Properties overrideProperties; protected boolean standalone = true; diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainConstants.java b/core/camel-main/src/main/java/org/apache/camel/main/MainConstants.java index 0304faa0acef1..b4925041d74e8 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/MainConstants.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/MainConstants.java @@ -19,6 +19,7 @@ public final class MainConstants { public static final String DEFAULT_PROPERTY_PLACEHOLDER_LOCATION = "classpath:application.properties;optional=true"; + public static final String DEFAULT_OBSERVABILITY_SERVICES_PROPERTY_LOCATION = "classpath:observability-services.properties;optional=true"; public static final String INITIAL_PROPERTIES_LOCATION = "camel.main.initial-properties-location"; public static final String OVERRIDE_PROPERTIES_LOCATION = "camel.main.override-properties-location"; public static final String CLOUD_PROPERTIES_LOCATION = "camel.main.cloud-properties-location"; diff --git a/docs/components/modules/others/nav.adoc b/docs/components/modules/others/nav.adoc index a7f99a4b867f5..7b83d163074bf 100644 --- a/docs/components/modules/others/nav.adoc +++ b/docs/components/modules/others/nav.adoc @@ -32,6 +32,7 @@ ** xref:microprofile-config.adoc[Microprofile Config] ** xref:microprofile-fault-tolerance.adoc[Microprofile Fault Tolerance] ** xref:microprofile-health.adoc[Microprofile Health] +** xref:observability-services.adoc[Observability Services] ** xref:openapi-java.adoc[Openapi Java] ** xref:openapi-validator.adoc[Openapi Validator] ** xref:opentelemetry.adoc[OpenTelemetry] diff --git a/docs/components/modules/others/pages/observability-services.adoc b/docs/components/modules/others/pages/observability-services.adoc new file mode 120000 index 0000000000000..20cedd768e91b --- /dev/null +++ b/docs/components/modules/others/pages/observability-services.adoc @@ -0,0 +1 @@ +../../../../../components/camel-observability-services/src/main/docs/observability-services.adoc \ No newline at end of file diff --git a/parent/pom.xml b/parent/pom.xml index 84dfb7a16051b..a1d803fe75445 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -275,7 +275,7 @@ 5.2.0 0.8.3 12.0.15 - 10.0.20 + 10.0.20 ${jetty-version} org.eclipse.jetty 1.5.4 @@ -1959,6 +1959,11 @@ camel-oaipmh ${project.version} + + org.apache.camel + camel-observability-services + ${project.version} + org.apache.camel camel-observation @@ -2913,7 +2918,7 @@ If we import the grpc-bom, we get a lot of duplicate dependencies and conflicts between BOMs. The only way is to manually manage those dependencies. - + io.grpc grpc-bom