feat(ocsf): emit a Close event for proxied sandbox connections

未关闭
#5,919 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
18/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
rust

调研方向

This is a design proposal, not a scoped edit: start with the egress usage monitoring RFC linked in the issue and the OCSF spike pull request to see how Traffic and Close events were prototyped, then find where the supervisor emits existing Network Activity records in the OCSF pipeline. Trace the proxied connection lifecycle for raw TCP and inspected HTTP(S) paths to locate the termination point where elapsed time and per-direction byte counts are still available. Done means one Close event per observed termination, correlated to its connection record, covered by tests against the supported OCSF schema, plus documentation of the measurement boundary — expect design discussion before any patch.

由索引模型根据 Issue 内容生成。

描述

area:runtime topic:observability

User Story

I use OpenShell to monitor network usage from agent sandboxes. I need a final accounting record for each proxied connection so I can measure usage from short-lived connections and reconcile completed transfers.

Problem Statement

OpenShell's OCSF Network Activity records show connection decisions, but they do not report final byte counts or duration when an allowed, established connection ends.

Impact / Why This Matters

An operator can see which connections OpenShell allowed but cannot tell how much data each completed connection carried. External analytics need this data to detect unusual use of allowed destinations and account for transfers that finish before the next periodic sample. OpenShell Research dev note

Proposed Design

Emit a Network Activity Close event when the supervisor observes an established proxied connection end. Include a connection identifier, sandbox and destination attribution, elapsed time, and final cumulative byte counts in both directions. Document the measurement boundary so consumers can interpret the counts for inspected and tunneled traffic.

Emit Close by default through the existing OCSF pipeline. Configured output destinations retain their existing requirements. This capability works independently of periodic Traffic reporting.

Acceptance Criteria

  • One Close event is generated per observed termination, including a normal close and a supervisor-observed interruption. Denied attempts and failed dials do not produce a Close for an established connection.
  • A consumer can correlate Close with the corresponding connection record and read the final per-direction totals and elapsed time, including for short-lived connections.
  • Tests cover representative supported proxy paths, including raw TCP and inspected HTTP(S), and validate the structured event against the supported OCSF schema.
  • Close events are emitted without a dedicated feature flag. Document coverage and what consumers should expect if the supervisor disappears before it can report a close.

Alternatives Considered

  • Infrequent snapshots miss short connections and can leave a final interval uncounted.
  • A request-level middleware extension can make decisions about inspected HTTP requests. It does not give operators a final byte count for all supported proxied connections.

Agent Investigation

The egress usage monitoring RFC describes lifecycle accounting. The OCSF spike prototyped Close and Traffic events together.

Checklist

  • I've reviewed existing issues and the published docs
  • This is a design proposal, not a "please build this" request
主要语言
Rust
星标
21.5k
派生
2.1k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NVIDIA/OpenShell 的其他 Issue

查看 NVIDIA/OpenShell 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。