Skip to content

openspec: propose SBMD runtime observability instrumentation#245

Open
rchowdcmcsa wants to merge 26 commits into
mainfrom
rchowd/dev/observabilityInstrumentation
Open

openspec: propose SBMD runtime observability instrumentation#245
rchowdcmcsa wants to merge 26 commits into
mainfrom
rchowd/dev/observabilityInstrumentation

Conversation

@rchowdcmcsa

@rchowdcmcsa rchowdcmcsa commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Add change proposal, design, spec, and task list for wiring the existing
observability API into the SBMDv4 JS runtime.

Metrics defined:

  • JS heap pool health (used_bytes, free_bytes, arena_bytes, peak_bytes) via a hybrid sampler: in-activity captures after every InvokeHandler call, plus an idle background thread (BCORE_SBMD_METRICS_SAMPLE_PERIOD_MS, default 30 s) that fires only when no handler activity has occurred for the full period. free_bytes maps to usage.free_size (heap-stack gap); JS_MEMUSAGE_WALK_HEAP is not set.
  • Per-invocation handler duration, heap delta, and outcome (success/exception/timeout/stack_overflow/error) via SbmdHandlerInvoker::InvokeHandler, extended with a single optional const OperationContext *opCtx = nullptr parameter (backwards-compatible)
  • JS mutex wait time per handler invocation path
  • Driver load cost (duration, heap bytes) and failure counts per driver and failure reason (file_read/eval_failed/activation_failed)
  • Registered driver count at startup
  • Deferred operation lifecycle: in-flight gauge, total duration, deferral depth, timeout count, max-depth-exceeded count; all attributed by driver, originating op type, and resource ID via a new OperationContext operationCtx field on PendingOperation
  • JS exception events during init and loading phases

GC tracking is deferred to a follow-on change.

Add change proposal, design, spec, and task list for wiring the
existing observability API into the SBMDv4 JS runtime.

Metrics defined:
- JS heap pool health (used, free, arena, peak, free blocks) via
  periodic background sampler in MQuickJsRuntime
- Per-invocation handler duration, heap delta, and outcome
  (success/exception/timeout/stack_overflow/error) via
  SbmdHandlerInvoker::InvokeHandler
- JS mutex wait time per handler invocation path
- Driver load cost (duration, heap bytes) and failure counts per
  driver and failure reason
- Registered driver count at startup
- Deferred operation lifecycle: in-flight gauge, total duration,
  deferral depth, timeout count, max-depth-exceeded count; all
  attributed by driver and originating op type via new origOpType
  field on PendingOperation
- JS exception events (init and loading phases only)

All metrics are centralized in a new SbmdMetrics class. GC tracking
is deferred to a follow-on change.
Copilot AI review requested due to automatic review settings July 14, 2026 17:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an OpenSpec change proposal defining a concrete SBMDv4 runtime observability plan (metrics set, instrumentation points, and a work breakdown) to wire the existing in-tree observability API into the SBMD JS runtime.

Changes:

  • Introduces a new sbmd-runtime-observability spec defining metric names, instruments, attributes, and required behaviors.
  • Adds design/proposal docs describing the intended C++ integration points (runtime sampler, handler invocation metering, driver load metering, deferred-op lifecycle metrics).
  • Adds an implementation task list covering C++ wiring, new unit tests, and integration tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
openspec/changes/sbmd-observability-instrumentation/proposal.md High-level motivation/scope and intended code touchpoints for SBMD runtime instrumentation.
openspec/changes/sbmd-observability-instrumentation/design.md Detailed design decisions for where/how metrics will be captured and attributed.
openspec/changes/sbmd-observability-instrumentation/specs/sbmd-runtime-observability/spec.md Normative requirements for the SBMD runtime metrics (names, semantics, scenarios).
openspec/changes/sbmd-observability-instrumentation/tasks.md Step-by-step implementation plan (C++ changes + tests).
openspec/changes/sbmd-observability-instrumentation/.openspec.yaml Registers the change as a spec-driven OpenSpec change with creation date.

Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/proposal.md Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/proposal.md
Comment thread openspec/changes/sbmd-observability-instrumentation/proposal.md Outdated

@cleithner-comcast cleithner-comcast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I might also suggest a gauge for GC root entries on the mquickjs list. I would like to know if we are "leaking" root entries over time from misuse of [Safe]JSValue. I am not sure the best way to do this, may require a patch to expose the list size.

@rchowdcmcsa

Copy link
Copy Markdown
Contributor Author

If I might also suggest a gauge for GC root entries on the mquickjs list. I would like to know if we are "leaking" root entries over time from misuse of [Safe]JSValue. I am not sure the best way to do this, may require a patch to expose the list size.

Will explore this and figure out what we might be able to do.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Copilot AI review requested due to automatic review settings July 15, 2026 15:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 19:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 19:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 20:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 20:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread openspec/changes/sbmd-observability-instrumentation/tasks.md Outdated
Comment thread openspec/changes/sbmd-observability-instrumentation/design.md Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 20:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants