diff --git a/.ci/openshift-ci/build-root/scripts/excluded-directories.txt b/.ci/openshift-ci/build-root/scripts/excluded-directories.txt index 754098a65a..a31a1a52a7 100644 --- a/.ci/openshift-ci/build-root/scripts/excluded-directories.txt +++ b/.ci/openshift-ci/build-root/scripts/excluded-directories.txt @@ -1,5 +1,4 @@ # Quickstarts that should not be tested on OpenShift. # One per line with no trailing spaces, and make sure to have a newline at the end # microprofile-reactive-messaging-kafka -micrometer diff --git a/.ci/openshift-ci/build-root/scripts/qs-overrides/micrometer/overridable-functions.sh b/.ci/openshift-ci/build-root/scripts/qs-overrides/micrometer/overridable-functions.sh index 3f2f356e3f..c783691527 100644 --- a/.ci/openshift-ci/build-root/scripts/qs-overrides/micrometer/overridable-functions.sh +++ b/.ci/openshift-ci/build-root/scripts/qs-overrides/micrometer/overridable-functions.sh @@ -1,31 +1,9 @@ function runPostHelmInstallCommands() { - oc apply -f charts/opentelemetry-collector.yaml + echo "Applying all OpenTelemetry Collector resources" + oc apply -f charts/opentelemetry-collector.yaml } - -function getMvnVerifyExtraArguments() -{ - mgmtHostRoute=$(oc get route otelcol-grpc --template='{{ .spec.host }}') - echo "-Dopentelemetry.collector.host=https://opentelemetry" -} - - -function cleanPrerequisites() -{ - echo "Removing all opentelemetry-tracing resources" - oc delete route otelcol-grpc - oc delete route otelcol-prometheus - oc delete service opentelemetrycollector - oc delete deployment opentelemetrycollector - oc delete configmap collector-config -} - - -function testsFailed() { - echo "----> Getting status of all pods" - oc get pods - echo "----> Checking logs for postgres pod" - echo oc logs todo-backend-postgresql-0 - echo "----> Checking events" - oc get events -} +function cleanPrerequisites() { + echo "Deleting all OpenTelemetry Collector resources" + oc delete -f charts/opentelemetry-collector.yaml +} \ No newline at end of file diff --git a/micrometer/README-source.adoc b/micrometer/README-source.adoc index 3596ac0f89..38b7e9f8cd 100644 --- a/micrometer/README-source.adoc +++ b/micrometer/README-source.adoc @@ -13,6 +13,7 @@ The `micrometer` quickstart demonstrates the use of the Micrometer library in {p :archiveType: war :archiveName: {artifactId} :restoreScriptName: restore-configuration.cli +:helm-install-prerequisites: ../micrometer/helm-install-prerequisites.adoc == What is it? diff --git a/micrometer/charts/opentelemetry-collector.yaml b/micrometer/charts/opentelemetry-collector.yaml index c163a8b874..948c93738c 100644 --- a/micrometer/charts/opentelemetry-collector.yaml +++ b/micrometer/charts/opentelemetry-collector.yaml @@ -59,11 +59,11 @@ metadata: name: opentelemetrycollector spec: ports: - - name: grpc-otlp + - name: otlp-grpc port: 4317 protocol: TCP targetPort: 4317 - - name: grpc-http + - name: otlp-http port: 4318 protocol: TCP targetPort: 4318 @@ -78,12 +78,29 @@ spec: apiVersion: route.openshift.io/v1 kind: Route metadata: - name: otelcol-grpc + name: otelcol-otlp-grpc labels: app.kubernetes.io/name: microprofile spec: port: - targetPort: grpc-http + targetPort: otlp-grpc + to: + kind: Service + name: opentelemetrycollector + tls: + termination: edge + insecureEdgeTerminationPolicy: Redirect + wildcardPolicy: None +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: otelcol-otlp-http + labels: + app.kubernetes.io/name: microprofile +spec: + port: + targetPort: otlp-http to: kind: Service name: opentelemetrycollector diff --git a/micrometer/configure-micrometer.cli b/micrometer/configure-micrometer.cli index 58ff2e4966..3bf813258c 100644 --- a/micrometer/configure-micrometer.cli +++ b/micrometer/configure-micrometer.cli @@ -5,5 +5,5 @@ if (outcome != success) of /extension=org.wildfly.extension.micrometer:read-reso end-if # Configure the endpoint for metrics publication -/subsystem=micrometer:write-attribute(name=endpoint, value="http://${opentelemetry.collector.host:localhost}:4318/v1/metrics") +/subsystem=micrometer:write-attribute(name=endpoint, value="http://${OTEL_COLLECTOR_HOST:localhost}:4318/v1/metrics") /subsystem=micrometer:write-attribute(name="step",value="1") diff --git a/micrometer/helm-install-prerequisites.adoc b/micrometer/helm-install-prerequisites.adoc new file mode 100644 index 0000000000..f5d96ba074 --- /dev/null +++ b/micrometer/helm-install-prerequisites.adoc @@ -0,0 +1,22 @@ +=== Install OpenTelemetry Collector on OpenShift + +The functionality of this quickstart depends on a running instance of the https://opentelemetry.io/docs/collector/[OpenTelemetry Collector]. + +To deploy and configure the OpenTelemetry Collector, you will need to apply a set of configurations to your OpenShift cluster: + +[source,options="nowrap",subs="+attributes"] +---- +include::charts/opentelemetry-collector.yaml[] +---- + +To make things simpler, you can find these commands in `charts/opentelemetry-collector.yaml`, and to apply them run the following command in your terminal: + +[source] +---- +$ oc apply -f charts/opentelemetry-collector.yaml +---- + +[NOTE] +==== +When done with the quickstart, the `oc delete -f charts/opentelemetry-collector.yaml` command may be used to revert the applied changes. +==== \ No newline at end of file diff --git a/micrometer/pom.xml b/micrometer/pom.xml index 8a5421980e..90e30f6f12 100644 --- a/micrometer/pom.xml +++ b/micrometer/pom.xml @@ -201,7 +201,7 @@ - true + false @@ -284,7 +284,7 @@ - true + false