What is API Greasing? API greasing involves intentionally altering clean data to introduce noise and randomness. This process is used to ensure that systems can handle atypical data correctly. Greasing can be applied in production environments by selectively greasing a subset of messages, thereby stress testing clients over an extended period.
In Membrane, you can add the grease
element to requests or responses to grease specific types of data. For example, using jsonGrease
to add noise to a JSON request. By setting the ratio to 10%, approximately 10 out of every 100 requests will be greased. In this example we set the ratio to 1.0 (default), this will force every request to be greased.
<api port="2000">
<response>
<greaser>
<greaseJson ratio="1.0" shuffleFields="true" additionalProperties="true" />
</greaser>
<return />
</response>
</api>
greaseJson | Example |