Raw Data Inbound Traces API

Introduction

The SAP Cloud ALM Raw Data Inbound Traces API is used to write traces into SAP Cloud ALM. With this API, a third-party application, an open source or an in-house tool with access to the public cloud can send their own traces into SAP Cloud ALM. The content sent to SAP Cloud ALM must respect the OpenTelemetry Traces formatInformation published on non-SAP site (binary or json) as well as the SAP Cloud ALM inbound traces model.

Type

Pull API

URL Format

calm-traces/v1/traces

Documentation

SAP Business Accelerator Hub documentation: hereInformation published on SAP site

Operations

POST /traces
  • calm-traces/v1/traces (content-type application/x-protobuf)

  • calm-traces/v1/traces (content-type application/json)

Authorizations

Access to the Inbound Traces API requires the following security scope:
  • calm-api.traces.write for access to the POST traces APIhttps://<tenant name>.<provider name>/api/

Depending on the model accessed from the API, the following security scopes may be required:
  • calm-api.rum.write to push Real User Monitoring traces

  • calm-api.sum.write to push Synthetic User Monitoring traces

A request without security scope authorization receives an authorization exception (HTTP 403).

Security Scope

Description

calm-api.traces.write

Mandatory security scope to write any traces

calm-api.rum.write

To write traces in Real User Monitoring use case

calm-api.sum.write

To write traces in Synthetic User Monitoring use case

Restrictions

The json protobuf encoding does not support the deviations described hereInformation published on non-SAP site; it means traceId and spanId must be encoded in base64 when json format is used.

For provider Real User Monitoring, only service types "Unspecific Cloud Service (HTTP)" or "Unspecific On-Premise System" are accepted.

Only spans with SPAN_KIND_SERVER are considered as entry points in Real User Monitoring application: Spans of KIND_CLIENT without associated KIND_SERVER will not show up.

In SAP Cloud ALM use case application, target service's configuration should have the data collection switched on. If the data collection is not switched on, the API returns an HTTP 403 error.

API Details

The SAP Cloud ALM Raw Data Inbound traces request the following parameters

Request Parameters

Query Parameters

Name

Description

Comments

useCase

Use case short name (traces consumer). Possible values:
  • rum: for real user monitoring

  • sum: for synthetic user monitoring

String

Mandatory

version

Traces consumer version to use.

String

Example: v1

Default: oldest non-deprecated version.

serviceId

SAP landscape id of the service which produces the traces.

String

rum use case: Mandatory

sum use case: Not Used

dev

Development mode (true/false). In development mode, the consumer is called synchronously to get the response and the error messages. Development mode should not be used in production, the rate limiter authorises only a limited number of calls.

tag

Free string (maximum 64 characters) to identify the client of the interface.

Request Headers Parameters

The following request headers parameters apply to the traces POST API

Name

Description

Content-Type

Data format of the request body. Possible values:
  • application/x-protobuf

  • application/json

Request Body Example

RUM Payload Example

RUM Correlation example - payload for service 1 (client)

RUM Payload example - Correlation (Client)

RUM Correlation example - payload for service 2 (backend)

RUM Payload example - Correlation (Server)

SUM Payload Example

Status Codes

The following status codes apply to this HTTP action:

Status Code

Description

202

Data accepted.

400

Structure of the request is invalid.

403

Security scope is missing or data collection is not switched on for the target service.

404

The request path is incorrect.

408

The request took too long to reach the endpoint.

413

The payload was too big.

428

Pre-condition not full filled.

429

The request rate quota has been exceeded.

500

Internal Server Error

502

Bad Gateway

503

Service Unavailable

504

Gateway Timeout

Limitations

The following rules apply when accessing the SAP Cloud ALM Traces API:

Description

Default

When Above Limit

Maximum total number of resources

100

Error

Maximum total number of scopes

100

Error

Maximum total number of traces spans

5000

Error

Maximum number of attributes per trace span

