Serdar Gökay created CAMEL-27909:
------------------------------------

             Summary: camel-support - the message dump renders the whole 
OpenAPI contract of a contract-first REST route for every captured step
                 Key: CAMEL-27909
                 URL: https://issues.apache.org/jira/browse/CAMEL-27909
             Project: Camel
          Issue Type: Improvement
          Components: camel-support, camel-rest-openapi
    Affects Versions: 4.23.0
            Reporter: Serdar Gökay


With contract-first REST, {{DefaultRestOpenapiProcessorStrategy}} puts the 
parsed {{io.swagger.v3.oas.models.OpenAPI}} model on every exchange as 
{{Exchange.REST_OPENAPI}} (line 205 on 4.23.0). The OpenAPI validators read it, 
so it has to stay on the exchange.

When the backlog tracer captures a message, {{MessageHelper.dumpAsJSonObject}} 
/ {{dumpAsXml}} include every exchange property and skip only 
{{MESSAGE_HISTORY}}, {{GROUPED_EXCHANGE}} and {{FILE_EXCHANGE_FILE}} as too 
big. {{Jsoner}} cannot serialize the OpenAPI model, so 
{{extractValueForLogging}} falls back to {{toString()}}, which renders the 
whole contract. {{bodyMaxChars}} clips the string only after it is built.

In the dev profile the tracer is in standby and message history is on, so it 
captures every message at every step and at the entry and exit of each route, 
for the message history (intended, CAMEL-21150). For a contract-first route 
each of those captures renders the full contract.

Measured with JFR on {noformat}camel run --console{noformat} (dev profile), 
Camel 4.23.0, an HTTP to queue to HTTP flow, 32 connections:
* with a contract-first route in front: about 36 requests a second, the 
tracer's message dumps are 81 % of the CPU samples (the request validation 
itself 1.5 %);
* the same flow without the contract: about 1,080 requests a second, the tracer 
32 %;
* the same project exported and run without a profile, so with no tracer: about 
1,800 requests a second on two cores.

The model is the same for every message of the endpoint and tells nothing in a 
trace or in the message history.

Proposed change: add {{Exchange.REST_OPENAPI}} to the properties the message 
dump skips, in both the JSON and the XML variant, next to {{MESSAGE_HISTORY}}. 
The property stays on the exchange for the validators.

_Claude Code on behalf of etzel-mes_




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to