@deslop/deploy 0.1.1233 → 0.1.1235

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/server.js CHANGED
@@ -11248,6 +11248,11 @@ const annotateCurrentSpan$1 = (...args) => withFiber$1((fiber) => {
11248
11248
  return void_$3;
11249
11249
  });
11250
11250
  /** @internal */
11251
+ const currentSpan$1 = /*#__PURE__*/ withFiber$1((fiber) => {
11252
+ const span = fiber.currentSpanLocal;
11253
+ return span ? succeed$9(span) : fail$10(new NoSuchElementError());
11254
+ });
11255
+ /** @internal */
11251
11256
  const ClockRef = /*#__PURE__*/ Reference("effect/Clock", { defaultValue: () => new ClockImpl() });
11252
11257
  const MAX_TIMER_MILLIS = 2 ** 31 - 1;
11253
11258
  var ClockImpl = class {
@@ -20519,6 +20524,33 @@ const withTracerEnabled = withTracerEnabled$1;
20519
20524
  */
20520
20525
  const annotateCurrentSpan = annotateCurrentSpan$1;
20521
20526
  /**
20527
+ * Returns the currently active local tracing span.
20528
+ *
20529
+ * **Details**
20530
+ *
20531
+ * The effect fails with `NoSuchElementError` when there is no active local
20532
+ * `Span`.
20533
+ *
20534
+ * **Example** (Reading the current span)
20535
+ *
20536
+ * ```ts import.meta.vitest
20537
+ * import { Effect } from "effect"
20538
+ *
20539
+ * const program = Effect.gen(function*() {
20540
+ * const span = yield* Effect.currentSpan
20541
+ * return span.name
20542
+ * })
20543
+ *
20544
+ * const traced = Effect.withSpan(program, "my-span")
20545
+ * Effect.runSync(traced) // => "my-span"
20546
+ * ```
20547
+ *
20548
+ * @stability stable
20549
+ * @category tracing
20550
+ * @since 2.0.0
20551
+ */
20552
+ const currentSpan = currentSpan$1;
20553
+ /**
20522
20554
  * Create a new span for tracing, and automatically close it when the Scope
20523
20555
  * finalizes.
20524
20556
  *
@@ -87764,7 +87796,13 @@ const processes = gen(function* () {
87764
87796
  return {
87765
87797
  cgroup: yield* fs.readFileString(`/proc/${pid}/cgroup`),
87766
87798
  process: {
87767
- ...yield* try_(() => processStatus(status)),
87799
+ ...yield* try_({
87800
+ catch: (cause) => DeployError.make({
87801
+ cause,
87802
+ message: `Process ${pid} has an unreadable status.`
87803
+ }),
87804
+ try: () => processStatus(status)
87805
+ }),
87768
87806
  ...match$8(yield* option$1(fs.readFileString(`/proc/${pid}/cmdline`)), {
87769
87807
  onNone: () => ({}),
87770
87808
  onSome: (cmdline) => ({ command: commandArgs(cmdline) })
@@ -87874,13 +87912,16 @@ function portItems(text, worker, fs, http) {
87874
87912
  })), orElseSucceed(() => match[1] ?? ""));
87875
87913
  })
87876
87914
  });
87877
- const response = yield* match$1(fields[0] === "tcp" && port >= 1024 && isSome(match$3(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(address)) && isNone(match$3(/^(?:postgres|redis|ssh|cloudflared|tailscaled)$/u)(process)), {
87915
+ const response = yield* match$1(fields[0] === "tcp" && port >= 1024 && isSome(match$3(/^(?:127\.0\.0\.1|0\.0\.0\.0):/u)(address)) && isNone(match$3(/^(?:postgres|redis|ssh|cloudflared|tailscaled|caddy)$/u)(process)), {
87878
87916
  onFalse: () => succeed$5(none()),
87879
87917
  onTrue: fnUntraced(function* () {
87880
- return yield* pipe(http.head(`http://127.0.0.1:${port}/`), map$5((value) => ({
87918
+ return yield* pipe(option$1(currentSpan), flatMap$2((parent) => http.head(`http://127.0.0.1:${port}/`, { headers: match$8(parent, {
87919
+ onNone: () => ({}),
87920
+ onSome: toHeaders
87921
+ }) })), map$5((value) => ({
87881
87922
  http: true,
87882
87923
  ui: value.status >= 200 && value.status < 400 && includes("text/html")(value.headers["content-type"] ?? "")
87883
- })), provideService(RequestInit, { redirect: "manual" }), timeout("700 millis"), option$1);
87924
+ })), provideService(RequestInit, { redirect: "manual" }), provideService(TracerDisabledWhen$1, () => true), timeout("700 millis"), option$1);
87884
87925
  })
87885
87926
  });
87886
87927
  return InventoryItem.make({
@@ -88291,19 +88332,31 @@ var Metrics = class Metrics extends Service$1()("@deslop/deploy/services/metrics
88291
88332
  ])),
88292
88333
  uptime: fs.readFileString("/proc/uptime")
88293
88334
  }, { concurrency: "unbounded" });
88294
- const current = yield* pipe(try_(() => counters(files.stat, files.network, files.disk, files.uptime, time)), flatMap$2(decodeEffect(Counters)));
88335
+ const current = yield* pipe(try_({
88336
+ catch: (cause) => DeployError.make({
88337
+ cause,
88338
+ message: "The machine counters are unreadable."
88339
+ }),
88340
+ try: () => counters(files.stat, files.network, files.disk, files.uptime, time)
88341
+ }), flatMap$2(decodeEffect(Counters)));
88295
88342
  const old = getOrUndefined$1(yield* get$1(previous));
88296
88343
  const apps = yield* pipe(processes, provideService(FileSystem, fs), flatMap$2((readings) => modify$1(processState, (last) => {
88297
88344
  const next = processReadings(readings, getOrUndefined$1(last));
88298
88345
  return [next.readings, some$1(next)];
88299
88346
  })), timeout("3 seconds"), map$5(ownerUsage), option$1);
88300
- const value = yield* pipe(try_(() => ({
88301
- ...sample(current, files.memory, files.storage, old, files.load),
88302
- ...match$8(apps, {
88303
- onNone: () => ({}),
88304
- onSome: (usage) => ({ apps: usage })
88347
+ const value = yield* pipe(try_({
88348
+ catch: (cause) => DeployError.make({
88349
+ cause,
88350
+ message: "The machine sample is unreadable."
88351
+ }),
88352
+ try: () => ({
88353
+ ...sample(current, files.memory, files.storage, old, files.load),
88354
+ ...match$8(apps, {
88355
+ onNone: () => ({}),
88356
+ onSome: (usage) => ({ apps: usage })
88357
+ })
88305
88358
  })
88306
- })), flatMap$2(decodeEffect(Sample)));
88359
+ }), flatMap$2(decodeEffect(Sample)));
88307
88360
  yield* set$1(previous, some$1(current));
88308
88361
  const before = yield* get$1(state);
88309
88362
  const samples = compact([...before, value], time);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/deploy",
3
- "version": "0.1.1233",
3
+ "version": "0.1.1235",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/MP281X/deslop.git",
@@ -37,5 +37,5 @@
37
37
  "engines": {
38
38
  "node": ">=26"
39
39
  },
40
- "fingerprint": "5fcbfa470dbd822887937aaf7f4ad9b9b4d2675c20b352eec0eb19640864f136"
40
+ "fingerprint": "de888e989782873d9dcf2879acb847190bec4fb4f5cbe48a932e397f08ca62a4"
41
41
  }