Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
13d20ae
feat: replace static event name with dynamic based on event id
vordimous May 15, 2024
8c44723
update event.name test value
vordimous May 15, 2024
db6c249
Update incubator/catalog-filesystem/src/main/java/io/aklivity/zilla/r…
vordimous May 15, 2024
a9b16cd
Update runtime/exporter-stdout/src/main/java/io/aklivity/zilla/runtim…
vordimous May 15, 2024
db918eb
Update runtime/exporter-otlp/src/main/java/io/aklivity/zilla/runtime/…
vordimous May 15, 2024
5b3b00d
Build event name in Engine context
vordimous May 15, 2024
35f3254
fix build errors
vordimous May 16, 2024
5608829
update tests
vordimous May 16, 2024
34deb18
fix http binding event test
vordimous May 16, 2024
981fed4
move event names out of format
vordimous May 20, 2024
7bff9fe
correct code to pass tests
vordimous May 30, 2024
1ba8a8e
refactor the compact session topic event
vordimous May 30, 2024
30430b8
move the static reason into the event formatter
vordimous Jun 3, 2024
f3ccc93
update model validation event messages
vordimous Jun 3, 2024
c45effe
update jwt guard event message
vordimous Jun 3, 2024
74af1f5
update catalog filesystem event message
vordimous Jun 3, 2024
d11f441
Add generic tls error message
vordimous Jun 3, 2024
0d122ac
update tcp event message
vordimous Jun 3, 2024
7bdd8e3
add context to mqtt client connected message
vordimous Jun 3, 2024
a23579b
update kafka and http message formatting
vordimous Jun 3, 2024
4086ca4
update apicurio artifact fetch messages
vordimous Jun 3, 2024
369e109
update karapace schema registry message formatting
vordimous Jun 3, 2024
6cd31b3
fix test
vordimous Jun 3, 2024
656b19a
Update runtime/binding-tls/src/main/java/io/aklivity/zilla/runtime/bi…
vordimous Jun 3, 2024
187bd0e
Improve jwt message with added reason
vordimous Jun 3, 2024
140f628
rename
vordimous Jun 3, 2024
6377a8a
improve mqtt session topic compated event message
vordimous Jun 3, 2024
0b38f7a
update code coverage for guard-jwt project to 0.97
vordimous Jun 3, 2024
5d6e603
Merge branch 'develop' into feature/1013-use-full-event-id-and-the-ev…
vordimous Jun 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update tests
  • Loading branch information
vordimous committed Jun 3, 2024
commit 56088290d72c6867f786cebe22546385161113db
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ telemetry:
events:
- qname: test.catalog0
id: catalog.filesystem.file.not.found
message: FILE_NOT_FOUND asyncapi/kafka.yaml
name: CATALOG_FILESYSTEM_FILE_NOT_FOUND
message: asyncapi/kafka.yaml
catalogs:
catalog0:
type: filesystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

