Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test observability-services otel tracing and JMX metrics #6969

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,40 @@ 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.
This extension provides a set of opinionated components and configuration to simplify operations such as observability on cloud environments.
Although the extension is mainly targeted for cloud, it can be used in any other environment.

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.
By adding the `camel-quarkus-observability-services` extension to your application, each observability component (described below) will be configured with their individual default settings.
No additional configuration is required.

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.
HTTP endpoints will be exposed under the context path `/observe/<service>` by default. Further details about this are described below.

If you need to customize any component provided by this extension, then you can specify any of their related configuration options in `application.properties`, as it would be done normally when you work with the individual component extension(s).

[id="extensions-observability-services-usage-components"]
== Components

The presence of this dependency will provide the following extensions:
This extension automatically provides the following Camel Quarkus component 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
* xref:reference/extensions/microprofile-health.adoc[Camel Quarkus MicroProfile Health] - for health checks
* xref:reference/extensions/management.adoc[Camel Quarkus Management] - for JMX
* xref:reference/extensions/micrometer.adoc[Camel Quarkus Micrometer] - for Camel Micrometer metrics
* xref:reference/extensions/opentelemetry.adoc[Camel Quarkus OpenTelemetry] - for tracing Camel messages (events/spans)
* https://quarkus.io/guides/telemetry-micrometer#micrometer-and-monitoring-system-extensions[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:
The presence of this extension 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
| `/observe/health` | Accumulation of all health check procedures in the application
| `/observe/health/live` | Liveness probe endpoint
| `/observe/health/ready` | Readiness probe endpoint
| `/observe/health/started` | Application started probe endpoint
| `/observe/metrics` | Metrics exposed from the Micrometer Prometheus registry

|====

Expand All @@ -76,27 +81,40 @@ NOTE: You can configure the endpoints as you'd do normally within each extension
[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.
The presence of this extension will provide the required instrumentation to enable the collection of OpenTelemetry metrics.
The Camel Quarkus OpenTelemetry extension instruments your application and periodically attempts to export traces to the configured collector.
This is disabled by default in order to prevent the application exporting traces when no telemetry server is available.

In order to turn it on, you need to specify the following configuration explicitly:
In order to enable instrumentation, you need to add the following configuration to `application.properties`.

```
[source,properties]
----
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`)
To configure any aspect of OpenTelemetry, you can add the following configuration to `application.properties`. For example to customize the server endpoint where traces should be exported (default, `http://localhost:4317`).

```
[source,properties]
----
quarkus.otel.exporter.otlp.traces.endpoint=http://my-otel-collector.svc:4317
```
----

NOTE: Quarkus runtime defaults to gRPC protocol (port 4317).
The full set of configuration options are documented in the xref:reference/extensions/opentelemetry.adoc[Camel Quarkus OpenTelemetry] and https://quarkus.io/guides/opentelemetry[Quarkus OpenTelemetry] documentation.

NOTE: Quarkus trace exporting defaults to the gRPC protocol on 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.
The presence of this extension implies the presence of the `camel-quarkus-management` extension.
This exposes Camel JMX MBeans to provide insights and management of the running application.

If you prefer to disable Camel JMX instrumentation, you can add the following configuration to `application.properties`.

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.
[source,properties]
----
camel.main.jmxEnabled=false
----

The full set of configuration options are documented in the xref:reference/extensions/management.adoc[Camel Quarkus Management] documentation.

Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,21 @@

import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.RunTimeConfigBuilderBuildItem;
import io.quarkus.opentelemetry.deployment.tracing.TracerEnabled;
import org.apache.camel.quarkus.component.observabilityservices.ObservabilityServicesRuntimeConfigBuilder;

class ObservabilityServicesProcessor {

private static final String FEATURE = "camel-observability-services";

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

// TODO: Remove this https://github.com/apache/camel-quarkus/issues/6967
@BuildStep(onlyIf = TracerEnabled.class)
RunTimeConfigBuilderBuildItem observabilityServicesRuntimeConfiguration() {
return new RunTimeConfigBuilderBuildItem(ObservabilityServicesRuntimeConfigBuilder.class);
}
}
66 changes: 42 additions & 24 deletions extensions/observability-services/runtime/src/main/doc/usage.adoc
Original file line number Diff line number Diff line change
@@ -1,56 +1,74 @@
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.
This extension provides a set of opinionated components and configuration to simplify operations such as observability on cloud environments.
Although the extension is mainly targeted for cloud, it can be used in any other environment.

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.
By adding the `camel-quarkus-observability-services` extension to your application, each observability component (described below) will be configured with their individual default settings.
No additional configuration is required.

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.
HTTP endpoints will be exposed under the context path `/observe/<service>` by default. Further details about this are described below.

If you need to customize any component provided by this extension, then you can specify any of their related configuration options in `application.properties`, as it would be done normally when you work with the individual component extension(s).

