-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support local logging of events (#755)
- Loading branch information
1 parent
d0a8f21
commit 77be54a
Showing
121 changed files
with
5,832 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
incubator/catalog-schema-registry.spec/src/main/resources/META-INF/zilla/schema_registry.idl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2021-2023 Aklivity Inc | ||
* | ||
* Licensed under the Aklivity Community License (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* https://www.aklivity.io/aklivity-community-license/ | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
scope schema_registry | ||
{ | ||
scope event | ||
{ | ||
enum SchemaRegistryEventType (uint8) | ||
{ | ||
REMOTE_ACCESS_REJECTED (1) | ||
} | ||
|
||
struct SchemaRegistryRemoteAccessRejected extends core::event::Event | ||
{ | ||
string8 method; | ||
string16 url; | ||
int16 status; | ||
} | ||
|
||
union SchemaRegistryEvent switch (SchemaRegistryEventType) | ||
{ | ||
case REMOTE_ACCESS_REJECTED: SchemaRegistryRemoteAccessRejected remoteAccessRejected; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...o/aklivity/zilla/runtime/catalog/schema/registry/internal/SchemaRegistryEventContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2021-2023 Aklivity Inc | ||
* | ||
* Licensed under the Aklivity Community License (the "License"); you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* https://www.aklivity.io/aklivity-community-license/ | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package io.aklivity.zilla.runtime.catalog.schema.registry.internal; | ||
|
||
import java.net.http.HttpRequest; | ||
import java.nio.ByteBuffer; | ||
import java.time.Clock; | ||
|
||
import org.agrona.MutableDirectBuffer; | ||
import org.agrona.concurrent.UnsafeBuffer; | ||
|
||
import io.aklivity.zilla.runtime.catalog.schema.registry.internal.types.event.SchemaRegistryEventFW; | ||
import io.aklivity.zilla.runtime.engine.EngineContext; | ||
import io.aklivity.zilla.runtime.engine.binding.function.MessageConsumer; | ||
|
||
public class SchemaRegistryEventContext | ||
{ | ||
private static final int EVENT_BUFFER_CAPACITY = 1024; | ||
|
||
private final SchemaRegistryEventFW.Builder schemaRegistryEventRW = new SchemaRegistryEventFW.Builder(); | ||
private final MutableDirectBuffer eventBuffer = new UnsafeBuffer(ByteBuffer.allocate(EVENT_BUFFER_CAPACITY)); | ||
private final int schemaRegistryTypeId; | ||
private final MessageConsumer eventWriter; | ||
private final Clock clock; | ||
|
||
public SchemaRegistryEventContext( | ||
EngineContext context) | ||
{ | ||
this.schemaRegistryTypeId = context.supplyTypeId(SchemaRegistryCatalog.NAME); | ||
this.eventWriter = context.supplyEventWriter(); | ||
this.clock = context.clock(); | ||
} | ||
|
||
public void remoteAccessRejected( | ||
long catalogId, | ||
HttpRequest httpRequest, | ||
int status) | ||
{ | ||
SchemaRegistryEventFW event = schemaRegistryEventRW | ||
.wrap(eventBuffer, 0, eventBuffer.capacity()) | ||
.remoteAccessRejected(e -> e | ||
.timestamp(clock.millis()) | ||
.traceId(0L) | ||
.namespacedId(catalogId) | ||
.method(httpRequest.method()) | ||
.url(httpRequest.uri().toString()) | ||
.status((short) status) | ||
) | ||
.build(); | ||
eventWriter.accept(schemaRegistryTypeId, event.buffer(), event.offset(), event.limit()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.