Instana U

 View Only

Tracing Java SpringBoot applications in SAP Business Technology Platform by using Instana

By Joice Joy posted 13 days ago

  

Authors: @Joice Joy, @Ankit Guria

This blog guides you about SAP Business Technology Platform (BTP) and tracing the Java SpringBoot applications that are deployed in an SAP BTP environment by using Instana Observability tool.

SAP BTP

SAP BTP is an innovation platform optimized for SAP applications in the cloud. It unifies application development and automation, data and analytics, integration, and AI capabilities in one environment. With SAP BTP, you can create personalized experiences across business processes, build applications, analytics, and integrations faster, and run mission-critical innovations confidently on major cloud providers' infrastructure, fully managed by SAP.

SAP BTP is SAP’s integration and application development platform for clients who want to extend their S/4 system. It is based on Cloud Foundry and Kubernetes technologies.


Why SAP BTP and IBM Instana?

IBM® Instana is a powerful observability tool that helps you analyze and troubleshoot microservices and cloud native applications. It provides automated application performance monitoring, end-user experience monitoring, root cause analysis, and anomaly detection. With Instana, you can gain complete visibility into the health and performance of your applications and services.

Installing the Instana standalone serverless agent in SAP BTP enables monitoring of various applications such as Node.js, Python, and Java Spring Boot.

Tracing Java SpringBoot applications in SAP BTP

To enable tracing for Java Spring Boot applications in SAP BTP, you need to add the Instana-provided standalone JVM collector (JAR file) to the application. Additionally, you must activate the collector during the deployment of the application into the SAP BTP environment.

  1. Download the standalone-jvm-collector:

Download the latest standalone JVM collector (JAR file) from the Artifactory.

  1. Add the standalone-jvm-collector as a dependency:

The standalone-jvm-collector JAR is added as a dependency to the Spring Boot application in the following example. Once the application is built by using any build tool, the JAR will be available in the path BOOT-INF/lib/. The Java application can then be deployed to the SAP BTP Cloud Foundry environment by using the manifest.yml file.

The manifest file contains the application name, host, domain, buildpack details, and environment variables. Include the Instana-specific properties and ensure the previously downloaded standalone-jvm-collector is activated by using the environment variables in the following sample manifest file:

applications:

- name: rest-demo-app

  path: ./target/rest-0.0.1-SNAPSHOT.jar # path to the spring boot application jar

  host: rest-demo-app

  domain: cfapps.ap21.hana.ondemand.com

  env:

    JBP_CONFIG_JAVA_OPTS: 'java_opts: "-javaagent:BOOT-INF/lib/standalone-collector-jvm-[version].jar"' # collector jar to be loaded

    INSTANA_AGENT_KEY: '' #key for authentication

    INSTANA_ENDPOINT_URL: '' # endpoint url

    INSTANA_LOG_LEVEL: 'TRACE' # log level

Tracing is activated once the application is successfully deployed to the SAP BTP environment by using the cf push command. You can then view trace information and the flow between different services through the Instana dashboard.

  • Sample Java Spring Boot application (rest-demo-app) deployed:


  • Java spring boot demo application:

In the Instana dashboard, you can create an Application Perspective view to see the application summary, dependency graph, services, detailed error and log messages, infrastructure correlation, and set up smart alerts.

The Summary page provides information on total calls per second, erroneous calls (4xx, 5xx), average call latency, and a chart representation of total calls based on HTTP status codes. You can analyze calls by clicking the HTTP status codes in the chart.


  • Dependencies:

The dependency graph helps to identify the services that are involved in each call and shows the flow between services. You can view the interactions such as microservice-to-microservice, microservice-to-database, or calls to any other external services.


  • Analyze calls:

Analyzing the calls of a trace helps to understand the unexpected errors or service unavailability in an application. You can view the total calls, endpoints, HTTP status codes, HTTP methods, latency, and error messages, along with the stack trace whenever a service failure occurs.


  • Error and Log messages:

The following section provides the total erroneous call count and detailed error log messages from the application.

a) Error messages:


b) Log messages:


  • Smart Alerts:

Smart Alerts are created when an event is triggered. Smart Alerts for application perspectives provide out-of-the-box blueprints for issues such as slow calls, erroneous calls, HTTP status codes, and throughput. Additionally, you can choose from various threshold types, including ones that apply statistical models. You can configure smart alerts by creating different alerting channels such as email, Slack, Microsoft Teams, PagerDuty, WebHook, and more.

a) Email notification:


b) View the event in the Instana dashboard:


Conclusion

IBM Instana provides real-time analytics, a crucial technology that enhances the performance of SAP BTP’s cloud-native applications. By using advanced analytics and AI, Instana enables real-time monitoring, proactive issue diagnosis, and speedy performance optimization.

An automated version of this feature will be released soon by Instana, which enables the automatic downloading of the standalone JVM collector into the application runtime through the Java buildpack. You need to provide Instana properties such as INSTANA_AGENT_KEY and INSTANA_ENDPOINT_URL by creating a service instance in the BTP account.

Permalink