20

Skip Traces Span

Maximum age of a trace span: <X> hours in the past

24

Skip Traces Span

Minimum age of a trace span: <X> hours in the future

1

Skip Traces Span

Trace span's attribute naming syntax (dimension names): no “:”, ”_”

Skip Traces Span

Max trace span attribute name length : <X> characters

255

Skip Traces Span

Maximum Payload Size
  • Maximum JSON payload size: 1Mb

  • Maximum protobuf binary payload size: 150 KB

Rate Limiter in Production
  • dev=false

  • Maximum 100 requests per minute

Rate Limiter in Development Mode
  • dev=true

  • Maximum 100 requests per 24 hours

Model Alignment

This section details how the SAP Cloud ALM data model is mapped to the OTLP data model.
  • Some mapping rules are common to all scenarios (see section Common mapping).

  • Some mapping rules are specific to each scenario (see dedicated scenario mapping tables).

Common Mapping

OLTP Resource must contain at least the following properties / attributes:
  • service.name

  • telemetry.sdk.name

  • telemetry.sdk.language

  • telemetry.sdk.version

Real User Monitoring Mapping

In addition to the common mapping rules, the table below describes the mapping rules specific to Real User Monitoring scenario.

Resource

OTLP Resource Spans Attributes

RUM Object

Comment

service.name

Service id. Can be an LMS service id or one of its sub-component like an SAP BTP application. This service id doesn't need to exist in Landscape Management Service.

Required

telemetry.sdk.name

Required

telemetry.sdk.language

Required

telemetry.sdk.version

Required

Span

OTLP Span

RUM

Comment

trace_id

TRANSID

Required

A valid trace identifier is a 16-byte array with at least one non-zero byte. Must be base 64 encoded (24 characters).

span_id

ID (not exposed in UI)

Required. 8 bytes array, base 64 encoded (24 characters).

The span_id is used as primary key for the RUM records and thus must be unique. Spans with span_ids that exist already will be rejected.

trace_state

Considered in passport

parent_span_id

ID (not exposed in UI)

name

Ignored

Required

kind

SPAN_KIND_SERVER → inbound request

SPAN_KIND_CLIENT → outbound request

start_time_unix_nano

MEASURED_AT (timestamp)

Required

end_time_unix_nano

RESPTIME = end_time_unix_nano - start_time_unix_nano

Required

status

Ignored

Span Attributes

OTLP Span Attributes

RUM

Comment

sap.calm.request_type

RECTYPE

Optional. Can be used to explicitly override the request type. Otherwise it will be derived from other attributes (see below).

Allowed values: HTTP, HTTPS, SAP_UI5, WEB_UI, DIAG, SAP_ITS, RFC, SAP_WDA, RFC, RFCS, DB, BATCH, CODE

If not specified explicitly via sap.calm.request_type, it will be derived from presence of attributes:
  • db.statement, db.operation → DB

  • messaging.operation → BATCH

  • http.request.method → HTTPS

  • requestType==SAP_UIt → SAP_UI5

server.address

INSTANCE

Optional

net.host.name

INSTANCE

Optional

receivedBytes, http.response.body.size

ReceivedBytes

Optional

sentBytes, http.request.body.size

SentBytes

Optional

process.memory.usage

Memory

Optional

process.cpu.time

CpuTime

Optional

dbTime

DbTime

Optional

dbCalls

DbCalls

Optional

externalTime

ExtTime

Optional

waitTime

WaitTime

Optional

externalCalls

ExtCalls

Optional

enduser.id

UserName

Optional

error.type

Phrase

Optional

client.address

Ip

Optional

networkTime

NetworkTime

Optional, frontend spans only

numberOfRoundTrips

RoundTrips

Optional, frontend spans only

serverRoundTripTime

SrvRoundTripTime

Optional, frontend spans only

Span Attributes for HTTPS Requests

Span Attribute

RUM

Type

