Skip to content

Commit

Permalink
[WFLY-18942] Fix automated testing of Micrometer QS under OpenShift
Browse files Browse the repository at this point in the history
Build with openshift profile
Clean up YAML
Modify how WF is configured under OS build
Add instructions for install otel collector on OS
  • Loading branch information
jasondlee authored and emmartins committed Jan 30, 2024
1 parent 0c14497 commit 0ada1cb
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# 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
opentelemetry-tracing

Original file line number Diff line number Diff line change
@@ -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
}
1 change: 1 addition & 0 deletions micrometer/README-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
25 changes: 21 additions & 4 deletions micrometer/charts/opentelemetry-collector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion micrometer/configure-micrometer.cli
Original file line number Diff line number Diff line change
Expand Up @@ -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")
22 changes: 22 additions & 0 deletions micrometer/helm-install-prerequisites.adoc
Original file line number Diff line number Diff line change
@@ -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.
====
4 changes: 2 additions & 2 deletions micrometer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
<scripts>
<script>${basedir}/configure-micrometer.cli</script>
</scripts>
<resolve-expressions>true</resolve-expressions>
<resolve-expressions>false</resolve-expressions>
</packaging-script>
</packaging-scripts>

Expand Down Expand Up @@ -284,7 +284,7 @@
<scripts>
<script>${basedir}/configure-micrometer.cli</script>
</scripts>
<resolve-expressions>true</resolve-expressions>
<resolve-expressions>false</resolve-expressions>
</packaging-script>
</packaging-scripts>
</configuration>
Expand Down

0 comments on commit 0ada1cb

Please sign in to comment.