From b173eb6b33073cda4bebf71d9f74a54aa4e87bb8 Mon Sep 17 00:00:00 2001 From: eruizgar91 Date: Tue, 24 Mar 2020 15:57:41 +0100 Subject: [PATCH] New version of the schemas with the flattening of the details --- README.md | 6 +- pom.xml | 2 +- .../resources/avro/BlockDetailsRecord.avsc | 23 ----- src/main/resources/avro/BlockRecord.avsc | 15 +++- src/main/resources/avro/EventBlockRecord.avsc | 12 +-- .../resources/avro/EventDetailsRecord.avsc | 85 ------------------- src/main/resources/avro/EventRecord.avsc | 75 +++++++++++++++- src/main/resources/avro/LogDetailsRecord.avsc | 52 ------------ src/main/resources/avro/LogRecord.avsc | 51 ++++++++++- .../resources/avro/LogRecordPostgres.avsc | 22 ----- ...res.avsc => LogRecordTopicsFlattened.avsc} | 23 ++++- .../avro/TransactionDetailsRecord.avsc | 64 -------------- .../resources/avro/TransactionRecord.avsc | 56 +++++++++++- src/main/resources/avro/ViewBlockRecord.avsc | 12 +-- .../resources/avro/ViewDetailsRecord.avsc | 52 ------------ src/main/resources/avro/ViewRecord.avsc | 46 +++++++++- 16 files changed, 256 insertions(+), 340 deletions(-) delete mode 100644 src/main/resources/avro/BlockDetailsRecord.avsc delete mode 100644 src/main/resources/avro/EventDetailsRecord.avsc delete mode 100644 src/main/resources/avro/LogDetailsRecord.avsc delete mode 100644 src/main/resources/avro/LogRecordPostgres.avsc rename src/main/resources/avro/{LogDetailsRecordPostgres.avsc => LogRecordTopicsFlattened.avsc} (72%) delete mode 100644 src/main/resources/avro/TransactionDetailsRecord.avsc delete mode 100644 src/main/resources/avro/ViewDetailsRecord.avsc diff --git a/README.md b/README.md index b57ddfb..5432410 100644 --- a/README.md +++ b/README.md @@ -38,19 +38,15 @@ You can include the stubs generated with the schemas including the following dep The AVRO implementation of the schemas can be found in the **src/main/resources/avro/** folder. This are the schemas implemented: * AlertRecord.avsc -* BlockDetailsRecord.avsc * BlockRecord.avsc * EventBlockRecord.avsc -* EventDetailsRecord.avsc * EventRecord.avsc -* LogDetailsRecord.avsc * LogRecord.avsc +* LogRecordTopicsFlattened.avsc * NumberParameter.avsc * StringParameter.avsc * TimeSeriesParameter.avsc * TimeSeriesRecord.avsc -* TransactionDetailsRecord.avsc * TransactionRecord.avsc * ViewBlockRecord.avsc -* ViewDetailsRecord.avsc * ViewRecord.avsc diff --git a/pom.xml b/pom.xml index c363ff4..5112ec8 100755 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ io.keyko.monitoring schemas jar - 0.2.7 + 0.3.0 Web3 Monitoring Schemas https://github.com/keyko-io/web3-monitoring-schemas diff --git a/src/main/resources/avro/BlockDetailsRecord.avsc b/src/main/resources/avro/BlockDetailsRecord.avsc deleted file mode 100644 index 3b938f5..0000000 --- a/src/main/resources/avro/BlockDetailsRecord.avsc +++ /dev/null @@ -1,23 +0,0 @@ -{ - "namespace": "io.keyko.monitoring.schemas", - "type": "record", - "name": "BlockDetailsRecord", - "fields": [{ - "name": "number", - "type": "long" - }, - { - "name": "hash", - "type": "string" - }, - { - "name": "timestamp", - "type": "long", - "logicalType": "timestamp-millis" - }, - { - "name": "nodeName", - "type": "string" - } - ] -} \ No newline at end of file diff --git a/src/main/resources/avro/BlockRecord.avsc b/src/main/resources/avro/BlockRecord.avsc index 1559377..a1445d2 100644 --- a/src/main/resources/avro/BlockRecord.avsc +++ b/src/main/resources/avro/BlockRecord.avsc @@ -7,12 +7,21 @@ "type": "string" }, { - "name": "type", + "name": "number", + "type": "long" + }, + { + "name": "hash", "type": "string" }, { - "name": "details", - "type": "BlockDetailsRecord" + "name": "timestamp", + "type": "long", + "logicalType": "timestamp-millis" + }, + { + "name": "nodeName", + "type": "string" }, { "name": "retries", diff --git a/src/main/resources/avro/EventBlockRecord.avsc b/src/main/resources/avro/EventBlockRecord.avsc index 4e887e8..1af697b 100644 --- a/src/main/resources/avro/EventBlockRecord.avsc +++ b/src/main/resources/avro/EventBlockRecord.avsc @@ -7,16 +7,12 @@ "type": "string" }, { - "name": "type", - "type": "string" - }, - { - "name": "details", - "type": "EventDetailsRecord" + "name": "event", + "type": "EventRecord" }, { - "name": "detailsBlock", - "type": "BlockDetailsRecord" + "name": "block", + "type": "BlockRecord" }, { "name": "retries", diff --git a/src/main/resources/avro/EventDetailsRecord.avsc b/src/main/resources/avro/EventDetailsRecord.avsc deleted file mode 100644 index 0766f30..0000000 --- a/src/main/resources/avro/EventDetailsRecord.avsc +++ /dev/null @@ -1,85 +0,0 @@ -{ - "namespace": "io.keyko.monitoring.schemas", - "type": "record", - "name": "EventDetailsRecord", - "fields": [ - - { - "name": "name", - "type": "string" - }, - { - "name": "contractName", - "type": "string", - "default": "" - }, - { - "name": "filterId", - "type": "string" - }, - { - "name": "nodeName", - "type": "string" - }, - { - "name": "indexedParameters", - "type": { - "type": "array", - "items": ["StringParameter", "NumberParameter"] - } - }, - - { - "name": "nonIndexedParameters", - "type": { - "type": "array", - "items": ["StringParameter", "NumberParameter"] - } - }, - { - "name": "transactionHash", - "type": "string" - }, - { - "name": "logIndex", - "type": "string", - "java-class": "java.math.BigInteger" - }, - { - "name": "blockNumber", - "type": "long" - }, - { - "name": "blockHash", - "type": "string" - }, - { - "name": "address", - "type": "string" - }, - { - "name": "status", - "type": { - "name": "ContractEventStatus", - "type": "enum", - "symbols": [ - "UNCONFIRMED", - "CONFIRMED", - "INVALIDATED" - ] - } - }, - { - "name": "eventSpecificationSignature", - "type": "string" - }, - { - "name": "networkName", - "type": "string" - }, - { - "name": "id", - "type": "string" - } - ] -} \ No newline at end of file diff --git a/src/main/resources/avro/EventRecord.avsc b/src/main/resources/avro/EventRecord.avsc index 523604e..808b3b8 100644 --- a/src/main/resources/avro/EventRecord.avsc +++ b/src/main/resources/avro/EventRecord.avsc @@ -7,12 +7,81 @@ "type": "string" }, { - "name": "type", + "name": "name", "type": "string" }, { - "name": "details", - "type": "EventDetailsRecord" + "name": "contractName", + "type": "string", + "default": "" + }, + { + "name": "filterId", + "type": "string" + }, + { + "name": "nodeName", + "type": "string" + }, + { + "name": "indexedParameters", + "type": { + "type": "array", + "items": ["StringParameter", "NumberParameter"] + } + }, + + { + "name": "nonIndexedParameters", + "type": { + "type": "array", + "items": ["StringParameter", "NumberParameter"] + } + }, + { + "name": "transactionHash", + "type": "string" + }, + { + "name": "logIndex", + "type": "string", + "java-class": "java.math.BigInteger" + }, + { + "name": "blockNumber", + "type": "long" + }, + { + "name": "blockHash", + "type": "string" + }, + { + "name": "address", + "type": "string" + }, + { + "name": "status", + "type": { + "name": "ContractEventStatus", + "type": "enum", + "symbols": [ + "UNCONFIRMED", + "CONFIRMED", + "INVALIDATED" + ] + } + }, + { + "name": "eventSpecificationSignature", + "type": "string" + }, + { + "name": "networkName", + "type": "string" + }, + { + "name": "id", + "type": "string" }, { "name": "retries", diff --git a/src/main/resources/avro/LogDetailsRecord.avsc b/src/main/resources/avro/LogDetailsRecord.avsc deleted file mode 100644 index d7f7458..0000000 --- a/src/main/resources/avro/LogDetailsRecord.avsc +++ /dev/null @@ -1,52 +0,0 @@ -{ - "namespace": "io.keyko.monitoring.schemas", - "type": "record", - "name": "LogDetailsRecord", - "fields": [ - { - "name": "nodeName", - "type": "string" - }, - { - "name": "data", - "type":"string" - }, - { - "name": "topics", - "type": { - "name": "topic", - "type": "array", - "items": "string" - } - }, - { - "name": "transactionHash", - "type": "string" - }, - { - "name": "logIndex", - "type": "string", - "java-class": "java.math.BigInteger" - }, - { - "name": "blockNumber", - "type": "long" - }, - { - "name": "blockHash", - "type": "string" - }, - { - "name": "address", - "type": "string" - }, - { - "name": "networkName", - "type": "string" - }, - { - "name": "id", - "type": "string" - } - ] -} \ No newline at end of file diff --git a/src/main/resources/avro/LogRecord.avsc b/src/main/resources/avro/LogRecord.avsc index e396c4c..e1628f4 100644 --- a/src/main/resources/avro/LogRecord.avsc +++ b/src/main/resources/avro/LogRecord.avsc @@ -7,12 +7,57 @@ "type": "string" }, { - "name": "type", + "name": "nodeName", "type": "string" }, { - "name": "details", - "type": "LogDetailsRecord" + "name": "data", + "type":"string" + }, + { + "name": "topics", + "type": { + "name": "topic", + "type": "array", + "items": "string" + } + }, + { + "name": "transactionHash", + "type": "string" + }, + { + "name": "logIndex", + "type": "string", + "java-class": "java.math.BigInteger" + }, + { + "name": "blockNumber", + "type": "long" + }, + { + "name": "blockHash", + "type": "string" + }, + { + "name": "address", + "type": "string" + }, + { + "name": "networkName", + "type": "string" + }, + { + "name": "status", + "type": { + "name": "ContractEventStatus", + "type": "enum", + "symbols": [ + "UNCONFIRMED", + "CONFIRMED", + "INVALIDATED" + ] + } }, { "name": "retries", diff --git a/src/main/resources/avro/LogRecordPostgres.avsc b/src/main/resources/avro/LogRecordPostgres.avsc deleted file mode 100644 index 0015281..0000000 --- a/src/main/resources/avro/LogRecordPostgres.avsc +++ /dev/null @@ -1,22 +0,0 @@ -{ - "namespace": "io.keyko.monitoring.schemas", - "type": "record", - "name": "LogRecordPostgres", - "fields": [{ - "name": "id", - "type": "string" - }, - { - "name": "type", - "type": "string" - }, - { - "name": "details", - "type": "LogDetailsRecordPostgres" - }, - { - "name": "retries", - "type": "int" - } - ] -} \ No newline at end of file diff --git a/src/main/resources/avro/LogDetailsRecordPostgres.avsc b/src/main/resources/avro/LogRecordTopicsFlattened.avsc similarity index 72% rename from src/main/resources/avro/LogDetailsRecordPostgres.avsc rename to src/main/resources/avro/LogRecordTopicsFlattened.avsc index 1a09cd6..2d7096c 100644 --- a/src/main/resources/avro/LogDetailsRecordPostgres.avsc +++ b/src/main/resources/avro/LogRecordTopicsFlattened.avsc @@ -1,8 +1,11 @@ { "namespace": "io.keyko.monitoring.schemas", "type": "record", - "name": "LogDetailsRecordPostgres", - "fields": [ + "name": "LogRecordTopicsFlattened", + "fields": [{ + "name": "id", + "type": "string" + }, { "name": "nodeName", "type": "string" @@ -57,8 +60,20 @@ "type": "string" }, { - "name": "id", - "type": "string" + "name": "status", + "type": { + "name": "ContractEventStatus", + "type": "enum", + "symbols": [ + "UNCONFIRMED", + "CONFIRMED", + "INVALIDATED" + ] + } + }, + { + "name": "retries", + "type": "int" } ] } \ No newline at end of file diff --git a/src/main/resources/avro/TransactionDetailsRecord.avsc b/src/main/resources/avro/TransactionDetailsRecord.avsc deleted file mode 100644 index 8f16bfb..0000000 --- a/src/main/resources/avro/TransactionDetailsRecord.avsc +++ /dev/null @@ -1,64 +0,0 @@ -{ - "namespace": "io.keyko.monitoring.schemas", - "type": "record", - "name": "TransactionDetailsRecord", - "fields": [{ - "name": "hash", - "type": "string" - }, - { - "name": "nonce", - "type": "string" - }, - { - "name": "blockNumber", - "type": "long" - }, - { - "name": "blockHash", - "type": "string" - }, - { - "name": "transactionIndex", - "type": "string" - }, - { - "name": "from", - "type": "string" - }, - { - "name": "to", - "type": "string" - }, - { - "name": "value", - "type": "string" - }, - { - "name": "nodeName", - "type": "string" - }, - { - "name": "contractAddress", - "type": "string" - }, - { - "name": "input", - "type": "string" - }, - { - "name": "revertReason", - "type": "string" - }, - { - "name": "status", - "type": { - "name": "TransactionStatus", - "type": "enum", - "symbols": [ - "UNCONFIRMED", "CONFIRMED", "INVALIDATED", "FAILED" - ] - } - } - ] -} \ No newline at end of file diff --git a/src/main/resources/avro/TransactionRecord.avsc b/src/main/resources/avro/TransactionRecord.avsc index 48c1a5d..ceb8f91 100644 --- a/src/main/resources/avro/TransactionRecord.avsc +++ b/src/main/resources/avro/TransactionRecord.avsc @@ -7,12 +7,62 @@ "type": "string" }, { - "name": "type", + "name": "hash", "type": "string" }, { - "name": "details", - "type": "TransactionDetailsRecord" + "name": "nonce", + "type": "string" + }, + { + "name": "blockNumber", + "type": "long" + }, + { + "name": "blockHash", + "type": "string" + }, + { + "name": "transactionIndex", + "type": "string" + }, + { + "name": "from", + "type": "string" + }, + { + "name": "to", + "type": "string" + }, + { + "name": "value", + "type": "string" + }, + { + "name": "nodeName", + "type": "string" + }, + { + "name": "contractAddress", + "type": "string" + }, + { + "name": "input", + "type": "string" + }, + { + "name": "revertReason", + "type": "string" + }, + { + "name": "status", + "type": { + "name": "TransactionStatus", + "type": "enum", + "symbols": [ + "UNCONFIRMED", "CONFIRMED", "INVALIDATED", "FAILED" + ] + } }, { "name": "retries", diff --git a/src/main/resources/avro/ViewBlockRecord.avsc b/src/main/resources/avro/ViewBlockRecord.avsc index 91cce64..25ed0e7 100644 --- a/src/main/resources/avro/ViewBlockRecord.avsc +++ b/src/main/resources/avro/ViewBlockRecord.avsc @@ -7,16 +7,12 @@ "type": "string" }, { - "name": "type", - "type": "string" - }, - { - "name": "details", - "type": "ViewDetailsRecord" + "name": "view", + "type": "ViewRecord" }, { - "name": "detailsBlock", - "type": "BlockDetailsRecord" + "name": "block", + "type": "BlockRecord" }, { "name": "retries", diff --git a/src/main/resources/avro/ViewDetailsRecord.avsc b/src/main/resources/avro/ViewDetailsRecord.avsc deleted file mode 100644 index dfded0f..0000000 --- a/src/main/resources/avro/ViewDetailsRecord.avsc +++ /dev/null @@ -1,52 +0,0 @@ -{ - "namespace": "io.keyko.monitoring.schemas", - "type": "record", - "name": "ViewDetailsRecord", - "fields": [{ - "name": "name", - "type": "string" - }, - { - "name": "contractName", - "type": "string", - "default": "" - }, - { - "name": "filterId", - "type": "string" - }, - { - "name": "nodeName", - "type": "string" - }, - { - "name": "output", - "type": { - "type": "array", - "items": ["StringParameter", "NumberParameter"] - } - }, - - { - "name": "blockNumber", - "type": "long" - }, - { - "name": "blockHash", - "type": "string" - }, - { - "name": "address", - "type": "string" - }, - { - "name": "networkName", - "type": "string" - }, - { - "name": "id", - "type": "string" - } - - ] -} \ No newline at end of file diff --git a/src/main/resources/avro/ViewRecord.avsc b/src/main/resources/avro/ViewRecord.avsc index ecab3ad..a399236 100644 --- a/src/main/resources/avro/ViewRecord.avsc +++ b/src/main/resources/avro/ViewRecord.avsc @@ -2,17 +2,55 @@ "namespace": "io.keyko.monitoring.schemas", "type": "record", "name": "ViewRecord", - "fields": [{ + "fields": [ + { "name": "id", "type": "string" }, { - "name": "type", + "name": "name", + "type": "string" + }, + { + "name": "contractName", + "type": "string", + "default": "" + }, + { + "name": "filterId", + "type": "string" + }, + { + "name": "nodeName", + "type": "string" + }, + { + "name": "output", + "type": { + "type": "array", + "items": ["StringParameter", "NumberParameter"] + } + }, + + { + "name": "blockNumber", + "type": "long" + }, + { + "name": "blockHash", + "type": "string" + }, + { + "name": "address", + "type": "string" + }, + { + "name": "networkName", "type": "string" }, { - "name": "details", - "type": "ViewDetailsRecord" + "name": "id", + "type": "string" }, { "name": "retries",