@zlink-systems/framework 0.30.3 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/contracts/Actors/ZLinkActor.d.ts +2 -0
- package/dist/contracts/Actors/ZLinkSessionBindingIdentity.d.ts +6 -0
- package/dist/contracts/Actors/ZLinkSessionBindingIdentity.js +2 -0
- package/dist/contracts/Actors/index.d.ts +1 -0
- package/dist/contracts/Actors/index.js +1 -0
- package/dist/contracts/Common/CoreTypes.d.ts +1 -0
- package/dist/contracts/Common/HandlerMessageType.d.ts +8 -0
- package/dist/contracts/Common/HandlerMessageType.js +41 -0
- package/dist/contracts/Common/ZLinkEncodedPayload.d.ts +1 -1
- package/dist/contracts/Common/ZLinkEncodedPayload.js +12 -20
- package/dist/contracts/Common/ZLinkMessage.js +11 -7
- package/dist/contracts/Common/encoded-payload-storage.d.ts +0 -2
- package/dist/contracts/Common/encoded-payload-storage.js +4 -16
- package/dist/contracts/Common/index.d.ts +1 -1
- package/dist/contracts/Common/payload-slab.d.ts +4 -0
- package/dist/contracts/Common/payload-slab.js +30 -0
- package/dist/contracts/Configuration/RegistrationBuilders.js +15 -9
- package/dist/contracts/Configuration/RegistrationTypes.d.ts +19 -0
- package/dist/contracts/Handlers/Contexts.d.ts +1 -0
- package/dist/contracts/Locations/Authority.d.ts +2 -0
- package/dist/internal.d.ts +9 -0
- package/dist/internal.js +23 -1
- package/dist/nest-integration.d.ts +1 -0
- package/dist/nest-integration.js +3 -1
- package/dist/runtime/actors/actor-client.d.ts +6 -2
- package/dist/runtime/actors/actor-client.js +120 -82
- package/dist/runtime/actors/actor-context.js +16 -5
- package/dist/runtime/actors/actor-execution-context.js +2 -2
- package/dist/runtime/actors/actor-handoff.d.ts +12 -1
- package/dist/runtime/actors/actor-handoff.js +79 -34
- package/dist/runtime/actors/actor-join-deferred-scope.js +6 -6
- package/dist/runtime/actors/actor-local-native-join.d.ts +2 -2
- package/dist/runtime/actors/actor-local-native-join.js +19 -17
- package/dist/runtime/actors/actor-mailbox.d.ts +1 -1
- package/dist/runtime/actors/actor-remote-joiner.d.ts +2 -2
- package/dist/runtime/actors/actor-remote-joiner.js +4 -4
- package/dist/runtime/actors/actor-routed-join-transport.d.ts +9 -3
- package/dist/runtime/actors/actor-routed-json-request.d.ts +3 -0
- package/dist/runtime/actors/actor-runtime-contracts.d.ts +2 -2
- package/dist/runtime/actors/actor-runtime-state.d.ts +1 -1
- package/dist/runtime/actors/spot-actor-dispatch.d.ts +9 -5
- package/dist/runtime/actors/spot-actor-dispatch.js +60 -38
- package/dist/runtime/admission.d.ts +6 -4
- package/dist/runtime/admission.js +21 -10
- package/dist/runtime/application-jobs/application-ingress-record-owner.d.ts +1 -0
- package/dist/runtime/application-jobs/application-ingress-record-owner.js +3 -0
- package/dist/runtime/backend/contracts/index.d.ts +26 -10
- package/dist/runtime/backend/mesh-completion-table.d.ts +7 -1
- package/dist/runtime/backend/mesh-completion-table.js +84 -20
- package/dist/runtime/backend/mesh-dispatch-pump.d.ts +19 -6
- package/dist/runtime/backend/mesh-dispatch-pump.js +246 -147
- package/dist/runtime/backend/node/node-backend-adapter-support.d.ts +3 -2
- package/dist/runtime/backend/node/node-backend-adapter-support.js +27 -19
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.d.ts +5 -2
- package/dist/runtime/backend/node/node-dealer-channel-client-transport.js +70 -13
- package/dist/runtime/backend/node/node-event-loop-poller.d.ts +2 -2
- package/dist/runtime/backend/node/node-event-loop-poller.js +4 -3
- package/dist/runtime/backend/node/node-mesh-backend-adapter.js +5 -1
- package/dist/runtime/backend/node/node-raw-binding-port.d.ts +7 -2
- package/dist/runtime/backend/node/node-raw-binding-port.js +99 -63
- package/dist/runtime/backend/node/node-raw-mesh-backend.d.ts +34 -16
- package/dist/runtime/backend/node/node-raw-mesh-backend.js +210 -106
- package/dist/runtime/backend/node/node-socket-backend-adapter.js +20 -6
- package/dist/runtime/backend/raw-binding-port.d.ts +6 -3
- package/dist/runtime/channels/channel-clients.js +3 -3
- package/dist/runtime/channels/channel-dispatch-pipeline.d.ts +11 -7
- package/dist/runtime/channels/channel-dispatch-pipeline.js +40 -22
- package/dist/runtime/channels/channel-dispatch-services.d.ts +3 -1
- package/dist/runtime/channels/channel-dispatch-services.js +7 -6
- package/dist/runtime/channels/channel-dispatchers.d.ts +13 -6
- package/dist/runtime/channels/channel-dispatchers.js +57 -36
- package/dist/runtime/channels/channel-envelope.d.ts +2 -2
- package/dist/runtime/channels/channel-envelope.js +609 -83
- package/dist/runtime/channels/channel-multipart.d.ts +1 -0
- package/dist/runtime/channels/channel-multipart.js +10 -6
- package/dist/runtime/channels/channel-outbound-operations.d.ts +6 -9
- package/dist/runtime/channels/channel-outbound-operations.js +107 -105
- package/dist/runtime/channels/channel-receive-loops.d.ts +9 -7
- package/dist/runtime/channels/channel-receive-loops.js +126 -90
- package/dist/runtime/channels/channel-runtime-lifecycle.d.ts +23 -6
- package/dist/runtime/channels/channel-runtime-lifecycle.js +47 -38
- package/dist/runtime/channels/channel-runtime-manager.d.ts +13 -6
- package/dist/runtime/channels/channel-runtime-manager.js +32 -14
- package/dist/runtime/channels/channel-socket-registry.d.ts +28 -4
- package/dist/runtime/channels/channel-socket-registry.js +9 -1
- package/dist/runtime/channels/channel-transports.d.ts +23 -16
- package/dist/runtime/channels/channel-transports.js +139 -119
- package/dist/runtime/channels/dispatch-error-reporter.d.ts +4 -4
- package/dist/runtime/channels/dispatch-error-reporter.js +5 -5
- package/dist/runtime/channels/fanout-location-runtime.d.ts +1 -1
- package/dist/runtime/channels/local-spot-route-transport.d.ts +5 -2
- package/dist/runtime/channels/local-spot-route-transport.js +15 -18
- package/dist/runtime/channels/router-socket-spot-route-transport.d.ts +6 -3
- package/dist/runtime/channels/router-socket-spot-route-transport.js +33 -19
- package/dist/runtime/channels/source-spot-router.d.ts +6 -3
- package/dist/runtime/channels/source-spot-router.js +34 -23
- package/dist/runtime/channels/spot-node-route-transport.d.ts +6 -3
- package/dist/runtime/channels/spot-node-route-transport.js +23 -17
- package/dist/runtime/channels/spot-route-bridge-transport.d.ts +6 -3
- package/dist/runtime/channels/spot-route-bridge-transport.js +38 -24
- package/dist/runtime/channels/spot-route-dispatch-strategy.d.ts +8 -4
- package/dist/runtime/channels/spot-route-dispatch-strategy.js +36 -23
- package/dist/runtime/diagnostics/dispatch-error-details.js +9 -3
- package/dist/runtime/diagnostics/message-flow-bootstrap.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow-bootstrap.js +8 -0
- package/dist/runtime/diagnostics/message-flow-delivery.d.ts +47 -0
- package/dist/runtime/diagnostics/message-flow-delivery.js +149 -0
- package/dist/runtime/diagnostics/message-flow-record.d.ts +50 -0
- package/dist/runtime/diagnostics/message-flow-record.js +228 -0
- package/dist/runtime/diagnostics/message-flow-worker.d.ts +1 -0
- package/dist/runtime/diagnostics/message-flow-worker.js +118 -0
- package/dist/runtime/diagnostics/message-flow.d.ts +7 -19
- package/dist/runtime/diagnostics/message-flow.js +42 -290
- package/dist/runtime/diagnostics/runtime-metrics.d.ts +4 -3
- package/dist/runtime/diagnostics/runtime-metrics.js +8 -4
- package/dist/runtime/execution/index.d.ts +1 -0
- package/dist/runtime/execution/index.js +6 -3
- package/dist/runtime/execution/serial-execution-queue.d.ts +26 -13
- package/dist/runtime/execution/serial-execution-queue.js +75 -71
- package/dist/runtime/foundation/durable-service-request.d.ts +12 -3
- package/dist/runtime/foundation/durable-service-request.js +158 -73
- package/dist/runtime/foundation/operation-registry.d.ts +33 -3
- package/dist/runtime/foundation/operation-registry.js +272 -33
- package/dist/runtime/foundation/raw-service-mesh-runtime.d.ts +62 -23
- package/dist/runtime/foundation/raw-service-mesh-runtime.js +373 -194
- package/dist/runtime/foundation/request-runtime.d.ts +17 -0
- package/dist/runtime/foundation/request-runtime.js +163 -0
- package/dist/runtime/foundation/service-discovery-registry.d.ts +4 -0
- package/dist/runtime/foundation/service-discovery-registry.js +6 -0
- package/dist/runtime/foundation/service-liveness-registry.d.ts +1 -1
- package/dist/runtime/foundation/service-mailbox.d.ts +4 -2
- package/dist/runtime/foundation/service-mailbox.js +4 -1
- package/dist/runtime/foundation/service-relocation-object-owner.d.ts +2 -2
- package/dist/runtime/foundation/service-relocation-object-owner.js +12 -5
- package/dist/runtime/foundation/service-runtime-contracts.d.ts +7 -2
- package/dist/runtime/foundation/service-stateful-registry.d.ts +6 -2
- package/dist/runtime/foundation/service-stateful-registry.js +38 -17
- package/dist/runtime/foundation/service-stateful-runtime.d.ts +91 -26
- package/dist/runtime/foundation/service-stateful-runtime.js +245 -120
- package/dist/runtime/foundation/service-stateful-wire-codec.d.ts +3 -0
- package/dist/runtime/foundation/service-stateful-wire-codec.js +15 -0
- package/dist/runtime/foundation/service-topology-registry.d.ts +2 -0
- package/dist/runtime/foundation/service-topology-registry.js +13 -3
- package/dist/runtime/foundation/service-wire-constants.generated.d.ts +1 -0
- package/dist/runtime/foundation/service-wire-constants.generated.js +12 -0
- package/dist/runtime/foundation/service-wire-m6a-codec.d.ts +5 -1
- package/dist/runtime/foundation/service-wire-m6a-codec.js +50 -15
- package/dist/runtime/host/actor-packet-relay.d.ts +5 -6
- package/dist/runtime/host/actor-packet-relay.js +58 -57
- package/dist/runtime/host/actor-placement-coordinator.d.ts +1 -1
- package/dist/runtime/host/actor-runtime-options-factory.d.ts +2 -0
- package/dist/runtime/host/actor-runtime-options-factory.js +3 -2
- package/dist/runtime/host/actor-transfer-runtime.d.ts +3 -3
- package/dist/runtime/host/application-job-queue.d.ts +7 -5
- package/dist/runtime/host/application-job-queue.js +33 -21
- package/dist/runtime/host/bound-session-relay.js +0 -1
- package/dist/runtime/host/channel-runtime-options-factory.d.ts +2 -0
- package/dist/runtime/host/channel-runtime-options-factory.js +1 -0
- package/dist/runtime/host/entry-actor-runtime.d.ts +5 -2
- package/dist/runtime/host/entry-actor-runtime.js +2 -2
- package/dist/runtime/host/index.d.ts +106 -37
- package/dist/runtime/host/index.js +303 -151
- package/dist/runtime/host/location-runtime-owner.d.ts +2 -2
- package/dist/runtime/host/location-runtime-owner.js +1 -1
- package/dist/runtime/host/service-relocation-host-runtime.d.ts +195 -45
- package/dist/runtime/host/service-relocation-host-runtime.js +257 -144
- package/dist/runtime/host/spot-address-transport.d.ts +3 -0
- package/dist/runtime/host/spot-address-transport.js +73 -76
- package/dist/runtime/host/spot-runtime-options-factory.js +2 -0
- package/dist/runtime/host/user-spot-creation-coordinator.d.ts +3 -1
- package/dist/runtime/host/user-spot-creation-coordinator.js +49 -21
- package/dist/runtime/internal-observation.d.ts +1 -0
- package/dist/runtime/internal-observation.js +5 -0
- package/dist/runtime/locations/actor-location-claims.d.ts +1 -1
- package/dist/runtime/locations/actor-location-claims.js +15 -6
- package/dist/runtime/locations/auto-connect-loop.d.ts +0 -1
- package/dist/runtime/locations/auto-connect-loop.js +25 -19
- package/dist/runtime/locations/auto-connect-planner.js +2 -5
- package/dist/runtime/locations/auto-connect-reconciler.d.ts +1 -0
- package/dist/runtime/locations/auto-connect-reconciler.js +35 -23
- package/dist/runtime/locations/in-memory-authority-store.d.ts +1 -0
- package/dist/runtime/locations/in-memory-authority-store.js +15 -5
- package/dist/runtime/locations/in-memory-location-store.d.ts +0 -2
- package/dist/runtime/locations/in-memory-location-store.js +1 -38
- package/dist/runtime/locations/lifecycle.d.ts +1 -1
- package/dist/runtime/locations/lifecycle.js +2 -2
- package/dist/runtime/locations/location-store-repository.d.ts +0 -1
- package/dist/runtime/locations/location-store-repository.js +163 -246
- package/dist/runtime/locations/resolvers.d.ts +8 -1
- package/dist/runtime/locations/resolvers.js +16 -2
- package/dist/runtime/locations/runtime.d.ts +3 -3
- package/dist/runtime/locations/runtime.js +12 -16
- package/dist/runtime/messaging/creation-payload-codec.js +8 -7
- package/dist/runtime/messaging/framework-json-v1.d.ts +1 -1
- package/dist/runtime/messaging/framework-json-v1.js +6 -2
- package/dist/runtime/messaging/payload-codec.js +21 -35
- package/dist/runtime/messaging/request-deadline.d.ts +4 -2
- package/dist/runtime/messaging/request-deadline.js +40 -25
- package/dist/runtime/messaging/request-result.d.ts +14 -1
- package/dist/runtime/messaging/request-result.js +74 -13
- package/dist/runtime/protocol/service_wire_codec.generated.d.ts +4 -0
- package/dist/runtime/protocol/service_wire_codec.generated.js +17 -7
- package/dist/runtime/spots/index.d.ts +28 -7
- package/dist/runtime/spots/index.js +31 -6
- package/dist/runtime/spots/spot-activation-registry.d.ts +3 -2
- package/dist/runtime/spots/spot-activation-registry.js +13 -8
- package/dist/runtime/spots/spot-activation-state.d.ts +2 -0
- package/dist/runtime/spots/spot-activation-state.js +1 -0
- package/dist/runtime/spots/spot-actor-admission-coordinator.d.ts +9 -4
- package/dist/runtime/spots/spot-actor-admission-coordinator.js +33 -12
- package/dist/runtime/spots/spot-actor-ingress-admission.d.ts +40 -0
- package/dist/runtime/spots/spot-actor-ingress-admission.js +78 -0
- package/dist/runtime/spots/spot-actor-membership.js +3 -3
- package/dist/runtime/spots/spot-actor-packet-dispatch.d.ts +16 -43
- package/dist/runtime/spots/spot-actor-packet-dispatch.js +56 -113
- package/dist/runtime/spots/spot-actor-packet-drain.d.ts +1 -0
- package/dist/runtime/spots/spot-actor-packet-drain.js +12 -5
- package/dist/runtime/spots/spot-entry-activation.d.ts +4 -3
- package/dist/runtime/spots/spot-entry-activation.js +7 -12
- package/dist/runtime/spots/spot-handler-registry.d.ts +5 -1
- package/dist/runtime/spots/spot-handler-registry.js +31 -15
- package/dist/runtime/spots/spot-manager-public.js +3 -2
- package/dist/runtime/spots/spot-node-runtime-manager.d.ts +11 -6
- package/dist/runtime/spots/spot-node-runtime-manager.js +6 -1
- package/dist/runtime/spots/spot-outbound.d.ts +8 -2
- package/dist/runtime/spots/spot-outbound.js +5 -5
- package/dist/runtime/spots/spot-route-packet-dispatch.js +13 -8
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.d.ts +3 -3
- package/dist/runtime/spots/spot-routed-spot-packet-dispatch.js +9 -5
- package/dist/runtime/spots/spot-runtime-ports.d.ts +2 -2
- package/dist/runtime/spots/spot-serial-executor.d.ts +2 -1
- package/dist/runtime/spots/spot-serial-turn-executor.js +20 -26
- package/dist/runtime/spots/spot-subscription-dispatch.js +5 -2
- package/dist/runtime/spots/spot-timer.d.ts +1 -1
- package/dist/runtime/streams/actor-session-binding-registry.d.ts +11 -3
- package/dist/runtime/streams/actor-session-binding-registry.js +28 -0
- package/dist/runtime/streams/bound-actor-relay-sender.d.ts +2 -2
- package/dist/runtime/streams/bound-actor-relay-sender.js +3 -4
- package/dist/runtime/streams/bound-session-service.js +6 -7
- package/dist/runtime/streams/index.d.ts +3 -3
- package/dist/runtime/streams/index.js +22 -2
- package/dist/runtime/streams/managed-stream.js +2 -1
- package/dist/runtime/streams/session-calls.d.ts +1 -1
- package/dist/runtime/streams/session-calls.js +3 -9
- package/dist/runtime/streams/session-context.d.ts +2 -2
- package/dist/runtime/streams/session-context.js +2 -2
- package/dist/runtime/streams/stream-session-runtime.d.ts +1 -0
- package/dist/runtime/streams/stream-session-runtime.js +64 -33
- package/package.json +3 -3
- package/src/contracts/Actors/ZLinkActor.ts +6 -0
- package/src/contracts/Actors/ZLinkSessionBindingIdentity.ts +7 -0
- package/src/contracts/Actors/index.ts +1 -0
- package/src/contracts/Common/CoreTypes.ts +1 -0
- package/src/contracts/Common/HandlerMessageType.ts +50 -0
- package/src/contracts/Common/ZLinkEncodedPayload.ts +13 -25
- package/src/contracts/Common/ZLinkMessage.ts +11 -7
- package/src/contracts/Common/encoded-payload-storage.ts +4 -16
- package/src/contracts/Common/index.ts +1 -1
- package/src/contracts/Common/payload-slab.ts +29 -0
- package/src/contracts/Configuration/RegistrationBuilders.ts +29 -15
- package/src/contracts/Configuration/RegistrationTypes.ts +19 -0
- package/src/contracts/Handlers/Contexts.ts +1 -0
- package/src/contracts/Locations/Authority.ts +7 -1
- package/src/internal.ts +17 -0
- package/src/nest-integration.ts +1 -0
- package/src/runtime/actors/actor-client.ts +257 -163
- package/src/runtime/actors/actor-context.ts +26 -14
- package/src/runtime/actors/actor-execution-context.ts +2 -2
- package/src/runtime/actors/actor-handoff.ts +86 -51
- package/src/runtime/actors/actor-join-deferred-scope.ts +6 -6
- package/src/runtime/actors/actor-local-native-join.ts +38 -17
- package/src/runtime/actors/actor-mailbox.ts +1 -1
- package/src/runtime/actors/actor-remote-joiner.ts +8 -4
- package/src/runtime/actors/actor-routed-join-transport.ts +13 -5
- package/src/runtime/actors/actor-routed-json-request.ts +3 -0
- package/src/runtime/actors/actor-runtime-contracts.ts +4 -2
- package/src/runtime/actors/actor-runtime-state.ts +1 -1
- package/src/runtime/actors/spot-actor-dispatch.ts +70 -68
- package/src/runtime/admission.ts +42 -15
- package/src/runtime/application-jobs/application-ingress-record-owner.ts +4 -0
- package/src/runtime/backend/contracts/index.ts +77 -10
- package/src/runtime/backend/mesh-completion-table.ts +106 -15
- package/src/runtime/backend/mesh-dispatch-pump.ts +294 -146
- package/src/runtime/backend/node/node-backend-adapter-support.ts +42 -32
- package/src/runtime/backend/node/node-dealer-channel-client-transport.ts +91 -34
- package/src/runtime/backend/node/node-event-loop-poller.ts +14 -5
- package/src/runtime/backend/node/node-mesh-backend-adapter.ts +5 -1
- package/src/runtime/backend/node/node-raw-binding-port.ts +180 -69
- package/src/runtime/backend/node/node-raw-mesh-backend.ts +386 -157
- package/src/runtime/backend/node/node-socket-backend-adapter.ts +56 -11
- package/src/runtime/backend/raw-binding-port.ts +13 -5
- package/src/runtime/channels/channel-clients.ts +26 -11
- package/src/runtime/channels/channel-dispatch-pipeline.ts +77 -65
- package/src/runtime/channels/channel-dispatch-services.ts +7 -12
- package/src/runtime/channels/channel-dispatchers.ts +93 -39
- package/src/runtime/channels/channel-envelope.ts +680 -144
- package/src/runtime/channels/channel-multipart.ts +17 -13
- package/src/runtime/channels/channel-outbound-operations.ts +204 -178
- package/src/runtime/channels/channel-receive-loops.ts +160 -107
- package/src/runtime/channels/channel-runtime-lifecycle.ts +64 -59
- package/src/runtime/channels/channel-runtime-manager.ts +74 -27
- package/src/runtime/channels/channel-socket-registry.ts +20 -5
- package/src/runtime/channels/channel-transports.ts +414 -287
- package/src/runtime/channels/dispatch-error-reporter.ts +4 -9
- package/src/runtime/channels/local-spot-route-transport.ts +27 -29
- package/src/runtime/channels/router-socket-spot-route-transport.ts +63 -32
- package/src/runtime/channels/source-spot-router.ts +75 -38
- package/src/runtime/channels/spot-node-route-transport.ts +67 -37
- package/src/runtime/channels/spot-route-bridge-transport.ts +62 -30
- package/src/runtime/channels/spot-route-dispatch-strategy.ts +105 -34
- package/src/runtime/diagnostics/dispatch-error-details.ts +10 -2
- package/src/runtime/diagnostics/message-flow-bootstrap.ts +6 -0
- package/src/runtime/diagnostics/message-flow-delivery.ts +171 -0
- package/src/runtime/diagnostics/message-flow-record.ts +295 -0
- package/src/runtime/diagnostics/message-flow-worker.ts +146 -0
- package/src/runtime/diagnostics/message-flow.ts +49 -362
- package/src/runtime/diagnostics/runtime-metrics.ts +10 -4
- package/src/runtime/execution/index.ts +6 -0
- package/src/runtime/execution/serial-execution-queue.ts +94 -96
- package/src/runtime/foundation/durable-service-request.ts +212 -89
- package/src/runtime/foundation/operation-registry.ts +287 -38
- package/src/runtime/foundation/raw-service-mesh-runtime.ts +617 -292
- package/src/runtime/foundation/request-runtime.ts +227 -0
- package/src/runtime/foundation/service-discovery-registry.ts +7 -0
- package/src/runtime/foundation/service-liveness-registry.ts +1 -1
- package/src/runtime/foundation/service-mailbox.ts +7 -2
- package/src/runtime/foundation/service-relocation-object-owner.ts +21 -6
- package/src/runtime/foundation/service-runtime-contracts.ts +12 -2
- package/src/runtime/foundation/service-stateful-registry.ts +52 -19
- package/src/runtime/foundation/service-stateful-runtime.ts +365 -198
- package/src/runtime/foundation/service-stateful-wire-codec.ts +18 -0
- package/src/runtime/foundation/service-topology-registry.ts +21 -3
- package/src/runtime/foundation/service-wire-constants.generated.ts +10 -0
- package/src/runtime/foundation/service-wire-m6a-codec.ts +69 -17
- package/src/runtime/host/actor-packet-relay.ts +160 -156
- package/src/runtime/host/actor-placement-coordinator.ts +1 -1
- package/src/runtime/host/actor-runtime-options-factory.ts +7 -2
- package/src/runtime/host/actor-transfer-runtime.ts +3 -3
- package/src/runtime/host/application-job-queue.ts +56 -27
- package/src/runtime/host/bound-session-relay.ts +0 -1
- package/src/runtime/host/channel-runtime-options-factory.ts +3 -0
- package/src/runtime/host/entry-actor-runtime.ts +14 -6
- package/src/runtime/host/index.ts +388 -113
- package/src/runtime/host/location-runtime-owner.ts +3 -3
- package/src/runtime/host/service-relocation-host-runtime.ts +380 -252
- package/src/runtime/host/spot-address-transport.ts +110 -95
- package/src/runtime/host/spot-runtime-options-factory.ts +3 -0
- package/src/runtime/host/user-spot-creation-coordinator.ts +69 -22
- package/src/runtime/internal-observation.ts +2 -0
- package/src/runtime/locations/actor-location-claims.ts +42 -16
- package/src/runtime/locations/auto-connect-loop.ts +24 -16
- package/src/runtime/locations/auto-connect-planner.ts +2 -5
- package/src/runtime/locations/auto-connect-reconciler.ts +37 -24
- package/src/runtime/locations/in-memory-authority-store.ts +27 -7
- package/src/runtime/locations/in-memory-location-store.ts +1 -74
- package/src/runtime/locations/lifecycle.ts +4 -2
- package/src/runtime/locations/location-store-repository.ts +228 -308
- package/src/runtime/locations/resolvers.ts +20 -8
- package/src/runtime/locations/runtime.ts +16 -28
- package/src/runtime/messaging/creation-payload-codec.ts +12 -10
- package/src/runtime/messaging/framework-json-v1.ts +10 -1
- package/src/runtime/messaging/payload-codec.ts +50 -75
- package/src/runtime/messaging/request-deadline.ts +47 -39
- package/src/runtime/messaging/request-result.ts +88 -17
- package/src/runtime/protocol/service_wire_codec.generated.ts +18 -8
- package/src/runtime/protocol/service_wire_pilot_codec.generated.ts +1 -1
- package/src/runtime/spots/index.ts +57 -10
- package/src/runtime/spots/spot-activation-registry.ts +12 -8
- package/src/runtime/spots/spot-activation-state.ts +2 -0
- package/src/runtime/spots/spot-actor-admission-coordinator.ts +62 -37
- package/src/runtime/spots/spot-actor-ingress-admission.ts +157 -0
- package/src/runtime/spots/spot-actor-membership.ts +8 -5
- package/src/runtime/spots/spot-actor-packet-dispatch.ts +122 -206
- package/src/runtime/spots/spot-actor-packet-drain.ts +21 -6
- package/src/runtime/spots/spot-entry-activation.ts +25 -35
- package/src/runtime/spots/spot-handler-registry.ts +72 -15
- package/src/runtime/spots/spot-manager-public.ts +4 -2
- package/src/runtime/spots/spot-node-runtime-manager.ts +16 -7
- package/src/runtime/spots/spot-outbound.ts +26 -10
- package/src/runtime/spots/spot-route-packet-dispatch.ts +18 -8
- package/src/runtime/spots/spot-routed-spot-packet-dispatch.ts +14 -8
- package/src/runtime/spots/spot-runtime-ports.ts +5 -2
- package/src/runtime/spots/spot-serial-executor.ts +1 -1
- package/src/runtime/spots/spot-serial-turn-executor.ts +25 -40
- package/src/runtime/spots/spot-subscription-dispatch.ts +9 -2
- package/src/runtime/spots/spot-timer.ts +1 -1
- package/src/runtime/streams/actor-session-binding-registry.ts +46 -3
- package/src/runtime/streams/bound-actor-relay-sender.ts +16 -5
- package/src/runtime/streams/bound-session-service.ts +10 -7
- package/src/runtime/streams/index.ts +30 -4
- package/src/runtime/streams/managed-stream.ts +2 -1
- package/src/runtime/streams/session-calls.ts +9 -14
- package/src/runtime/streams/session-context.ts +6 -11
- package/src/runtime/streams/stream-session-runtime.ts +79 -40
- package/dist/runtime/spots/spot-lifecycle-metrics.d.ts +0 -8
- package/dist/runtime/spots/spot-lifecycle-metrics.js +0 -17
- package/src/runtime/spots/spot-lifecycle-metrics.ts +0 -16
|
@@ -1,27 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZLinkMessageFlowTracer = exports.
|
|
3
|
+
exports.ZLinkMessageFlowTracer = exports.DEFAULT_ZLINK_DIAGNOSTICS = void 0;
|
|
4
4
|
exports.effectiveMessageFlow = effectiveMessageFlow;
|
|
5
5
|
exports.messageFlowTracingEnabled = messageFlowTracingEnabled;
|
|
6
6
|
exports.createMessageFlowModeCell = createMessageFlowModeCell;
|
|
7
7
|
exports.createDiagnosticsContext = createDiagnosticsContext;
|
|
8
8
|
exports.flowIfEnabled = flowIfEnabled;
|
|
9
9
|
exports.traceSessionBindingControlDrop = traceSessionBindingControlDrop;
|
|
10
|
-
const api_1 = require("@opentelemetry/api");
|
|
11
|
-
const api_logs_1 = require("@opentelemetry/api-logs");
|
|
12
|
-
const contracts_1 = require("../../contracts");
|
|
13
10
|
const ZLinkDispatchOptions_1 = require("../../contracts/Dispatch/ZLinkDispatchOptions");
|
|
14
11
|
const dispatch_error_details_1 = require("./dispatch-error-details");
|
|
15
12
|
const flow_context_1 = require("./flow-context");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
13
|
+
const message_flow_record_1 = require("./message-flow-record");
|
|
14
|
+
const message_flow_delivery_1 = require("./message-flow-delivery");
|
|
18
15
|
exports.DEFAULT_ZLINK_DIAGNOSTICS = {
|
|
19
16
|
messageFlow: 'errors',
|
|
20
17
|
sampleRate: 1,
|
|
21
18
|
includeMessageSizes: false
|
|
22
19
|
};
|
|
23
|
-
exports.telemetryLogger = api_logs_1.logs.getLogger('@zlink-systems/framework');
|
|
24
|
-
const telemetryTracer = api_1.trace.getTracer('@zlink-systems/framework');
|
|
25
20
|
let diagnosticsGeneration = 0n;
|
|
26
21
|
function effectiveMessageFlow(ctx) {
|
|
27
22
|
return ctx.liveMode.mode;
|
|
@@ -32,16 +27,17 @@ function effectiveMessageFlow(ctx) {
|
|
|
32
27
|
* is the one decision every flow processing point reads.
|
|
33
28
|
*/
|
|
34
29
|
function messageFlowTracingEnabled(mode) {
|
|
35
|
-
return
|
|
30
|
+
return ZLinkDispatchOptions_1.MESSAGE_FLOW_MODE_RANK[mode] >= ZLinkDispatchOptions_1.MESSAGE_FLOW_MODE_RANK.normal;
|
|
36
31
|
}
|
|
37
32
|
function createMessageFlowModeCell(dispatch) {
|
|
38
33
|
return { mode: dispatch?.diagnostics?.messageFlow ?? 'errors' };
|
|
39
34
|
}
|
|
40
|
-
function createDiagnosticsContext(dispatch, _providerResolver, liveMode) {
|
|
35
|
+
function createDiagnosticsContext(dispatch, _providerResolver, liveMode, telemetryLease = (0, message_flow_delivery_1.openTelemetryLease)()) {
|
|
41
36
|
return {
|
|
42
37
|
diagnostics: dispatch?.diagnostics ?? exports.DEFAULT_ZLINK_DIAGNOSTICS,
|
|
43
38
|
liveMode,
|
|
44
|
-
sourceMeshGeneration: ++diagnosticsGeneration
|
|
39
|
+
sourceMeshGeneration: ++diagnosticsGeneration,
|
|
40
|
+
telemetryLease
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
43
|
function requiredMode(outcome, result) {
|
|
@@ -80,30 +76,34 @@ function traceSessionBindingControlDrop(flow, sourceRid, actorId, packetName, er
|
|
|
80
76
|
}
|
|
81
77
|
class ZLinkMessageFlowTracer {
|
|
82
78
|
ctx;
|
|
83
|
-
errorSink;
|
|
84
79
|
tracedEvents = 0;
|
|
85
|
-
|
|
80
|
+
telemetryLease;
|
|
86
81
|
localSamplingSequence = 0n;
|
|
87
82
|
errorsTracePoint;
|
|
88
83
|
normalTracePoint;
|
|
89
84
|
detailedTracePoint;
|
|
90
|
-
constructor(ctx
|
|
85
|
+
constructor(ctx) {
|
|
91
86
|
this.ctx = ctx;
|
|
92
|
-
this.
|
|
87
|
+
this.telemetryLease = ctx.telemetryLease ?? (0, message_flow_delivery_1.openTelemetryLease)();
|
|
93
88
|
}
|
|
94
89
|
enabled(outcome) {
|
|
95
90
|
const mode = effectiveMessageFlow(this.ctx);
|
|
96
|
-
return
|
|
91
|
+
return (ZLinkDispatchOptions_1.MESSAGE_FLOW_MODE_RANK[mode] >= ZLinkDispatchOptions_1.MESSAGE_FLOW_MODE_RANK[requiredMode(outcome)] &&
|
|
92
|
+
(0, message_flow_delivery_1.messageFlowDelivery)().accepts(this.telemetryLease));
|
|
97
93
|
}
|
|
98
94
|
accepts(outcome) {
|
|
99
95
|
return this.enabled(outcome);
|
|
100
96
|
}
|
|
101
97
|
begin(outcome, result, flowId, sourceMeshGeneration) {
|
|
102
98
|
const mode = effectiveMessageFlow(this.ctx);
|
|
103
|
-
if (
|
|
99
|
+
if (ZLinkDispatchOptions_1.MESSAGE_FLOW_MODE_RANK[mode] < ZLinkDispatchOptions_1.MESSAGE_FLOW_MODE_RANK[requiredMode(outcome, result)]) {
|
|
104
100
|
return undefined;
|
|
105
101
|
}
|
|
106
|
-
|
|
102
|
+
if (!(0, message_flow_delivery_1.messageFlowDelivery)().accepts(this.telemetryLease))
|
|
103
|
+
return undefined;
|
|
104
|
+
const samplingFlowId = messageFlowTracingEnabled(mode)
|
|
105
|
+
? (flowId ?? (0, flow_context_1.currentFlowContext)()?.flowId)
|
|
106
|
+
: undefined;
|
|
107
107
|
if (!this.acceptsSample(outcome, result, samplingFlowId, sourceMeshGeneration)) {
|
|
108
108
|
return undefined;
|
|
109
109
|
}
|
|
@@ -129,27 +129,41 @@ class ZLinkMessageFlowTracer {
|
|
|
129
129
|
}
|
|
130
130
|
trace(flowInput) {
|
|
131
131
|
const effectiveMode = effectiveMessageFlow(this.ctx);
|
|
132
|
-
if (
|
|
133
|
-
|
|
132
|
+
if (ZLinkDispatchOptions_1.MESSAGE_FLOW_MODE_RANK[effectiveMode] <
|
|
133
|
+
ZLinkDispatchOptions_1.MESSAGE_FLOW_MODE_RANK[requiredMode(flowInput.outcome, flowInput.result)])
|
|
134
|
+
return;
|
|
135
|
+
if (!(0, message_flow_delivery_1.messageFlowDelivery)().accepts(this.telemetryLease))
|
|
134
136
|
return;
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
+
const tracingEnabled = messageFlowTracingEnabled(effectiveMode);
|
|
138
|
+
const ambient = tracingEnabled ? (0, flow_context_1.currentFlowContext)() : undefined;
|
|
139
|
+
const flowId = tracingEnabled ? (flowInput.flowId ?? ambient?.flowId) : undefined;
|
|
137
140
|
if (!this.acceptsSample(flowInput.outcome, flowInput.result, flowId, flowInput.sourceMeshGeneration))
|
|
138
141
|
return;
|
|
139
142
|
this.traceAcceptedAtMode(flowInput, effectiveMode, flowId, ambient?.flowOrigin);
|
|
140
143
|
}
|
|
141
144
|
traceAcceptedAtMode(flowInput, effectiveMode, acceptedFlowId, acceptedFlowOrigin) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
+
if (!(0, message_flow_delivery_1.messageFlowDelivery)().accepts(this.telemetryLease))
|
|
146
|
+
return;
|
|
147
|
+
const tracingEnabled = messageFlowTracingEnabled(effectiveMode);
|
|
148
|
+
const ambient = tracingEnabled ? (0, flow_context_1.currentFlowContext)() : undefined;
|
|
149
|
+
const flowId = tracingEnabled
|
|
150
|
+
? (flowInput.flowId ?? acceptedFlowId ?? ambient?.flowId)
|
|
151
|
+
: undefined;
|
|
152
|
+
const flowOrigin = tracingEnabled
|
|
153
|
+
? (flowInput.flowOrigin ?? acceptedFlowOrigin ?? ambient?.flowOrigin)
|
|
154
|
+
: undefined;
|
|
145
155
|
const flow = {
|
|
146
156
|
...flowInput,
|
|
147
|
-
...(
|
|
157
|
+
...(tracingEnabled
|
|
158
|
+
? flowId === undefined
|
|
159
|
+
? {}
|
|
160
|
+
: { flowId, flowOrigin }
|
|
161
|
+
: { flowId: undefined, flowOrigin: undefined }),
|
|
148
162
|
streamSessionId: flowInput.streamSessionId ?? ambient?.streamSessionId,
|
|
149
163
|
effectiveMode
|
|
150
164
|
};
|
|
151
165
|
this.tracedEvents += 1;
|
|
152
|
-
this.
|
|
166
|
+
(0, message_flow_delivery_1.messageFlowDelivery)().submit(this.telemetryLease, (0, message_flow_record_1.toTelemetryRecord)(flow, effectiveMode === 'detailed' && this.ctx.diagnostics.includeMessageSizes
|
|
153
167
|
? flow.messageSize
|
|
154
168
|
: undefined,
|
|
155
169
|
// Spec 26 §4: terminal elapsed time is a Detailed-level addition; the
|
|
@@ -167,7 +181,7 @@ class ZLinkMessageFlowTracer {
|
|
|
167
181
|
return this.tracedEvents;
|
|
168
182
|
}
|
|
169
183
|
get providerFailureCount() {
|
|
170
|
-
return
|
|
184
|
+
return (0, message_flow_delivery_1.telemetryProviderFailureCount)();
|
|
171
185
|
}
|
|
172
186
|
sample(flowId, sourceMeshGeneration) {
|
|
173
187
|
const rate = this.ctx.diagnostics.sampleRate;
|
|
@@ -183,264 +197,8 @@ class ZLinkMessageFlowTracer {
|
|
|
183
197
|
this.localSamplingSequence += 1n;
|
|
184
198
|
return this.localSamplingSequence;
|
|
185
199
|
}
|
|
186
|
-
publish(record) {
|
|
187
|
-
this.publishToLogger(record);
|
|
188
|
-
this.publishToTrace(record);
|
|
189
|
-
}
|
|
190
|
-
publishToLogger(record) {
|
|
191
|
-
try {
|
|
192
|
-
const severity = record.severity === 'warning'
|
|
193
|
-
? 'WARN'
|
|
194
|
-
: record.eventId === DISPATCH_ERROR_EVENT_ID
|
|
195
|
-
? 'ERROR'
|
|
196
|
-
: 'INFO';
|
|
197
|
-
exports.telemetryLogger.emit({
|
|
198
|
-
eventName: record.eventId,
|
|
199
|
-
timestamp: record.timestamp,
|
|
200
|
-
severityNumber: api_logs_1.SeverityNumber[severity],
|
|
201
|
-
severityText: severity,
|
|
202
|
-
body: structuredLogBody(record),
|
|
203
|
-
attributes: structuredLogAttributes(record)
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
catch (error) {
|
|
207
|
-
this.reportProviderFailure('logger-provider', error);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
publishToTrace(record) {
|
|
211
|
-
try {
|
|
212
|
-
const span = telemetryTracer.startSpan(record.eventId, {
|
|
213
|
-
attributes: traceAttributes(record)
|
|
214
|
-
});
|
|
215
|
-
if (record.eventId === DISPATCH_ERROR_EVENT_ID) {
|
|
216
|
-
span.setStatus({ code: api_1.SpanStatusCode.ERROR, message: record.reason });
|
|
217
|
-
}
|
|
218
|
-
span.end();
|
|
219
|
-
}
|
|
220
|
-
catch (error) {
|
|
221
|
-
this.reportProviderFailure('trace-provider', error);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
reportProviderFailure(source, error) {
|
|
225
|
-
this.providerFailures += 1;
|
|
226
|
-
try {
|
|
227
|
-
this.errorSink.reportRuntimeTaskException(source, error);
|
|
228
|
-
}
|
|
229
|
-
catch {
|
|
230
|
-
// The fallback diagnostics path is isolated for the same reason.
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
200
|
}
|
|
234
201
|
exports.ZLinkMessageFlowTracer = ZLinkMessageFlowTracer;
|
|
235
|
-
function toTelemetryRecord(flow, messageSizeBytes, durationSeconds) {
|
|
236
|
-
return {
|
|
237
|
-
severity: flow.severity,
|
|
238
|
-
eventId: flow.outcome === ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Error
|
|
239
|
-
? DISPATCH_ERROR_EVENT_ID
|
|
240
|
-
: MESSAGE_FLOW_EVENT_ID,
|
|
241
|
-
timestamp: new Date(),
|
|
242
|
-
phase: messageFlowPhase(flow.outcome),
|
|
243
|
-
outcome: flow.result ?? messageFlowOutcome(flow.outcome),
|
|
244
|
-
surface: messageFlowSurface(flow.surface),
|
|
245
|
-
messageKind: messageFlowKind(flow.messageKind),
|
|
246
|
-
reason: flow.errorReason,
|
|
247
|
-
action: flow.errorAction,
|
|
248
|
-
packetName: flow.packetName,
|
|
249
|
-
channelName: flow.channelName,
|
|
250
|
-
channelRouteKind: flow.channelRouteKind ?? channelRouteKind(flow.surface),
|
|
251
|
-
meshName: flow.meshName,
|
|
252
|
-
topic: flow.topic,
|
|
253
|
-
correlationId: flow.correlationId,
|
|
254
|
-
sourceRid: flow.sourceRid,
|
|
255
|
-
targetRid: flow.targetRid,
|
|
256
|
-
serverRid: flow.serverRid,
|
|
257
|
-
flowId: flow.flowId,
|
|
258
|
-
flowOrigin: flow.flowOrigin === undefined ? undefined : flow_context_1.FLOW_ORIGIN_VALUES[flow.flowOrigin],
|
|
259
|
-
spotId: flow.spotId,
|
|
260
|
-
instanceSpotType: flow.instanceSpotType,
|
|
261
|
-
activationState: flow.activationState,
|
|
262
|
-
actorId: flow.actorId,
|
|
263
|
-
streamSessionId: flow.streamSessionId,
|
|
264
|
-
commandId: flow.commandId,
|
|
265
|
-
messageSizeBytes,
|
|
266
|
-
durationSeconds,
|
|
267
|
-
errorType: flow.errorType,
|
|
268
|
-
errorMessage: flow.errorMessage,
|
|
269
|
-
errorCauseType: flow.errorCauseType,
|
|
270
|
-
errorCauseMessage: boundedText(flow.errorCauseMessage)
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
function traceAttributes(record) {
|
|
274
|
-
const attributes = {};
|
|
275
|
-
for (const [name, value] of Object.entries(record)) {
|
|
276
|
-
if (value === undefined || name === 'timestamp' || name === 'severity')
|
|
277
|
-
continue;
|
|
278
|
-
attributes[toSnakeCase(name)] = value instanceof Date ? value.toISOString() : value;
|
|
279
|
-
}
|
|
280
|
-
return attributes;
|
|
281
|
-
}
|
|
282
|
-
function structuredLogAttributes(record) {
|
|
283
|
-
// 기록의 attribute 이름은 Message flow tracing 3.2가 고정한다. 로그 본문의
|
|
284
|
-
// `zlink flow:` 축약 key(`kind`, `mesh` …)와 다른 집합이다 —
|
|
285
|
-
// structuredLogBodyAttributes를 참고.
|
|
286
|
-
return compactAttributes({
|
|
287
|
-
event_id: record.eventId,
|
|
288
|
-
timestamp: record.timestamp.toISOString(),
|
|
289
|
-
phase: record.phase,
|
|
290
|
-
surface: record.surface,
|
|
291
|
-
message_kind: record.messageKind,
|
|
292
|
-
mesh_name: record.meshName,
|
|
293
|
-
channel_name: record.channelName,
|
|
294
|
-
channel_route_kind: record.channelRouteKind,
|
|
295
|
-
source_rid: record.sourceRid,
|
|
296
|
-
target_rid: record.targetRid,
|
|
297
|
-
server_rid: record.serverRid,
|
|
298
|
-
packet_name: record.packetName,
|
|
299
|
-
topic: record.topic,
|
|
300
|
-
spot_id: record.spotId,
|
|
301
|
-
instance_spot_type: record.instanceSpotType,
|
|
302
|
-
activation_state: record.activationState,
|
|
303
|
-
actor_id: record.actorId,
|
|
304
|
-
stream_session_id: record.streamSessionId,
|
|
305
|
-
correlation_id: record.correlationId,
|
|
306
|
-
flow_id: record.flowId,
|
|
307
|
-
flow_origin: record.flowOrigin,
|
|
308
|
-
outcome: record.outcome,
|
|
309
|
-
reason: record.reason,
|
|
310
|
-
action: record.action,
|
|
311
|
-
command_id: record.commandId,
|
|
312
|
-
error_type: record.errorType,
|
|
313
|
-
error_message: record.errorMessage,
|
|
314
|
-
error_cause_type: record.errorCauseType,
|
|
315
|
-
error_cause_message: record.errorCauseMessage,
|
|
316
|
-
message_size_bytes: record.messageSizeBytes,
|
|
317
|
-
duration_seconds: record.durationSeconds
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
function structuredLogBodyAttributes(record) {
|
|
321
|
-
// `zlink flow:` 본문 전용 축약 key — Message flow tracing "Structured log 대체 표기".
|
|
322
|
-
return compactAttributes({
|
|
323
|
-
event: record.eventId,
|
|
324
|
-
phase: record.phase,
|
|
325
|
-
surface: record.surface,
|
|
326
|
-
kind: record.messageKind,
|
|
327
|
-
mesh: record.meshName,
|
|
328
|
-
channel: record.channelName,
|
|
329
|
-
channel_route: record.channelRouteKind,
|
|
330
|
-
source_rid: record.sourceRid,
|
|
331
|
-
target_rid: record.targetRid,
|
|
332
|
-
server_rid: record.serverRid,
|
|
333
|
-
packet: record.packetName,
|
|
334
|
-
topic: record.topic,
|
|
335
|
-
spot: record.spotId,
|
|
336
|
-
instance_type: record.instanceSpotType,
|
|
337
|
-
activation_state: record.activationState,
|
|
338
|
-
actor: record.actorId,
|
|
339
|
-
session: record.streamSessionId,
|
|
340
|
-
corr: record.correlationId,
|
|
341
|
-
flow: record.flowId,
|
|
342
|
-
origin: record.flowOrigin,
|
|
343
|
-
outcome: record.outcome,
|
|
344
|
-
reason: record.reason,
|
|
345
|
-
action: record.action,
|
|
346
|
-
error_type: record.errorType,
|
|
347
|
-
error_message: record.errorMessage,
|
|
348
|
-
size: record.messageSizeBytes
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
function structuredLogBody(record) {
|
|
352
|
-
return `zlink flow: ${Object.entries(structuredLogBodyAttributes(record))
|
|
353
|
-
.map(([key, value]) => `${key}=${String(value)}`)
|
|
354
|
-
.join(' ')}`;
|
|
355
|
-
}
|
|
356
|
-
function compactAttributes(values) {
|
|
357
|
-
const attributes = {};
|
|
358
|
-
for (const [key, value] of Object.entries(values)) {
|
|
359
|
-
if (value !== undefined)
|
|
360
|
-
attributes[key] = value;
|
|
361
|
-
}
|
|
362
|
-
return attributes;
|
|
363
|
-
}
|
|
364
|
-
function messageFlowPhase(outcome) {
|
|
365
|
-
switch (outcome) {
|
|
366
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Received:
|
|
367
|
-
return 'received';
|
|
368
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Admitted:
|
|
369
|
-
return 'admitted';
|
|
370
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Dispatched:
|
|
371
|
-
return 'dispatched';
|
|
372
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Completed:
|
|
373
|
-
return 'completed';
|
|
374
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Replied:
|
|
375
|
-
return 'replied';
|
|
376
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Dropped:
|
|
377
|
-
return 'dropped';
|
|
378
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Sent:
|
|
379
|
-
return 'sent';
|
|
380
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.ReplyReceived:
|
|
381
|
-
return 'reply_received';
|
|
382
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Backpressured:
|
|
383
|
-
return 'backpressured';
|
|
384
|
-
case ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Error:
|
|
385
|
-
return undefined;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
function messageFlowOutcome(outcome) {
|
|
389
|
-
if (outcome === ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Error)
|
|
390
|
-
return 'failed';
|
|
391
|
-
if (outcome === ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Backpressured)
|
|
392
|
-
return 'backpressured';
|
|
393
|
-
if (outcome === ZLinkDispatchOptions_1.ZLinkRuntimeMessageFlowOutcome.Dropped)
|
|
394
|
-
return 'dropped';
|
|
395
|
-
return 'succeeded';
|
|
396
|
-
}
|
|
397
|
-
function messageFlowSurface(surface) {
|
|
398
|
-
switch (surface) {
|
|
399
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.Node:
|
|
400
|
-
return 'node';
|
|
401
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.Channel:
|
|
402
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.RouteMeshChannel:
|
|
403
|
-
return 'channel';
|
|
404
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.SpotRoute:
|
|
405
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.SpotSubscription:
|
|
406
|
-
return 'spot';
|
|
407
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.InstanceSpot:
|
|
408
|
-
return 'instance_spot';
|
|
409
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.SpotActor:
|
|
410
|
-
return 'actor';
|
|
411
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.StreamSession:
|
|
412
|
-
return 'stream';
|
|
413
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.ActorRelocation:
|
|
414
|
-
return 'actor_relocation';
|
|
415
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.ClassicFanout:
|
|
416
|
-
return 'classic_fanout';
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
function messageFlowKind(kind) {
|
|
420
|
-
switch (kind) {
|
|
421
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Request:
|
|
422
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorRequest:
|
|
423
|
-
return 'request';
|
|
424
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Send:
|
|
425
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.ActorSend:
|
|
426
|
-
return 'send';
|
|
427
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Response:
|
|
428
|
-
return 'response';
|
|
429
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Error:
|
|
430
|
-
return 'error';
|
|
431
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Control:
|
|
432
|
-
return 'control';
|
|
433
|
-
case ZLinkDispatchOptions_1.ZLinkDispatchMessageKind.Publish:
|
|
434
|
-
throw new Error('Classic fanout publish must not create a normal message-flow record.');
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
function channelRouteKind(surface) {
|
|
438
|
-
if (surface === ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.RouteMeshChannel)
|
|
439
|
-
return 'route_mesh';
|
|
440
|
-
if (surface === ZLinkDispatchOptions_1.ZLinkDispatchErrorSurface.Channel)
|
|
441
|
-
return 'client_server';
|
|
442
|
-
return undefined;
|
|
443
|
-
}
|
|
444
202
|
function hashFlowId(flowId) {
|
|
445
203
|
let hash = 0x811c9dc5;
|
|
446
204
|
for (let index = 0; index < flowId.length; index += 1) {
|
|
@@ -449,9 +207,3 @@ function hashFlowId(flowId) {
|
|
|
449
207
|
}
|
|
450
208
|
return hash >>> 0;
|
|
451
209
|
}
|
|
452
|
-
function boundedText(value) {
|
|
453
|
-
return value === undefined ? undefined : value.slice(0, dispatch_error_details_1.ERROR_MESSAGE_MAX_LENGTH);
|
|
454
|
-
}
|
|
455
|
-
function toSnakeCase(value) {
|
|
456
|
-
return value.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
457
|
-
}
|
|
@@ -111,7 +111,7 @@ export declare const METRIC_NAMES: Readonly<{
|
|
|
111
111
|
readonly HostApplicationJobQueuePressureTransitions: "zlink.host.application_job_queue.pressure_transitions";
|
|
112
112
|
readonly HostApplicationJobQueueFlowStateConfigFailures: "zlink.host.application_job_queue.flow_state_config_failures";
|
|
113
113
|
}>;
|
|
114
|
-
declare const
|
|
114
|
+
export declare const COUNTER_UNITS: Readonly<{
|
|
115
115
|
readonly "zlink.stream.connections.opened": "{connection}";
|
|
116
116
|
readonly "zlink.stream.connections.closed": "{connection}";
|
|
117
117
|
readonly "zlink.mesh_node.channel.selection_failures": "{failure}";
|
|
@@ -147,7 +147,7 @@ declare const HISTOGRAMS: Readonly<{
|
|
|
147
147
|
readonly "zlink.host.relocation.duration": "s";
|
|
148
148
|
readonly "zlink.host.shutdown.duration": "s";
|
|
149
149
|
}>;
|
|
150
|
-
type CounterName = keyof typeof
|
|
150
|
+
type CounterName = keyof typeof COUNTER_UNITS;
|
|
151
151
|
type UpDownName = keyof typeof UP_DOWN_COUNTERS;
|
|
152
152
|
type HistogramName = keyof typeof HISTOGRAMS;
|
|
153
153
|
export declare class ZLinkRuntimeMetrics {
|
|
@@ -155,6 +155,7 @@ export declare class ZLinkRuntimeMetrics {
|
|
|
155
155
|
constructor(provider?: ZLinkMeterProvider);
|
|
156
156
|
count(name: CounterName | string, value?: number, attributes?: ZLinkMetricAttributes): void;
|
|
157
157
|
change(name: UpDownName | string, value: number, attributes?: ZLinkMetricAttributes): void;
|
|
158
|
+
recordSpotCount(meshName: string, kind: 'entry' | 'user' | 'instance', delta: number): void;
|
|
158
159
|
duration(name: HistogramName | string, seconds: number, attributes?: ZLinkMetricAttributes): void;
|
|
159
160
|
histogram(name: HistogramName | string, value: number, _unit: string, attributes?: ZLinkMetricAttributes): void;
|
|
160
161
|
registerMeshSnapshots(provider: () => ReadonlyArray<ZLinkRuntimeMetricMeshSnapshot>): ZLinkRuntimeMetricRegistration;
|
|
@@ -168,7 +169,7 @@ export declare class ZLinkRuntimeMetrics {
|
|
|
168
169
|
recordChannelSelectionFailure(meshName: string, channelName: string, reason: string): void;
|
|
169
170
|
recordMessageDropped(meshName: string, surface: string, messageKind: string, reason: string): void;
|
|
170
171
|
startInstanceSpotActivation(meshName: string, instanceSpotType: string): ZLinkRuntimeMetricOperation;
|
|
171
|
-
startRelocation(meshName: string, objectKind: 'actor' | 'user_spot' | 'instance_spot', policy: 'recreate' | 'snapshot'): ZLinkRelocationMetricOperation;
|
|
172
|
+
startRelocation(meshName: string, objectKind: 'actor' | 'user_spot' | 'instance_spot', policy: 'recreate' | 'snapshot', onComplete?: (outcome: string) => void): ZLinkRelocationMetricOperation;
|
|
172
173
|
recordInstanceSpotClaimConflict(meshName: string, instanceSpotType: string, reason: string): void;
|
|
173
174
|
recordInstanceSpotTakeover(meshName: string, instanceSpotType: string, outcome: string): void;
|
|
174
175
|
enabled(): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZLinkRequestMetricOperation = exports.ZLinkRuntimeMetrics = exports.METRIC_NAMES = exports.NANOSECONDS_PER_SECOND = exports.MILLISECONDS_PER_SECOND = void 0;
|
|
3
|
+
exports.ZLinkRequestMetricOperation = exports.ZLinkRuntimeMetrics = exports.COUNTER_UNITS = exports.METRIC_NAMES = exports.NANOSECONDS_PER_SECOND = exports.MILLISECONDS_PER_SECOND = void 0;
|
|
4
4
|
const api_1 = require("@opentelemetry/api");
|
|
5
5
|
const contracts_1 = require("../../contracts");
|
|
6
6
|
exports.MILLISECONDS_PER_SECOND = 1000;
|
|
@@ -66,7 +66,7 @@ exports.METRIC_NAMES = Object.freeze({
|
|
|
66
66
|
HostApplicationJobQueuePressureTransitions: 'zlink.host.application_job_queue.pressure_transitions',
|
|
67
67
|
HostApplicationJobQueueFlowStateConfigFailures: 'zlink.host.application_job_queue.flow_state_config_failures'
|
|
68
68
|
});
|
|
69
|
-
|
|
69
|
+
exports.COUNTER_UNITS = Object.freeze({
|
|
70
70
|
[exports.METRIC_NAMES.StreamConnectionsOpened]: '{connection}',
|
|
71
71
|
[exports.METRIC_NAMES.StreamConnectionsClosed]: '{connection}',
|
|
72
72
|
[exports.METRIC_NAMES.MeshNodeChannelSelectionFailures]: '{failure}',
|
|
@@ -144,7 +144,7 @@ class MetricRegistry {
|
|
|
144
144
|
hostCapacities = new Set();
|
|
145
145
|
applicationJobQueuePressures = new Set();
|
|
146
146
|
constructor(meter) {
|
|
147
|
-
for (const [name, unit] of Object.entries(
|
|
147
|
+
for (const [name, unit] of Object.entries(exports.COUNTER_UNITS)) {
|
|
148
148
|
this.counters.set(name, meter.createCounter(name, { unit }));
|
|
149
149
|
}
|
|
150
150
|
for (const [name, unit] of Object.entries(UP_DOWN_COUNTERS)) {
|
|
@@ -350,6 +350,9 @@ class ZLinkRuntimeMetrics {
|
|
|
350
350
|
change(name, value, attributes) {
|
|
351
351
|
safe(() => this.registry.upDown.get(name)?.add(value, attributes));
|
|
352
352
|
}
|
|
353
|
+
recordSpotCount(meshName, kind, delta) {
|
|
354
|
+
this.change(exports.METRIC_NAMES.SpotCount, delta, { mesh_name: meshName, spot_kind: kind });
|
|
355
|
+
}
|
|
353
356
|
duration(name, seconds, attributes) {
|
|
354
357
|
this.histogram(name, Math.max(0, seconds), 's', attributes);
|
|
355
358
|
}
|
|
@@ -423,7 +426,7 @@ class ZLinkRuntimeMetrics {
|
|
|
423
426
|
}
|
|
424
427
|
};
|
|
425
428
|
}
|
|
426
|
-
startRelocation(meshName, objectKind, policy) {
|
|
429
|
+
startRelocation(meshName, objectKind, policy, onComplete) {
|
|
427
430
|
const started = process.hrtime.bigint();
|
|
428
431
|
const startAttributes = { mesh_name: meshName, object_kind: objectKind, policy };
|
|
429
432
|
let completed = false;
|
|
@@ -441,6 +444,7 @@ class ZLinkRuntimeMetrics {
|
|
|
441
444
|
const terminal = { ...startAttributes, outcome };
|
|
442
445
|
this.count(exports.METRIC_NAMES.RelocationCompleted, 1, terminal);
|
|
443
446
|
this.duration(exports.METRIC_NAMES.RelocationDuration, Number(process.hrtime.bigint() - started) / exports.NANOSECONDS_PER_SECOND, terminal);
|
|
447
|
+
onComplete?.(outcome);
|
|
444
448
|
}
|
|
445
449
|
};
|
|
446
450
|
}
|
|
@@ -10,6 +10,7 @@ interface ZLinkSpotSerialTurnExecutorLike {
|
|
|
10
10
|
post<T>(operation: () => Promise<T> | T): Promise<T>;
|
|
11
11
|
}
|
|
12
12
|
export type ZLinkExecutionArea = 'application' | 'infrastructure';
|
|
13
|
+
export declare const detachedMeshDispatchScope: <R, TArgs extends any[]>(fn: (...args: TArgs) => R, ...args: TArgs) => R;
|
|
13
14
|
export declare function runZLinkExecutionArea<T>(area: ZLinkExecutionArea, operation: () => T): T;
|
|
14
15
|
export declare function currentZLinkExecutionArea(): ZLinkExecutionArea | undefined;
|
|
15
16
|
export declare function requireZLinkInfrastructureExecutionArea(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ZLinkFrameworkExecutionState = exports.ZLinkRuntimeTaskRunner = exports.ZLinkRuntimeTaskErrorSink = exports.ZLinkExecutionBarrier = exports.ZLinkSpotSerialTurn = exports.ZLinkStateLane = void 0;
|
|
3
|
+
exports.ZLinkFrameworkExecutionState = exports.ZLinkRuntimeTaskRunner = exports.ZLinkRuntimeTaskErrorSink = exports.ZLinkExecutionBarrier = exports.ZLinkSpotSerialTurn = exports.detachedMeshDispatchScope = exports.ZLinkStateLane = void 0;
|
|
4
4
|
exports.runZLinkExecutionArea = runZLinkExecutionArea;
|
|
5
5
|
exports.currentZLinkExecutionArea = currentZLinkExecutionArea;
|
|
6
6
|
exports.requireZLinkInfrastructureExecutionArea = requireZLinkInfrastructureExecutionArea;
|
|
@@ -11,12 +11,15 @@ exports.requireZLinkYieldTurn = requireZLinkYieldTurn;
|
|
|
11
11
|
exports.captureZLinkExecutionTurn = captureZLinkExecutionTurn;
|
|
12
12
|
exports.isCurrentZLinkSpotSerialTurn = isCurrentZLinkSpotSerialTurn;
|
|
13
13
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
14
|
+
const state_lane_1 = require("./state-lane");
|
|
14
15
|
const abort_1 = require("../abort");
|
|
15
16
|
const framework_errors_internal_1 = require("../framework-errors-internal");
|
|
16
|
-
var
|
|
17
|
-
Object.defineProperty(exports, "ZLinkStateLane", { enumerable: true, get: function () { return
|
|
17
|
+
var state_lane_2 = require("./state-lane");
|
|
18
|
+
Object.defineProperty(exports, "ZLinkStateLane", { enumerable: true, get: function () { return state_lane_2.ZLinkStateLane; } });
|
|
18
19
|
const spotSerialTurnStorage = new node_async_hooks_1.AsyncLocalStorage();
|
|
19
20
|
const executionAreaStorage = new node_async_hooks_1.AsyncLocalStorage();
|
|
21
|
+
// Capture once through the execution owners, independently of module load scope.
|
|
22
|
+
exports.detachedMeshDispatchScope = (0, state_lane_1.startOutsideStateLane)(() => executionAreaStorage.exit(() => spotSerialTurnStorage.exit(() => node_async_hooks_1.AsyncLocalStorage.snapshot())));
|
|
20
23
|
function runZLinkExecutionArea(area, operation) {
|
|
21
24
|
return executionAreaStorage.run(area, operation);
|
|
22
25
|
}
|
|
@@ -33,16 +33,28 @@ export interface ZLinkSerialWorkPreparation {
|
|
|
33
33
|
prepare(signal: AbortSignal): Promise<void>;
|
|
34
34
|
cancel(): void;
|
|
35
35
|
}
|
|
36
|
+
type SerialWorkRecord<T> = Omit<ZLinkSerialWorkRecord<T>, 'acceptedSequence'> & {
|
|
37
|
+
acceptedSequence: bigint;
|
|
38
|
+
readonly operationEnvelope: boolean;
|
|
39
|
+
readonly mailbox?: ZLinkSerialExecutionQueue;
|
|
40
|
+
readonly preparation?: ZLinkSerialWorkPreparation;
|
|
41
|
+
preparationState: 'idle' | 'pending' | 'canceling' | 'ready' | 'failed';
|
|
42
|
+
preparationController?: AbortController;
|
|
43
|
+
preparationError?: unknown;
|
|
44
|
+
};
|
|
45
|
+
interface ZLinkSerialAdmissionLane {
|
|
46
|
+
readonly records: Array<SerialWorkRecord<unknown>>;
|
|
47
|
+
}
|
|
36
48
|
/**
|
|
37
49
|
* One event-loop serial execution queue per Spot, Actor mailbox, or Stream session.
|
|
38
50
|
* Application work carries the host permit through the queue until the handler starts.
|
|
39
51
|
*/
|
|
40
52
|
export declare class ZLinkSerialExecutionQueue {
|
|
41
|
-
|
|
53
|
+
readonly executeRecord: (record: ZLinkSerialWorkRecord<unknown>) => Promise<void>;
|
|
42
54
|
private readonly sharedOwner?;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
readonly application: ZLinkSerialAdmissionLane;
|
|
56
|
+
readonly lifecycle: ZLinkSerialAdmissionLane;
|
|
57
|
+
activeLifecycle?: ZLinkSerialWorkRecord<unknown>;
|
|
46
58
|
private activeRecord?;
|
|
47
59
|
/** The admitted node itself owns ready membership; no second readiness flag. */
|
|
48
60
|
private ownerMembership?;
|
|
@@ -54,7 +66,7 @@ export declare class ZLinkSerialExecutionQueue {
|
|
|
54
66
|
private lifecycleDebt;
|
|
55
67
|
private claimStartedAt?;
|
|
56
68
|
private closed;
|
|
57
|
-
|
|
69
|
+
readonly idleWaiters: Array<() => void>;
|
|
58
70
|
constructor(executeRecord: (record: ZLinkSerialWorkRecord<unknown>) => Promise<void>, options?: ZLinkSerialSchedulerOptions, sharedOwner?: ZLinkSerialExecutionQueue | undefined);
|
|
59
71
|
submit<T>(operation: () => Promise<T> | T, options?: ZLinkSerialWorkOptions, context?: unknown): Promise<T>;
|
|
60
72
|
submitDetached<T>(operation: () => Promise<T> | T, onError: (error: unknown) => void, options?: ZLinkSerialWorkOptions, context?: unknown): void;
|
|
@@ -79,22 +91,23 @@ export declare class ZLinkSerialExecutionQueue {
|
|
|
79
91
|
/** Stops admission within the lifecycle operation that owns this queue's close. */
|
|
80
92
|
closeAdmission(): void;
|
|
81
93
|
get admissionClosed(): boolean;
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
admit<T>(operation: () => Promise<T> | T, options: ZLinkSerialWorkOptions | undefined, context?: unknown, preparation?: ZLinkSerialWorkPreparation, operationEnvelope?: boolean): Promise<T>;
|
|
95
|
+
scheduleDrain(): void;
|
|
84
96
|
/** Notifications carry no payload, admission sequence, result Promise, or host permit. */
|
|
85
|
-
|
|
97
|
+
enqueueMailboxTurn(operation: () => void): void;
|
|
86
98
|
/** Called only by the shared scheduler's consumer, never by a producer. */
|
|
87
99
|
private consumeMailbox;
|
|
88
100
|
private finishMailbox;
|
|
89
|
-
|
|
101
|
+
drain(): Promise<void>;
|
|
90
102
|
private prepareSelected;
|
|
91
|
-
|
|
92
|
-
|
|
103
|
+
selectNext(): SerialWorkRecord<unknown> | undefined;
|
|
104
|
+
takeSelected(selected: SerialWorkRecord<unknown>): ZLinkSerialWorkRecord<unknown>;
|
|
93
105
|
private takeLifecycle;
|
|
94
|
-
|
|
106
|
+
takeApplication(selected: SerialWorkRecord<unknown>): ZLinkSerialWorkRecord<unknown>;
|
|
95
107
|
private startPreparation;
|
|
96
108
|
/** Returns false while an outstanding readiness attempt is being canceled. */
|
|
97
109
|
private cancelPreparationForRearbitration;
|
|
98
110
|
private shouldYield;
|
|
99
|
-
|
|
111
|
+
resolveIdleWaiters(): void;
|
|
100
112
|
}
|
|
113
|
+
export {};
|