Monitoring your SAP CF app in SAP Cloud ALM

Introduction

SAP Cloud ALM provides services to perform Real User Monitoring (RUM) which combines data from various sources to see how apps are working and performing. RUM can be enabled using a npm package from SAP to send data to Cloud ALM via a destination.

Setup

Configure SAPUI5

In SAPUI5 you need to add a meta tag to your index.html:

<meta name="sap-ui-fesr" content="/fesr">

This enables SAPUI5 to send OpenTelemetry data to your /fesr endpoint in NodeJS.

OpenTelemetry@SAP

Configure the Approuter

In your xsapp.json you need to point the endpoint to the right destination which is your service api:

"routes": [ { "source": "^/fesr$", "target": "/fesr", "destination": "srv-api", "csrfProtection": false, "authenticationType": "xsuaa" } ]

Setup your Service layer

package.json:

In your service layer you need to add the fesr to otel and xotel-agent packages and configure them. The latest versions of the packages can be found here.

"@sap/fesr-to-otel-js": "https://73555000100200018064.npmsrv.cdn.repositories.cloud.sap/@sap/fesr-to-otel-js/-/fesr-to-otel-js-1.5.6.tgz",

"@sap/xotel-agent-ext-js": "https://73555000100200018064.npmsrv.cdn.repositories.cloud.sap/@sap/xotel-agent-ext-js/-/xotel-agent-ext-js-1.5.15.tgz", },

The start script for your the service layer also needs to be adjusted to use the xotel-agent. This means that the start script needs to be adjusted to:

"start": "node ${NODE_ARGS} ./node_modules/@sap/cds/bin/cds-serve.js",

You also need to add a server.js to your service layer which enables the forwarding of fesr data:

const cds = require("@sap/cds"); const fesr = require("@sap/fesr-to-otel-js"); cds.on("bootstrap", (app) => fesr.registerFesrEndpoint(app)); module.exports = cds.server;

mta.yaml:

In the mta.yaml the following parameters should be set for the service layer:

modules:

  • name: <service module name>

properties:

SAP_CALM_SERVICE_NAME: <application name>

SAP_CALM_SERVICE_TYPE: SAP_CP_CF

OTEL_RESOURCE_ATTRIBUTES: sap.tenancy.tenant_id=<your provider subaccount id>

NODE_ARGS: -r @sap/xotel-agent-ext-js/dist/common/tracer

Create a CALM datacollector Destination

A destination called “CALM_datacollector“ should be present in the subaccount looking like this:

Add a mtaext in Cloud TMS

Because the subaccount id of the OTEL_RESOURCE_ATTRIBUTES property is different for each environment (dev/acc/prd) this property needs to be updated for the ACC and PRD environments via a mtaext file in cTMS and should look like this:

_schema-version: "3.2"
ID: <id-of-your-app>-acc
extends: <id-of-your-app>

modules:

  • name: your-app-srv
    properties:
    OTEL_RESOURCE_ATTRIBUTES: sap.tenancy.tenant_id=<subaccount_id>

This file can be added via cTMS in the transport node configuration per application and version

Usage

After configuring RUM you should be able to see the data in CALM by going to “Operations->Real User Monitoring”. From there you can click through to the requests and see its monitoring data. The data found here combines frontend and service data for specific calls.

Share

Geef een reactie

Je e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *