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

[WFLY-17678] [WFLY-18942] Micrometer QS on OpenShift #873

Merged
merged 1 commit into from
Feb 1, 2024
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
@@ -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

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