Technology Blog Posts by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
jeremy_ma_usa
Product and Topic Expert
Product and Topic Expert
1,361

Problem Statement: 

In microservice architectures, achieving comprehensive observability and monitoring is challenging due to the multiple components involved, such as application routers, IDPs, connectivity proxies, and cloud connectors. Each step adds complexity and potential blind spots, making it difficult to track performance, trace transactions, and quickly identify issues. Ensuring effective observability across all these layers is crucial for optimizing performance and maintaining the reliability of applications.


ProblemStatement.png

Overview of available Logging in BTP

Before we dive into this setup, lets review the other alternatives

Monitoring options.png

* Internal Monitoring is only available within SAP support via component BC-XS-CDX-NJS (SAP CAP – node.js runtime)

1.Setup for own Dynatrace for observability:

Create Dynatrace access token

In Dynatrace WebUI: Under Applications (type access.. search)

Dynatrace Token.png

For selection scopes:

  • Read API tokens (API v2)
  • Read audit logs (API v2)
  • Read metrics (API v2)
  • Read problems (API v2)
  • Write problems (API v2)
  • Capture request data (API v1)
  • Access problem and event feed, metrics, and topology (API v1)
  • Read configuration (API v1)
  • Fetch data from a remote environment (API v1)
  • Write configuration (API v1)
  • Read logs
  • PaaS integration - Installer download

Save the generated Token as required in BTP Self Service Instance step.

2. Create Dynatrace Service Instance in BTP

  1. Login your subaccount w. BTP Cockpit Admin role
  2. Navigate to the space where the Node.js is hosted
  3. Navigate to Services Instance

BTP_Cockpit Navigation.png

 4. Click Create User-Provision Service Instance

User_ProvisionService.png

 

 

{
    "environmentid": "from dyntrace URL",
    "apitoken": "dt0c01.xxxxxxxxxxxxxxxxxxx",
    "tag:SAP BTB": "",
    "tag:Region": "Frankfurt"
}

 

 

3. Incorporate Dyntrace lib references in your node.js app

  1. Modify the manifest.yaml with the services instance name you created above (dynatraceservice)
    manifest.yaml.png
  2. Add Dynatrace OneAgent SDK in package.json

 

 

"dependencies": {
    "@dynatrace/oneagent-sdk": "^1.4.0",

 

3.  Push/restage the app:push_stage.png

Now all of of setup completed we will go into the monitoring 🔍 

4. Monitor and quick navigation around Dynatrace:

To start you would navigate to  https://<environment_id>.apps.dynatrace.com/ui/apps/dynatrace.classic.hosts/

Monitor 1 Host.png

 Host Vital Resources:

Monitor 2 Vital Resources.png

 Container metrics:

Monitor 3 container resources.png

 Distributed Tracing:

Monitor 4 Distributed Tracing.png

 Services Backtrace - Show supporting service calls broken down by proxy (services ip), Client IP

Monitor 5 Backtracing.png

 Below purepath example of 3rd tier system:

Monitor 6 PurePath.png

To find the needle in haystack 🚦:

Monitor 7 needle haystacks.png

The guides you through setting up Dynatrace for observability in Node.js applications on SAP Business Technology Platform (BTP). It covers steps to integrate Dynatrace, configure monitoring, and analyze performance metrics for better visibility into your application's health and performance.

Benefits of Implementing Observability:

  • Real-Time Performance Monitoring: Identify bottlenecks and issues before they affect users.
  • Simplified Troubleshooting: Trace transactions across services to quickly find root causes.
  • Resource Optimization: Detect inefficiencies to optimize cloud resources and reduce costs.
  • Proactive Issue Management: Catch anomalies early to improve application reliability.
  • Data-Driven Decisions: Use metrics to guide updates and improvements confidently.
  • Faster Development: Deploy changes more safely with comprehensive monitoring.

Setting up observability is key to improving application performance, reliability, and development speed.

Appendix for setup of AppRouter logs:

Below showing ~40 ms..

Appendix AppRouterLogs.png

To enable AppRouter log:

  • Debugging App Router – “@sap/approuter”uses the @Sisn/logging package, which means that all of the typical logging features are available to control application logging. For example, to set all logging and tracing to the most detailed level, set the ”XS_APP_LOG_LEVEL” environment variable to “debug”

Common/Known errors:

WARNING Error during installer download, retrying in 5s

{"error":{"code":401,"message":"Missing authorization parameter."}}

  • This is where node.js try to download Dynatrace One Agent to push but failed due to missing permission under the scope of Access token [PaaS integration - Installer download].

{"error":{"code":404,"message":"

  • The environmentid specified in BTP Service Instance is referring incorrectly.

ADDITIONAL RESOURCES:

 

5 Comments