Using Dynatrace to monitor Java Enterprise Edition, Quarkus and Node.js apps, Kafka, Istio Service Mesh etc
The workshop will cover the following topics:
-
Facilitate end-to-end tracing of transactions using Dynatrace OneAgent SDK.
The Dynatrace OneAgent SDK explicitly model remote calls, database requests, web requests, message passing, in-process context passing and more.
In the labs, we use the OneAgent SDK for Java. Deploying agents for Node.js, C/C++, Python and .NET is very similar.
-
Automate manual steps to speed up your Jenkins and Tekton CI/CD pipeline and identify quality issues earlier in the software lifecycle.
Dynatrace automates manual quality validation processe using quality gates. Events, tags and APIs enable seamless integration with CI/CD workflows delivering automated deployments for faster time-to-value.
-
Dynatrace and OpenShift Service Mesh
OpenShift 4.x (we included automation to deploy OpenShift 4 on baremetal at Install but all labs should work fine regardless of how and where you deploy OpenShift).
Also tested on RHPDS (RedHat Product and Demo System) « OpenShift 4.4 Workshop ».
Each module should be able to be completed in between 30-45 minutes plus 15 mins of slides introducing the content.
Youtube playlist (step-by-step for each lab): https://www.youtube.com/playlist?list=PLg1pvyPzFye38HA6eB3bzftH3t-YBZVOI
This workshop contains reusable components/automation to: 1. Deploy OpenShift 4.4+ on baremetal 2. Connect your OpenShift clusters to Dynatrace to take advantage of the dedicated OpenShift overview page (using ActiveGate) 3. Deploying JBoss EAP applications with the Dynatrace OneAgent SDK to facilitate end-to-end tracing of transactions. 4. OpenShift CI/CD with Jenkins and Sonarqube 5. Publishing artifacts to Sonatype Nexus using Jenkins Pipelines 6. End to end monitoring for proprietary Java frameworks (using https://mvnrepository.com/artifact/com.dynatrace.oneagent.sdk.java/oneagent-sdk) 7. Automate Quality Gates - Jenkins / Dynatrace integration - Performance Signature (collects performance values during a Jenkins build and evaluates and compares the result with previous builds and non-functional requirements). 8. Automate Quality Gates - Tekton Pipelines with Dynatrace-CLI running in containers using podman 9. Deploy Ansible Tower on baremetal See also lab 17: automate the onboarding of applications into Dynatrace using Ansible Tower 10. Optional: Deploy Ansible Tower 3.7.1 on OpenShift 4.4 11. Ansible/Z and mainframe monitoring (https://www.dynatrace.com/technologies/mainframe-monitoring/) Automation to deploy ZD&T emulated mainframe, Ansible/Z and multiple OpenShift 4 releases at https://github.com/marcredhat/z/blob/master/zdt.adoc 12. Dynatrace and OpenShift Service Mesh (https://github.com/marcredhat/dynatrace/blob/master/servicemesh.adoc) 14. Publish Spring Boot Actuator custom metrics on Dynatrace 15. Build and deploy Quarkus apps on OpenShift 4.4+ Package the Quarkus apps with Dynatrace OneAgent SDK; monitor Quarkus apps running in OpenShift 16. OpenShift 4.4+ / Dynatrace / NeoLoad 7.4 17. Automate the onboarding of applications into Dynatrace using Ansible Tower 18. Get deep insights into Kafka on OpenShift (Strimzi/AMQ Streams) using Dynatrace 19. Monitor SSL/TLS certificate expiry for external and internal services using Dynatrace 20. Scale your Dynatrace API operations; API mocking and testing with Microcks on OpenShift 21. Dynatrace real user monitoring on OpenShift 4.4+; Dynatrace Visually complete and Speed index Drupal 9.0.3 with AMP module and PostgreSQL 12.3 backend on OpenShift 4.4 22. Keptn is an event-based control plane for continuous delivery and automated operations for cloud-native applications. Use Keptn to deploy to OpenShift 4.5 with Service Mesh. Monitor and automate operations using Dynatrace. 23. Deploy a 3-tier Node.js app on OpenShift 4.4+. Monitor with Dynatrace. 24. Deploying a React App with an Express Backend on OpenShift 4.4+. Monitor with Dynatrace.
For details on how to fully automate the installation of OpenShift 4.4 and 4.5 (for lab/test purposes) on a baremetal server with KVM/libvirt, please see https://github.com/marcredhat/z/blob/master/zdt.adoc, starting at the "Install OpenShift 4" paragraph
If you are using RHPDS (the RedHat Product and Demo System), please see https://www.youtube.com/watch?v=yC-OUR7Z9HA
2. Connect your OpenShift clusters to Dynatrace to take advantage of the dedicated OpenShift overview page
Connecting your OpenShift clusters to Dynatrace to take advantage of the dedicated OpenShift overview page requires that you run an ActiveGate in your environment (version 1.163+). See https://www.dynatrace.com/support/help/technology-support/cloud-platforms/openshift/monitoring/monitor-openshift-clusters-with-dynatrace/
In this lab, you will deploy Jenkins and Sonarqube.
These will be used in the following labs to deploy CI/CD pipelines with Dynatrace.
git clone https://github.com/marcredhat/devsecops-workshop cd devsecops-workshop/
./scripts/provision.sh deploy --ephemeral --user <user> #./scripts/provision.sh deploy --ephemeral --user marc
oc delete job cicd-demo-installer oc delete pods -l job-name=cicd-demo-installer
oc get pods NAME READY STATUS RESTARTS AGE jenkins-2-4xs59 1/1 Running 0 27m jenkins-2-deploy 0/1 Completed 0 27m sonarqube-1-74tdp 1/1 Running 0 27m sonarqube-1-deploy 0/1 Completed 0 27m
Note
|
(ignore if you are not using RHPDS) If you see OOMKilled pods, it is probably necessary to edit the default RHPDS limit range (this will be in effect for new projects, not existing projects): oc edit template project-request -n openshift-config To redeploy in a new project, just set another "user" value and re-run ./scripts/provision.sh deploy --ephemeral --user <newuservalue> Here is the config I used successfully: https://github.com/marcredhat/dynatrace/blob/master/rhpds_project_request_template.yaml |
oc expose svc/sonarqube route.route.openshift.io/sonarqube exposed
oc get route NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD jenkins jenkins-cicd-marc.apps.cluster-dynatrac-03ed.dynatrac-03ed.example.opentlc.com jenkins <all> edge/Redirect None sonarqube sonarqube-cicd-marc.apps.cluster-dynatrac-03ed.dynatrac-03ed.example.opentlc.com sonarqube 9000-tcp None
Connect to Sonarqube as admin/admin
In this lab, you will deploy Sonatype Nexus and run a Jenkins Pipeline to build a Java .war file that includes the OneAgent SDK and save this .war file to Sonatype Nexus
See https://github.com/OpenShiftDemos/nexus contains OpenShift templates and scripts for deploying Sonatype Nexus 2 an 3 and pre-configuring Red Hat and JBoss maven repositories on Nexus via post deploy hooks. You can modify the post hook in the templates and add other Nexus repositories by using helper functions.
oc project cicd-<user> In my case, oc project cicd-marc wget https://raw.githubusercontent.com/OpenShiftDemos/nexus/master/nexus3-template.yaml oc new-app -f nexus3-template.yaml --param=NEXUS_VERSION=3.13.0 --param=MAX_MEMORY=2Gi
oc get route NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD jenkins jenkins-cicd-marc.apps.ocp4.local jenkins <all> edge/Redirect None nexus nexus-cicd-marc.apps.ocp4.local nexus 8081-tcp None
https://jenkins-cicd-marc.apps.ocp4.local/ http://nexus-cicd-marc.apps.ocp4.local/ Jenkins: use your OpenShift credentials Nexus: admin/admin123
We can now configure Jenkins and Nexus.
Screenshots are provided below; a video showing step-by-step Jenkins and Nexus configuration can be found at https://www.youtube.com/watch?v=R9VTzEQYt7U
My Jenkins Pipeline is at https://github.com/marcredhat/dynatrace/blob/master/jenkins_pipeline_nexus
Here are the artifacts uploaded to Nexus by our Jenkins Pipeline:
Video showing the pipeline building the .war file with Dynatrace OneAgent SDK and uploading it to Nexus at https://www.youtube.com/watch?v=muoz7uoj0S8
Features of OneAgent SDK for Java (https://github.com/Dynatrace/OneAgent-SDK-for-Java) Trace database requests Trace messaging Outgoing web requests Incoming web requests Custom request attributes In process linking Trace incoming and outgoing remote calls
Add the following to https://github.com/marcredhat/cargotracker/blob/master/pom.xml and Restart the Jenkins Nexus pipeline above <!-- Marc added https://mvnrepository.com/artifact/com.dynatrace.oneagent.sdk.java/oneagent-sdk --> <dependency> <groupId>com.dynatrace.oneagent.sdk.java</groupId> <artifactId>oneagent-sdk</artifactId> <version>1.7.0</version> <scope>compile</scope> </dependency>
The Performance Signature plugin collects performance values during a Jenkins build and evaluates and compares the result with previous builds and non-functional requirements. Several software tests can be run and evaluated automatically, so that the most important key performance indicators (KPI) can be summarized and be available for all project participants very quickly.
Install Jenkins Dynatrace plugins
Navigate to Manage Jenkins -> Configure System -> Performance Signature: Dynatrace SaaS/Managed Enter name of the Server (ex. Dynatrace Server) Your Tenant URL (https://xxxxxxxx.live.dynatrace.com) – SaaS, (https://asdfa.Dynatrace-managed.com/e/asdfafa) - Managed API Token Note: You many need to Save and exit this screen and come back for the “Add” dropdown to works, thanks to a bug in Jenkins
Video showing Dynatrace-CLI with podman: https://youtu.be/_fnv78Q9sDU
Tekton tasks are generic, take input and output resources, execute steps as container images and can be reused for several pipelines. As we can run the Dynatrace CLI tasks in containers (using podman, see https://github.com/marcredhat/dynatrace/blob/master/build.sh and https://github.com/marcredhat/dynatrace/blob/master/testdynatraceclicontainer.sh) *** we can easily integrate Dynatrace into Tekton Pipelines to get *** *** performance metrics (Dynatrace "Performance Signature"), automate quality gates etc *** Parallel tasks can be run in separate containers, which is very efficient.
Note
|
See OpenShift Pipelines examples at https://sysdig.com/blog/securing-tekton-pipelines-openshift/ and a short video at https://bit.ly/marcredhatsysdigcicd |
https://raw.githubusercontent.com/marcredhat/tower/master/towerbaremetal.sh
wget https://raw.githubusercontent.com/marcredhat/tower/master/tower.sh chmod +x ./tower.sh ./tower.sh
Automation to deploy ZD&T emulated mainframe, Ansible/Z and multiple OpenShift 4 releases at https://github.com/marcredhat/z/blob/master/zdt.adoc
Drupal 9.0.3 with AMP module and PostgreSQL 12.3 backend on OpenShift 4.4
22. Keptn is an event-based control plane for continuous delivery and automated operations for cloud-native applications.
Use Keptn to deploy to OpenShift 4.5 with Service Mesh. Monitor and automate operations using Dynatrace.
All credit for the React app goes to Jan Kleinert.
Links: Sysdig OPA Image Scanner on OpenShift 4.5.2 - short video at https://bit.ly/marcredhatopa Step-by-step instructions at https://github.com/marcredhat/sysdig/blob/master/ImageScanningAdmissionController-OpenPolicyAgent.adoc http://redhatgov.io/workshops/secure_software_factory/ https://github.com/RedHatGov/devsecops-workshop https://eye15053.live.dynatrace.com/ https://github.com/redhat-cop/agnosticd/blob/development/training/01_Introduction/05_AgnosticD_in_Prod.adoc https://github.com/redhat-cop/agnosticd/tree/development/training https://github.com/dynatrace-acm/dtacmworkshop https://github.com/redhat-cop/agnosticd/blob/development/ansible/software_playbooks/tower.yml https://github.com/Dynatrace/dynatrace-oneagent-operator https://www.dynatrace.com/support/help/reference/dynatrace-concepts/access-tokens/