OpenTelemetry issues: traceId propagation and traceConfig filtering behavior
search cancel

OpenTelemetry issues: traceId propagation and traceConfig filtering behavior

book

Article ID: 437822

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

Access to otel.traceid and otel.spanid

We are trying to return the request identifier in the response header X-Request-ID for any incoming request.

We are attempting to access the variables:

otel.traceid
otel.spanid

from the custom-message-completed policy (customizable policy of API Portal Integration).

However, these variables do not seem to be available in this policy, while they are available in the API policies that are executed during API processing.

How can we always return the traceID in the X-Request-ID header for any request received?

Environment

11.2

Resolution

resolved the issue with the otel.traceId variable in the global message-completed and message-received policies by modifying the CWP otel.traceConfig. Specifically, we removed the "exclude" pattern from the "assertions" section and configured only an "include" pattern.

To have a the otel.trace-id variable set in the  global policy  you have to make sure there is a assertions in the global policy  which is set to generate a traceid and spanid

 If you have any assertions which are having spanids and trace ids included in your custom-message complete and not excluded from the global cwp configuration otel.trace.Config then it should actually give you your desired result .