Skip to content

Commit

Permalink
Debugging improvements for UDMIS (#884)
Browse files Browse the repository at this point in the history
  • Loading branch information
grafnu authored May 9, 2024
1 parent e8be8c1 commit 26d37f5
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 14 deletions.
12 changes: 6 additions & 6 deletions .gencode_hash.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ ecafb56114c92e873329f184471ae39c002a12f1495bd75b24df22846ebb35a3 gencode/docs/m
cef1f97e99926506670c45790e2988ba6020bc6a399e74b1f849715c8acbe26f gencode/docs/site_metadata.html
12a32a1555e58e6ba35566e6613eea5f9b70f80a02d58146ad250acb830cf378 gencode/docs/state.html
b2398e7f9e352c47867e38f97168f3eb88e23280c7dd576f13e038c8c3f714c9 gencode/docs/state_mapping.html
567b27a9257816eb9a9063ce089fe0f58c5962f10ea449bb7c653bd6151365a8 gencode/docs/state_udmi.html
f2ee2c60326e8b2bc33c6897387bb9eeacf8313b55959dfd9d001d4e6e6479e9 gencode/docs/state_validation.html
820aac07d69ef31258cc6571aecb690ade18a1ec8552b8ba9ddb028ab4b326dc gencode/docs/state_udmi.html
106b6be125dd5dbb243e421cbc55eb4936a664682b09b398c8b0a342f388da00 gencode/docs/state_validation.html
e7fd1ba351739871fb20a3d994ac31e4e94fd6586e9b2a28c01688ee65618040 gencode/java/udmi/schema/Adjunct.java
d39d7fe37a41c74a40080af7b0a429d201ab1fdff7444428c4b98eb7b38c332b gencode/java/udmi/schema/Asset.java
b405ce628f7819b46b19950aeaba89ee938fea54261000616bc534b9f81bd59c gencode/java/udmi/schema/Auth_provider.java
Expand Down Expand Up @@ -112,8 +112,8 @@ d5e11dc354995681b894bcb62e4e21da7f0be68aaa3643a3dc5aa13610741f29 gencode/java/u
8e0490eed4499749b422ffde98a9588a597e8860b74dedae979abdb22f94c38a gencode/java/udmi/schema/PubberOptions.java
01df260ecaa5c396045931756ff02f8ec65321908bd08b25cecd7d6086825fef gencode/java/udmi/schema/SchemaValidationState.java
494451b900c9f111f5a768a6e1a85d935bb0175aa6c7f6a2ae9248a23e8be819 gencode/java/udmi/schema/SequenceValidationState.java
9da49b22341a65580d085fd9d00eaadcaefcf7b813988ef844c617aa4b8a9a4f gencode/java/udmi/schema/SetupUdmiConfig.java
e79f3842470cc1f12b1d0a9d6691b147aeb4d6bf29e24872721133352aed1cc9 gencode/java/udmi/schema/SetupUdmiState.java
561ec6b399fed757f489c0feb5066261120827e713ee3f70318c8859bd7e8a0a gencode/java/udmi/schema/SetupUdmiConfig.java
b158103ad494953aeff92eb613a5d57c448c9f692dd90ebd84396d5e9b6e75f2 gencode/java/udmi/schema/SetupUdmiState.java
d46f3c0f99b65049ca8a8395856f5c7580981cc37929e79c4ee8195715171cd2 gencode/java/udmi/schema/SiteMetadata.java
d67a313587648034d5423dc7ea0c6d6a46149a33086a4deec79ee3eb3af65410 gencode/java/udmi/schema/State.java
47ad54328160a1aabce719a3263d4bfea903e8e8255e04a54ace86eb095b0f0c gencode/java/udmi/schema/StateSystemHardware.java
Expand Down Expand Up @@ -155,7 +155,7 @@ ac3facbd96f7cb2f7e387e7497d6a36af379a2687329571f250c5670f9933244 gencode/python
5444c5eb6971addf729566e39e7eb13dd8b78dceeeab3ef8a6ec3d2a7f5ed25c gencode/python/udmi/schema/config_pointset_point.py
7da3bdb37f338260d5f3829fa5fcbb9bbf9f146b514a68319c314a96c6b8ac12 gencode/python/udmi/schema/config_system.py
b15c649657d0fb2a102a3e1ff9653c9002715d3b412d44c544a080c37b6a9811 gencode/python/udmi/schema/config_system_testing.py
30b1809e364cb3f7070002bb4a9954b11b25543b099b4bbe450d280001e4de55 gencode/python/udmi/schema/config_udmi.py
7f67df897d5b9873e3e00312359f894ac0938e99b7dbe6c26efb031636ac84fe gencode/python/udmi/schema/config_udmi.py
9b2567eba7e0d42fde35b42b9a0c632d45b7f356ebfd12ec83f2e4b478e50331 gencode/python/udmi/schema/configuration_endpoint.py
ce2ff5646f2707cad62426b54f769eac763308e411ef1925aa54eae1274a8e75 gencode/python/udmi/schema/configuration_execution.py
8f65402ddb43815f4482b1c0c965d44c390dbe1561899b3d9df572458ceb97cc gencode/python/udmi/schema/configuration_pod.py
Expand Down Expand Up @@ -216,7 +216,7 @@ ee5cc804c59d8216cc3555741748c2d67e30ad5ac2a801ad18b44569835e4f75 gencode/python
1b313e7c02ed0af08db89453ec6acee7571f9a2af0e289ac6f3f9be3df6928f5 gencode/python/udmi/schema/state_system.py
8a0bf4294fb70533a056322a6bfc6f13a963381d2100d1468d8b6de757cd72e9 gencode/python/udmi/schema/state_system_hardware.py
37c55dce0e38dddad3cebb3d40270128a4dbb7b586657d1746bb96dac90e2ac1 gencode/python/udmi/schema/state_system_operation.py
e81b91a8e26bb8ba2aed4f395b522311051550b25b9fcd64931da3c1a6ed6288 gencode/python/udmi/schema/state_udmi.py
37d91d2ad83b13e99c1d64419b443978584acde4bdd9191f2009d67c469887d1 gencode/python/udmi/schema/state_udmi.py
ad977860afed7a2e7e895e3270350cdf847ffcd24d65d102ecefbdf100908987 gencode/python/udmi/schema/state_validation.py
69fd8989cff79d3dd1e0396993965112f4bc5d8fb1360e8477b433d202519f75 gencode/python/udmi/schema/state_validation_capability.py
5d24e4bf0fa0213d380e8058f562f6b9382041ade57cd7d6d9d38d84a68aa1fd gencode/python/udmi/schema/state_validation_feature.py
Expand Down
40 changes: 40 additions & 0 deletions gencode/docs/state_udmi.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions gencode/docs/state_validation.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions gencode/java/udmi/schema/SetupUdmiConfig.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions gencode/java/udmi/schema/SetupUdmiState.java

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions gencode/python/udmi/schema/config_udmi.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions gencode/python/udmi/schema/state_udmi.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions schema/config_udmi.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
},
"deployed_by": {
"type": "string"
},
"transaction_id": {
"type": "string"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions schema/state_udmi.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"update_to": {
"type": "string",
"description": "Optional version for a udmis update trigger"
},
"transaction_id": {
"type": "string"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.google.bos.udmi.service.core;

import static com.google.udmi.util.GeneralUtils.catchToNull;
import static com.google.udmi.util.GeneralUtils.ifNotNullThen;
import static com.google.udmi.util.JsonUtil.convertTo;
import static com.google.udmi.util.JsonUtil.isoConvert;
import static com.google.udmi.util.JsonUtil.stringify;
import static com.google.udmi.util.JsonUtil.toMap;
import static com.google.udmi.util.MessageUpgrader.STATE_SCHEMA;
Expand Down Expand Up @@ -60,10 +62,10 @@ protected SubType getExceptionSubType() {
private void shardStateUpdate(MessageContinuation continuation, Envelope envelope,
StateUpdate message) {
continuation.publish(message);
String originalTransaction = envelope.transactionId;
String origTxnId = envelope.transactionId;
AtomicInteger txnSuffix = new AtomicInteger();
info("Sharding state message for %s/%s %s", envelope.deviceRegistryId, envelope.deviceId,
originalTransaction);
info("Sharding state message for %s/%s %s last_config %s", envelope.deviceRegistryId,
envelope.deviceId, origTxnId, isoConvert(catchToNull(() -> message.system.last_config)));
Arrays.stream(State.class.getFields()).forEach(field -> {
try {
if (STATE_SUB_FOLDERS.contains(field.getName())) {
Expand All @@ -72,7 +74,7 @@ private void shardStateUpdate(MessageContinuation continuation, Envelope envelop
stringObjectMap.put("version", message.version);
stringObjectMap.put("timestamp", message.timestamp);
envelope.subFolder = SubFolder.fromValue(field.getName());
envelope.transactionId = originalTransaction + "-" + txnSuffix.getAndIncrement();
envelope.transactionId = origTxnId + "-" + txnSuffix.getAndIncrement();
debug("Sharding state %s %s", envelope.subFolder, envelope.transactionId);
reflectMessage(envelope, stringify(stringObjectMap));
continuation.publish(stringObjectMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.google.bos.udmi.service.messaging.impl.MessageBase.combineConfig;
import static com.google.common.base.Preconditions.checkState;
import static com.google.udmi.util.GeneralUtils.CSV_JOINER;
import static com.google.udmi.util.GeneralUtils.catchToNull;
import static com.google.udmi.util.GeneralUtils.copyFields;
import static com.google.udmi.util.GeneralUtils.friendlyStackTrace;
import static com.google.udmi.util.GeneralUtils.ifNotNullGet;
Expand Down Expand Up @@ -116,6 +117,7 @@ public static UdmiConfig getUdmiConfig(UdmiState toolState) {
udmiConfig.setup.udmi_version = UDMI_VERSION;
udmiConfig.setup.functions_min = ContainerBase.FUNCTIONS_VERSION_MIN;
udmiConfig.setup.functions_max = ContainerBase.FUNCTIONS_VERSION_MAX;
udmiConfig.setup.transaction_id = catchToNull(() -> toolState.setup.transaction_id);
return udmiConfig;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ private void initializeReflectorState() {
UdmiState udmiState = new UdmiState();
udmiState.setup = new SetupUdmiState();
udmiState.setup.user = System.getenv("USER");
udmiState.setup.transaction_id = getNextTransactionId();
udmiState.setup.update_to = updateTo;
try {
reflectorStateTimestamp = new Date();
Expand Down

0 comments on commit 26d37f5

Please sign in to comment.