@plitzi/sdk-runtime 0.39.8 → 0.39.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @plitzi/sdk-runtime
2
2
 
3
+ ## 0.39.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 97d3b64: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
8
+ `@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
9
+ - Updated dependencies [97d3b64]
10
+ - @plitzi/sdk-kernel@0.39.10
11
+ - @plitzi/sdk-shared@0.39.10
12
+
13
+ ## 0.39.9
14
+
15
+ ### Patch Changes
16
+
17
+ - f04c646: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
18
+ `@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
19
+ - Updated dependencies [f04c646]
20
+ - @plitzi/sdk-kernel@0.39.9
21
+ - @plitzi/sdk-shared@0.39.9
22
+
3
23
  ## 0.39.8
4
24
 
5
25
  ### Patch Changes
@@ -2037,6 +2037,7 @@ var serveConnection = (socket, runner, stats, trace) => {
2037
2037
  if (invokedAt !== void 0) {
2038
2038
  const tookMs = Date.now() - invokedAt;
2039
2039
  stats.inFlight.count -= 1;
2040
+ if (label?.environment) stats.inFlight.environments[label.environment] = (stats.inFlight.environments[label.environment] ?? 1) - 1;
2040
2041
  stats.recorder.run(tookMs, message.type === "failed" ? endOf(message.reason) : void 0, label);
2041
2042
  invokedAt = void 0;
2042
2043
  const what = label ? `${label.kind} ${label.name} space=${String(label.spaceId)}` : "an invocation";
@@ -2190,7 +2191,7 @@ var serveConnection = (socket, runner, stats, trace) => {
2190
2191
  const urgency = invocationUrgency(invocation);
2191
2192
  const tooLarge = stats.tooLarge(limits);
2192
2193
  if (tooLarge) {
2193
- stats.recorder.refuse("busy");
2194
+ stats.recorder.refuse("busy", invocation.context.environment);
2194
2195
  finish({
2195
2196
  type: "failed",
2196
2197
  reason: protocolKnows(message.protocol, "1.4") ? "too_large" : "busy",
@@ -2201,7 +2202,7 @@ var serveConnection = (socket, runner, stats, trace) => {
2201
2202
  const busy = stats.busy(limits, urgency);
2202
2203
  if (busy) {
2203
2204
  if (!(!stats.stopping() && message.queue === true && protocolKnows(message.protocol, "1.3"))) {
2204
- stats.recorder.refuse(stats.stopping() ? "stopping" : "busy");
2205
+ stats.recorder.refuse(stats.stopping() ? "stopping" : "busy", invocation.context.environment);
2205
2206
  finish({
2206
2207
  type: "failed",
2207
2208
  reason: "busy",
@@ -2212,7 +2213,7 @@ var serveConnection = (socket, runner, stats, trace) => {
2212
2213
  send({ type: "queued" });
2213
2214
  if (!await stats.wait(limits, urgency, controller.signal)) {
2214
2215
  if (!controller.signal.aborted) {
2215
- stats.recorder.refuse("stopping");
2216
+ stats.recorder.refuse("stopping", invocation.context.environment);
2216
2217
  finish({
2217
2218
  type: "failed",
2218
2219
  reason: "busy",
@@ -2228,10 +2229,13 @@ var serveConnection = (socket, runner, stats, trace) => {
2228
2229
  kind: invocation.kind,
2229
2230
  name: invocation.kind === "route" ? invocation.key : invocation.name,
2230
2231
  trigger: invocation.context.trigger,
2231
- runId: invocation.context.runId
2232
+ runId: invocation.context.runId,
2233
+ environment: invocation.context.environment
2232
2234
  };
2233
2235
  invokedAt = Date.now();
2234
2236
  stats.inFlight.count += 1;
2237
+ const { environment } = invocation.context;
2238
+ stats.inFlight.environments[environment] = (stats.inFlight.environments[environment] ?? 0) + 1;
2235
2239
  if (protocolKnows(message.protocol, "1.2")) send({ type: "accepted" });
2236
2240
  settle(runner.invoke({
2237
2241
  bundle: {
@@ -2297,7 +2301,10 @@ var startFunctionsRunnerService = async ({ secret, port = 8790, host = "0.0.0.0"
2297
2301
  protocol: FUNCTIONS_PROTOCOL,
2298
2302
  ...version ? { version } : {}
2299
2303
  });
2300
- const inFlight = { count: 0 };
2304
+ const inFlight = {
2305
+ count: 0,
2306
+ environments: {}
2307
+ };
2301
2308
  let stopping = false;
2302
2309
  const most = isolate.concurrency ?? 8;
2303
2310
  const MB = 1048576;
@@ -2369,7 +2376,7 @@ var startFunctionsRunnerService = async ({ secret, port = 8790, host = "0.0.0.0"
2369
2376
  }, { once: true });
2370
2377
  letIn();
2371
2378
  });
2372
- if (!runner) recorder.slot("isolates", most, () => inFlight.count);
2379
+ if (!runner) recorder.slot("isolates", most, () => inFlight.count, { environments: () => Object.fromEntries(Object.entries(inFlight.environments).filter(([, held]) => held > 0)) });
2373
2380
  const sockets = new WebSocketServer({
2374
2381
  noServer: true,
2375
2382
  maxPayload: MAX_FRAME_BYTES
@@ -1,4 +1,4 @@
1
- import { c as describeFunctions, n as startFunctionsRunnerService, s as createFunctionsDriver } from "../chunks/service-BcYwkety.mjs";
1
+ import { c as describeFunctions, n as startFunctionsRunnerService, s as createFunctionsDriver } from "../chunks/service-CasDGePP.mjs";
2
2
  import { ActionRefusal, FunctionFailure, PLATFORM_HEADERS, RUNTIME_DESCRIBE_PATH, changeKv, changeListEntry, endpointFor, endpointProblem, isActionRefusal, requestFromWire, responseOf, wireResponseFrom, wireResponseOf } from "@plitzi/sdk-shared/functions";
3
3
  import { webRequestOf, writeWebResponse } from "@plitzi/sdk-kernel/http";
4
4
  import { reachSpaceInside } from "@plitzi/sdk-kernel/outbound";
@@ -1 +1 @@
1
- export { r as PBKDF2_MAX_BITS, i as PBKDF2_MAX_ITERATIONS, o as createCpuMeter, a as createIsolateRunner, t as invocationFootprintMb, n as startFunctionsRunnerService } from "../chunks/service-BcYwkety.mjs";
1
+ export { r as PBKDF2_MAX_BITS, i as PBKDF2_MAX_ITERATIONS, o as createCpuMeter, a as createIsolateRunner, t as invocationFootprintMb, n as startFunctionsRunnerService } from "../chunks/service-CasDGePP.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-runtime",
3
- "version": "0.39.8",
3
+ "version": "0.39.10",
4
4
  "license": "AGPL-3.0",
5
5
  "description": "The contract a space's own code is written against, and what runs it with no access: the functions runner, its isolates, and the host of a space's runtime.",
6
6
  "files": [
@@ -38,8 +38,8 @@
38
38
  "build:prod": "vite build && node scripts/prelude.mjs && node scripts/functions-api.mjs"
39
39
  },
40
40
  "dependencies": {
41
- "@plitzi/sdk-kernel": "0.39.8",
42
- "@plitzi/sdk-shared": "0.39.8",
41
+ "@plitzi/sdk-kernel": "0.39.10",
42
+ "@plitzi/sdk-shared": "0.39.10",
43
43
  "ws": "^8.23.0"
44
44
  },
45
45
  "peerDependencies": {