Comment

sap.calm.request_type

RequestType

string

If http.request.method is present then request type will be automatically mapped to HTTPS

url.full or url.path

Request

string

http.request.method

Action

string

http.response.status_code

StatusCode

string

http.request.body.size

SentBytes

int

overrides sentBytes

http.response.body.size

ReceivedBytes

int

overrides receivedBytes

Span Attributes for Frontend Requests (SAP_UI5 and WEB_UI)

Span Attribute

RUM

Type

Comment

sap.calm.request_type

RequestType

string

optional. SAP_UI5 or WEB_UI. if missing SAP_UI5 is assumed

request

Request

string

string describing the UI activity

action

Action

string

string describing the user activity in more detail

browserVersion

Browser

string

optional. Expected values are cr_n (Chrome), ed_n (Edge), sf_n (Safari), ff_n (Firefox). n is the major version as integer

clientDevice

Device Type

int

optional device type, int value: 0=unknown, 1=desktop/tablet combi, 2=desktop, 3=phone, 4=tablet

osVersion

OS

string

optional client os type and version, e.g. linux_n, win_n, mac_n, Android_n, iOS_n. iOS and max are major.minor, others integer

Span Attributes for Database Calls (DB)

Span Attribute

RUM

Type

Comment

sap.calm.request_type

RequestType

string

If db.statement or db.operation is present then request type will be automatically mapped to DB. SPAN_KIND_CLIENT only

db.statement

Request

string

db.operation

Action

string

db.connection_string

Destination

string

for SPAN_KIND=CLIENT

Span Attributes for Batch

Span Attribute

RUM

Type

Comment

sap.calm.request_type

RequestType

string

If messaging.operation is present then request type will be automatically mapped to BATCH.

Works with SPAN_KIND_SERVER

messaging.destination.name

Request

string

messaging.operation

Action

string

Correlation

To correlate requests between two non-SAP systems S1 and S2 the following spans are needed:
  • an incoming call in S1 ( trace1, span1, SPAN_KIND_SERVER)

  • an outgoing call in S1 ( trace1, span2, SPAN_KIND_CLIENT, parent=span1)

  • an incoming call in S2 ( trace1, span3, SPAN_KIND_SERVER, parent=span2)

Synthetic User Monitoring Mapping

In addition to the common mapping rules, the table below describes the mapping rules specific to Synthetic User Monitoring scenario.

OTLP Resource Span Attributes

SUM

Comment

host.id

runnerID

Required

host.name

runnerName

Optional. Updated if id already exists and that another name is given

OTLP Instrumentation Scope Attributes

SUM

Comment

sap.calm.execution.validity

validity

Optional, default is 600 000 milliseconds (10 minutes)

Status duration of validity while no newest executions

sap.calm.scenario.id

scenarioID

Required

UUID

Scenario will be created if scenario does not exist

sap.calm.scenario.name

scenarioName

Required

Will be updated if different from previous name

OTLP Span

SUM

Comment

trace_id

executionID

Required

A valid trace identifier is a 16-byte array with at least one non-zero byte. Must be base 64 encoded (24 characters).

span_id

Ignored

trace_state

Ignored

parent_span_id

Ignored

name

stepName

Required

Will be updated if a new name.

kind

Ignored

start_time_unix_nano

durationNet

Required

used with end_time_unix_nano to get the duration

end_time_unix_nano

durationNet

Required

used with start_time_unix_nano to get the duration

status → code

Availability and Availability code

Optional

Can be STATUS_CODE_UNSET, STATUS_CODE_OK, STATUS_CODE_ERROR.

STATUS_CODE_UNSET by default

status → message

message

In SUM UI, the information marked by (I)

Optional

No step execution information if not set.

Can be anything

OTLP Span Attributes

SUM Object

Comment

sap.calm.duration_gross

durationGross

Optional

Value is in milliseconds.

sap.calm.step.id

stepID

Required

UUID