== Components

The presence of this dependency will provide the following extensions:
This extension automatically provides the following Camel Quarkus component 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
* xref:reference/extensions/microprofile-health.adoc[Camel Quarkus MicroProfile Health] - for health checks
* xref:reference/extensions/management.adoc[Camel Quarkus Management] - for JMX
* xref:reference/extensions/micrometer.adoc[Camel Quarkus Micrometer] - for Camel Micrometer metrics
* xref:reference/extensions/opentelemetry.adoc[Camel Quarkus OpenTelemetry] - for tracing Camel messages (events/spans)
* https://quarkus.io/guides/telemetry-micrometer#micrometer-and-monitoring-system-extensions[Quarkus Micrometer Registry Prometheus] - for exporting metrics in Prometheus format

=== List of known endpoints

The presence of this dependency will expose the following endpoints:
The presence of this extension 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
| `/observe/health` | Accumulation of all health check procedures in the application
| `/observe/health/live` | Liveness probe endpoint
| `/observe/health/ready` | Readiness probe endpoint
| `/observe/health/started` | Application started probe endpoint
| `/observe/metrics` | Metrics exposed from the 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.
The presence of this extension will provide the required instrumentation to enable the collection of OpenTelemetry metrics.
The Camel Quarkus OpenTelemetry extension instruments your application and periodically attempts to export traces to the configured collector.
This is disabled by default in order to prevent the application exporting traces when no telemetry server is available.

In order to turn it on, you need to specify the following configuration explicitly:
In order to enable instrumentation, you need to add the following configuration to `application.properties`.

```
[source,properties]
----
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`)
To configure any aspect of OpenTelemetry, you can add the following configuration to `application.properties`. For example to customize the server endpoint where traces should be exported (default, `http://localhost:4317`).

```
[source,properties]
----
quarkus.otel.exporter.otlp.traces.endpoint=http://my-otel-collector.svc:4317
```
----

The full set of configuration options are documented in the xref:reference/extensions/opentelemetry.adoc[Camel Quarkus OpenTelemetry] and https://quarkus.io/guides/opentelemetry[Quarkus OpenTelemetry] documentation.

NOTE: Quarkus runtime defaults to gRPC protocol (port 4317).
NOTE: Quarkus trace exporting defaults to the gRPC protocol on 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.
The presence of this extension implies the presence of the `camel-quarkus-management` extension.
This exposes Camel JMX MBeans to provide insights and management of the running application.

If you prefer to disable Camel JMX instrumentation, you can add the following configuration to `application.properties`.

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.
[source,properties]
----
camel.main.jmxEnabled=false
----

The full set of configuration options are documented in the xref:reference/extensions/management.adoc[Camel Quarkus Management] documentation.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import io.smallrye.config.ConfigSourceContext;
import io.smallrye.config.ConfigSourceFactory;
import io.smallrye.config.ConfigValue;
import io.smallrye.config.PropertiesConfigSource;
import org.apache.camel.util.ObjectHelper;
import org.eclipse.microprofile.config.spi.ConfigSource;

/**
* TODO: Remove this https://github.com/apache/camel-quarkus/issues/6967
*/
public class ObservabilityServicesConfigSourceFactory implements ConfigSourceFactory {
@Override
public Iterable<ConfigSource> getConfigSources(ConfigSourceContext context) {
ConfigValue sdkDisabled = context.getValue("quarkus.otel.sdk.disabled");

if (sdkDisabled != null && sdkDisabled.getValue().equals("false")) {
Map<String, String> properties = new HashMap<>(1);
ConfigValue otelSuppressedUris = context.getValue("quarkus.otel.traces.suppress-application-uris");
String suppressedEndpoints = "/observe/*";

if (otelSuppressedUris != null && ObjectHelper.isNotEmpty(otelSuppressedUris.getValue())) {
suppressedEndpoints += "," + otelSuppressedUris.getValue();
}

properties.put("quarkus.otel.traces.suppress-application-uris", suppressedEndpoints);
return Set.of(new PropertiesConfigSource(properties, "camel-quarkus-observability-services", 300));
}

return Collections.emptySet();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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;

import io.quarkus.runtime.configuration.ConfigBuilder;
import io.smallrye.config.SmallRyeConfigBuilder;

public class ObservabilityServicesRuntimeConfigBuilder implements ConfigBuilder {
@Override
public SmallRyeConfigBuilder configBuilder(SmallRyeConfigBuilder builder) {
return builder.withSources(new ObservabilityServicesConfigSourceFactory());
}
}
25 changes: 25 additions & 0 deletions integration-tests/observability-services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-observability-services</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-seda</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-testing</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>

<!-- test dependencies -->
<dependency>
Expand Down Expand Up @@ -142,6 +154,19 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-seda-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
</profiles>
Expand Down
Loading