Chaos testing Interceptors in Conduktor are like stress tests for your data systems.Performing chaos testing allows you to see how well your applications can handle problems like slow data delivery, corrupted messages or unexpected duplicates.This helps ensure that your systems are strong and can keep running smoothly even when things go wrong.You can simulate:
This Interceptor injects intermittent errors in client connections to brokers that are consistent with broker side issues.This only works on produce and fetch requests.
This Interceptor will duplicate records when the client produces/consumes the records to or from Kafka.It’s useful for testing applications to ensure that they behave appropriately when there are duplicate records received from Kafka.
By default, duplicate messages causes chaos on fetch, therefore this plugin only duplicates the records returned to the client, the records on the broker are not duplicated.For example, you could have a message that says “Add £10 to a bank account, Unique Message Id is 12345”.That message is duplicated. The unique Id is the same in both. The client application needs to be validated to ensure that it only receives £10 once.
Simulate invalid schema id will overwrite an invalid schemaId value to the records.Because schemaId is overwritten with an invalid value, the following error is returned when consuming records:
Copy
Ask AI
Processed a total of 1 messages[2022-11-17 15:59:13,184] ERROR Unknown error when running consumer: (kafka.tools.ConsoleConsumer$)org.apache.kafka.common.errors.SerializationException: Error retrieving JSON schema for id 999 at io.confluent.kafka.serializers.AbstractKafkaSchemaSerDe.toKafkaException(AbstractKafkaSchemaSerDe.java:259) at io.confluent.kafka.serializers.json.AbstractKafkaJsonSchemaDeserializer.deserialize(AbstractKafkaJsonSchemaDeserializer.java:182) at io.confluent.kafka.formatter.json.JsonSchemaMessageFormatter$JsonSchemaMessageDeserializer.deserialize(JsonSchemaMessageFormatter.java:130) at io.confluent.kafka.formatter.json.JsonSchemaMessageFormatter$JsonSchemaMessageDeserializer.deserialize(JsonSchemaMessageFormatter.java:103) at io.confluent.kafka.formatter.json.JsonSchemaMessageFormatter.writeTo(JsonSchemaMessageFormatter.java:94) at io.confluent.kafka.formatter.SchemaMessageFormatter.writeTo(SchemaMessageFormatter.java:181) at kafka.tools.ConsoleConsumer$.process(ConsoleConsumer.scala:116) at kafka.tools.ConsoleConsumer$.run(ConsoleConsumer.scala:76) at kafka.tools.ConsoleConsumer$.main(ConsoleConsumer.scala:53) at kafka.tools.ConsoleConsumer.main(ConsoleConsumer.scala)Caused by: io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: Schema 999 not found; error code: 40403 at io.confluent.kafka.schemaregistry.client.rest.RestService.sendHttpRequest(RestService.java:301) at io.confluent.kafka.schemaregistry.client.rest.RestService.httpRequest(RestService.java:371) at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:840) at io.confluent.kafka.schemaregistry.client.rest.RestService.getId(RestService.java:813) at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaByIdFromRegistry(CachedSchemaRegistryClient.java:294) at io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient.getSchemaBySubjectAndId(CachedSchemaRegistryClient.java:417) at io.confluent.kafka.serializers.json.AbstractKafkaJsonSchemaDeserializer.deserialize(AbstractKafkaJsonSchemaDeserializer.java:119) ... 8 more
This Interceptor adds latency to a percentage of requests and responses flowing between your Kafka applications and your Kafka cluster.It’s useful for testing applications to ensure that they behave appropriately when there are network delays talking to Kafka, or the Kafka broker is for some reason responding slowly.
The percentage of requests flowing through Gateway that will have increased latency applied for them. For example, an applied percentage of 10 will add a latency of the value of latencyMs to 10% of requests and responses. The value must be between 0 and 10.
latencyMs
long
The number of milliseconds to add to the request. The latency in milliseconds that will be applied to the requests and responses flowing through Gateway. The value has to be between 0 and 10.
This Interceptor is useful for testing applications to ensure they can survive leader election that happens when the leader dies and another one needs to take over or when doing rolling upgrades.It does that by sending:
From time to time, messages will arrive that are not in the expected format.This Interceptor adds a random bytes to the end of the data in records produced to Kafka.
This Interceptor slows responses from the brokers. It will operate only on a set of topics rather than all traffic and only works on produce and fetch requests.