public final class HttpEventFormatter implements EventFormatterSpi
{
private static final String REQUEST_ACCEPTED_FORMAT = "REQUEST_ACCEPTED %s %s %s %s %s";

private final EventFW eventRO = new EventFW();
private final HttpEventExFW httpEventExRO = new HttpEventExFW();

Expand All @@ -50,7 +48,7 @@ public String format(
case REQUEST_ACCEPTED:
{
HttpRequestAcceptedExFW ex = extension.requestAccepted();
result = String.format(REQUEST_ACCEPTED_FORMAT, identity(ex.identity()), asString(ex.scheme()), asString(ex.method()),
result = String.format("%s %s %s %s %s", identity(ex.identity()), asString(ex.scheme()), asString(ex.method()),
asString(ex.authority()), asString(ex.path()));
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@

public final class KafkaEventFormatter implements EventFormatterSpi
{
private static final String AUTHORIZATION_FAILED_FORMAT = "AUTHORIZATION_FAILED %s";
private static final String API_VERSION_REJECTED_FORMAT = "API_VERSION_REJECTED %d %d";

private final EventFW eventRO = new EventFW();
private final KafkaEventExFW kafkaEventExRO = new KafkaEventExFW();

Expand All @@ -52,13 +49,13 @@ public String format(
case AUTHORIZATION_FAILED:
{
KafkaAuthorizationFailedExFW ex = extension.authorizationFailed();
result = String.format(AUTHORIZATION_FAILED_FORMAT, identity(ex.identity()));
result = String.format("%s", identity(ex.identity()));
break;
}
case API_VERSION_REJECTED:
{
final KafkaApiVersionRejectedExFW ex = extension.apiVersionRejected();
result = String.format(API_VERSION_REJECTED_FORMAT, ex.apiKey(), ex.apiVersion());
result = String.format("%d %d", ex.apiKey(), ex.apiVersion());
}
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

public final class TcpEventFormatter implements EventFormatterSpi
{
private static final String DNS_FAILED_FORMAT = "DNS_FAILED %s";

private final EventFW eventRO = new EventFW();
private final TcpEventExFW tcpEventExRO = new TcpEventExFW();

Expand All @@ -50,7 +48,7 @@ public String format(
case DNS_FAILED:
{
final TcpDnsFailedExFW ex = extension.dnsFailed();
result = String.format(DNS_FAILED_FORMAT, asString(ex.address()));
result = String.format("%s", asString(ex.address()));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@

public final class TlsEventFormatter implements EventFormatterSpi
{
private static final String TLS_FAILED_FORMAT = "TLS_FAILED";
private static final String PROTOCOL_REJECTED_FORMAT = "PROTOCOL_REJECTED";
private static final String KEY_REJECTED_FORMAT = "KEY_REJECTED";
private static final String PEER_NOT_VERIFIED_FORMAT = "PEER_NOT_VERIFIED";
private static final String HANDSHAKE_FAILED_FORMAT = "HANDSHAKE_FAILED";

private final EventFW eventRO = new EventFW();
private final TlsEventExFW tlsEventExRO = new TlsEventExFW();

Expand All @@ -51,27 +45,27 @@ public String format(
{
case TLS_FAILED:
{
result = TLS_FAILED_FORMAT;
result = "";
break;
}
case TLS_PROTOCOL_REJECTED:
{
result = PROTOCOL_REJECTED_FORMAT;
result = "";
break;
}
case TLS_KEY_REJECTED:
{
result = KEY_REJECTED_FORMAT;
result = "";
break;
}
case TLS_PEER_NOT_VERIFIED:
{
result = PEER_NOT_VERIFIED_FORMAT;
result = "";
break;
}
case TLS_HANDSHAKE_FAILED:
{
result = HANDSHAKE_FAILED_FORMAT;
result = "";
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@

public final class KarapaceEventFormatter implements EventFormatterSpi
{
private static final String UNRETRIEVABLE_SCHEMA_SUBJECT_VERSION = "UNRETRIEVABLE_SCHEMA %s %s";
private static final String UNRETRIEVABLE_SCHEMA_SUBJECT_VERSION_STALE_SCHEMA =
"UNRETRIEVABLE_SCHEMA %s %s, USING_STALE_SCHEMA %d";
private static final String UNRETRIEVABLE_SCHEMA_ID = "UNRETRIEVABLE_SCHEMA_ID %d";
private static final String RETRIEVED_SCHEMA_SUBJECT_VERSION = "RETRIEVED_SCHEMA_SUBJECT_VERSION %s %s";
private static final String RETRIEVED_SCHEMA_ID = "RETRIEVED_SCHEMA_ID %d";

private final EventFW eventRO = new EventFW();
private final KarapaceEventExFW karapaceEventExRO = new KarapaceEventExFW();

Expand All @@ -58,33 +51,33 @@ public String format(
case UNRETRIEVABLE_SCHEMA_SUBJECT_VERSION:
{
KarapaceUnretrievableSchemaSubjectVersionExFW ex = extension.unretrievableSchemaSubjectVersion();
result = String.format(UNRETRIEVABLE_SCHEMA_SUBJECT_VERSION, asString(ex.subject()), asString(ex.version()));
result = String.format("%s %s", asString(ex.subject()), asString(ex.version()));
break;
}
case UNRETRIEVABLE_SCHEMA_SUBJECT_VERSION_STALE_SCHEMA:
{
KarapaceUnretrievableSchemaSubjectVersionStaleSchemaExFW ex = extension
.unretrievableSchemaSubjectVersionStaleSchema();
result = String.format(UNRETRIEVABLE_SCHEMA_SUBJECT_VERSION_STALE_SCHEMA, asString(ex.subject()),
result = String.format("%s %s, using stale schema: %d", asString(ex.subject()),
asString(ex.version()), ex.schemaId());
break;
}
case UNRETRIEVABLE_SCHEMA_ID:
{
KarapaceUnretrievableSchemaIdExFW ex = extension.unretrievableSchemaId();
result = String.format(UNRETRIEVABLE_SCHEMA_ID, ex.schemaId());
result = String.format("%d", ex.schemaId());
break;
}
case RETRIEVED_SCHEMA_SUBJECT_VERSION:
{
KarapaceRetrievableSchemaSubjectVersionExFW ex = extension.retrievableSchemaSubjectVersion();
result = String.format(RETRIEVED_SCHEMA_SUBJECT_VERSION, asString(ex.subject()), asString(ex.version()));
result = String.format("%s %s", asString(ex.subject()), asString(ex.version()));
break;
}
case RETRIEVED_SCHEMA_ID:
{
KarapaceRetrievableSchemaIdExFW ex = extension.retrievableSchemaId();
result = String.format(RETRIEVED_SCHEMA_ID, ex.schemaId());
result = String.format("%d", ex.schemaId());
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ private void handleEvent(
final EventFW event = eventRO.wrap(buffer, index, index + length);
String qname = context.supplyQName(event.namespacedId());
String id = context.supplyLocalName(event.id());
String name = context.supplyEventName(event.id());
String message = formatter.format(msgTypeId, buffer, index, length);
if (options.events != null && eventIndex < options.events.size())
{
TestExporterOptionsConfig.Event e = options.events.get(eventIndex);
if (!qname.equals(e.qName) || !id.equals(e.id) || !message.equals(e.message))
if (!qname.equals(e.qName) || !id.equals(e.id) || !name.equals(e.name) || !message.equals(e.message))
{
throw new IllegalStateException(String.format("event mismatch, expected: %s %s %s, got: %s %s %s",
e.qName, e.id, e.message, qname, id, message));
throw new IllegalStateException(String.format("event mismatch, expected: %s %s %s %s, got: %s %s %s %s",
e.qName, e.id, e.name, e.message, qname, id, name, message));
}
eventIndex++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,18 @@ public static final class Event
{
public final String qName;
public final String id;
public final String name;
public final String message;

public Event(
String qName,
String id,
String message)
String qName,
String id,
String name,
String message)
{
this.qName = qName;
this.id = id;
this.name = name;
this.message = message;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public final class TestExporterOptionsConfigAdapter implements OptionsConfigAdap
private static final String EVENTS_NAME = "events";
private static final String QNAME_NAME = "qname";
private static final String ID_NAME = "id";
private static final String NAME_NAME = "name";
private static final String MESSAGE_NAME = "message";

@Override
Expand Down Expand Up @@ -68,6 +69,7 @@ public JsonObject adaptToJson(
JsonObjectBuilder event = Json.createObjectBuilder();
event.add(QNAME_NAME, e.qName);
event.add(ID_NAME, e.id);
event.add(NAME_NAME, e.name);
event.add(MESSAGE_NAME, e.message);
events.add(event);
}
Expand Down Expand Up @@ -98,7 +100,12 @@ public OptionsConfig adaptFromJson(
JsonObject e0 = e.asJsonObject();
if (e0.containsKey(QNAME_NAME) && e0.containsKey(MESSAGE_NAME))
{
testOptions.event(e0.getString(QNAME_NAME), e0.getString(ID_NAME), e0.getString(MESSAGE_NAME));
testOptions.event(
e0.getString(QNAME_NAME),
e0.getString(ID_NAME),
e0.getString(NAME_NAME),
e0.getString(MESSAGE_NAME)
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ public TestExporterOptionsConfigBuilder<T> mode(
public TestExporterOptionsConfigBuilder<T> event(
String qName,
String id,
String name,
String message)
{
if (this.events == null)
{
this.events = new LinkedList<>();
}
this.events.add(new TestExporterOptionsConfig.Event(qName, id, message));
this.events.add(new TestExporterOptionsConfig.Event(qName, id, name, message));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ public class EventIT
public void shouldLogEvents() throws Exception
{
k3po.finish();
output.expect(Pattern.compile("test.net0 \\[[^\\]]+\\] test event message\n"));
output.expect(Pattern.compile("test.net0 \\[[^\\]]+\\] BINDING_TEST_CONNECTED - test event message\n"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

public final class JwtEventFormatter implements EventFormatterSpi
{
private static final String AUTHORIZATION_FAILED_FORMAT = "AUTHORIZATION_FAILED %s";

private final EventFW eventRO = new EventFW();
private final JwtEventExFW jwtEventExRO = new JwtEventExFW();

Expand All @@ -49,7 +47,7 @@ public String format(
case AUTHORIZATION_FAILED:
{
JwtAuthorizationFailedExFW ex = extension.authorizationFailed();
result = String.format(AUTHORIZATION_FAILED_FORMAT, identity(ex.identity()));
result = String.format("%s", identity(ex.identity()));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

public final class AvroModelEventFormatter implements EventFormatterSpi
{
private static final String VALIDATION_FAILED = "VALIDATION_FAILED %s";

private final EventFW eventRO = new EventFW();
private final AvroModelEventExFW jsonModelEventExFW = new AvroModelEventExFW();

Expand All @@ -49,7 +47,7 @@ public String format(
case VALIDATION_FAILED:
{
AvroModelValidationFailedExFW ex = extension.validationFailed();
result = String.format(VALIDATION_FAILED, asString(ex.error()));
result = String.format("%s", asString(ex.error()));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

public final class CoreModelEventFormatter implements EventFormatterSpi
{
private static final String VALIDATION_FAILED = "VALIDATION_FAILED %s";

private final EventFW eventRO = new EventFW();
private final CoreModelEventExFW coreModelEventExFW = new CoreModelEventExFW();

Expand All @@ -49,7 +47,7 @@ public String format(
case VALIDATION_FAILED:
{
CoreModelValidationFailedExFW ex = extension.validationFailed();
result = String.format(VALIDATION_FAILED, asString(ex.error()));
result = String.format("%s", asString(ex.error()));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

public final class JsonModelEventFormatter implements EventFormatterSpi
{
private static final String VALIDATION_FAILED = "VALIDATION_FAILED %s";

private final EventFW eventRO = new EventFW();
private final JsonModelEventExFW jsonModelEventExFW = new JsonModelEventExFW();

Expand All @@ -49,7 +47,7 @@ public String format(
case VALIDATION_FAILED:
{
JsonModelValidationFailedExFW ex = extension.validationFailed();
result = String.format(VALIDATION_FAILED, asString(ex.error()));
result = String.format("%s", asString(ex.error()));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

public final class ProtobufModelEventFormatter implements EventFormatterSpi
{
private static final String VALIDATION_FAILED = "VALIDATION_FAILED %s";

private final EventFW eventRO = new EventFW();
private final ProtobufModelEventExFW protobufModelEventExFW = new ProtobufModelEventExFW();

Expand All @@ -49,7 +47,7 @@ public String format(
case VALIDATION_FAILED:
{
ProtobufModelValidationFailedExFW ex = extension.validationFailed();
result = String.format(VALIDATION_FAILED, asString(ex.error()));
result = String.format("%s", asString(ex.error()));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ telemetry:
events:
- qname: test.net0
id: binding.http.request.accepted
message: REQUEST_ACCEPTED - http GET localhost:8080 /
name: BINDING_HTTP_REQUEST_ACCEPTED
message: http GET localhost:8080 /
bindings:
net0:
type: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ telemetry:
events:
- qname: test.net0
id: binding.http.request.accepted
message: REQUEST_ACCEPTED - http GET localhost:8080 /
name: BINDING_HTTP_REQUEST_ACCEPTED
message: http GET localhost:8080 /
bindings:
net0:
type: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ telemetry:
events:
- qname: test.app0
id: binding.kafka.api.version.rejected
message: API_VERSION_REJECTED 32 0
name: BINDING_KAFKA_API_VERSION_REJECTED
message: 32 0
Comment thread
vordimous marked this conversation as resolved.
bindings:
app0:
type: kafka
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ telemetry:
events:
- qname: test.app0
id: binding.tcp.dns.failed
message: DNS_FAILED localhost
name: BINDING_TCP_DNS_FAILED
message: localhost
bindings:
app0:
type: tcp
Expand Down
Loading