SAP ALM API & Integration: How to use the SAP Cloud ALM Raw Data Metrics API
2023-11-6 17:5:16 Author: blogs.sap.com(查看原文) 阅读量:18 收藏

In this series of articles, we will focus on the SAP Cloud ALM Raw Data API.

The SAP Cloud ALM raw data API implements the OpenTelemetry protocol to provide access to the observability signals produced by SAP Cloud ALM.

In the previous post we introduced the SAP Cloud ALM Raw Data Metrics API.

In this blog, we will illustrate how to use this API to export and import metrics managed by the SAP Cloud ALM health monitoring use case.

Get System Information

From the Landscape Management SAP Cloud ALM application

Find the system information to identify the system ID as shown below:

Check the list of metrics reported for your system

From the Health Monitoring SAP Cloud ALM application

Select the system containing the metrics you want to export:

You will find the list of metrics reported for your system:

Export the metrics datasets via SAP Cloud ALM raw data metrics outbound API

From an HTTP client, access to the following URL:

GET https://{{HOST}}/api/calm-metrics/v1/metrics?version=V1&provider=hm&dimensions=serviceType,serviceName,serviceId,metricName,metricLabel&prefix=demo-hm&resolution=5Mi&prefix=demo-qm7&metrics=measure:value&shift=1&serviceId=3c8c7cd1-a346-4af1-a52e-428e53848669&format=protobuf-json

Parameters

Parameters Value
provider hm for health monitoring
serviceId Set the source serviceId of your system
format protobuf-json
dimensions, metrics The list of dimensions/metrics to be exported
prefix optional prefix for the metric name

Check the SAP Business Accelerator HUB for a complete list of parameters.

Output

The output payload contains the list of metrics in protobuf-json.

{
  "name": "demo-qm7_ABAP.Workprocess.Stopped",
   "gauge": {
        "dataPoints": [
             {
                  "timeUnixNano": "1690307700000000000",
                   "asDouble": 0.0,
                    "attributes": [
                             {
                                 "key": "Instance",
                                  "value": {
                                       "stringValue": "LDCIQM7_QM7_20"
                                        }
                                   },
                                   {
                                   "key": "Wp_status",
                                    "value": {
                                          "stringValue": "Stopped"
                                          }
                                    },
                                    {
                                    "key": "Wp_type",
                                     "value": {
                                          "stringValue": "BTC"
                                        }
                                     },
                                     {
                                     "key": "Sid",
                                      "value": {
                                          "stringValue": "QM7"
                                        }
                                     },
                                     {
                                     "key": "measure",
                                     "value": {
                                           "stringValue": "value"
                                      }
                                 }
                  ]
     },

Import the metrics datasets via SAP Cloud ALM raw data metrics inbound API

From an HTTP client, access to the following URL:

POST https://{{HOST}}/api/calm-metrics/v1/metrics?useCase=hm&serviceId=e5fd8c2e-4326-4813-befa-23b22c148010&format=protobuf-json

Parameters

Query

Parameters Value
serviceId Set the serviceId of the target system
format protobuf-json
useCase hm to inject the metrics in the Health Monitoring use-case

Check the SAP Business Accelerator HUB for a complete list of parameters.

Body

Attach a compatible OTeL payload for metrics content in the body of this message.

Validate the result in SAP Cloud ALM

From the Health Monitoring SAP Cloud ALM application

Check the result in the “All Metrics” tab

In the next article, we will look into the SAP Cloud ALM raw data logs API.

Thanks for reading.


文章来源: https://blogs.sap.com/2023/11/06/sap-alm-api-integration-how-to-use-the-sap-cloud-alm-raw-data-metrics-api/
如有侵权请联系:admin#unsafe.sh