Kibotos
API 参考kibotos.ctrl.v1

WorkspaceMetricsService

本页列出 kibotos.ctrl.v1 中 WorkspaceMetricsService 的方法及每个方法用到的消息与枚举,由 ctrl.proto 及其注释生成,注释保持英文。多个服务共用的消息与枚举见 kibotos.ctrl.v1 类型。

ctrl API使用 Operator 证书调用。调用方式

WorkspaceMetricsService reads a Workspace's resource readings back from the deployment's metrics store. The readings are observations, not usage records: the store may lack any stretch of them, and how far back they reach follows the store's retention. Every execution the Workspace had, on whichever host, is merged into one series. A deployment that configured no metrics store answers FAILED_PRECONDITION with FAILURE_REASON_CAPABILITY_UNAVAILABLE and does not announce workspace.metrics.get; an endpoint that predates the service answers UNIMPLEMENTED.

GetWorkspaceMetrics

POST/kibotos.ctrl.v1.WorkspaceMetricsService/GetWorkspaceMetrics一元调用
请求GetWorkspaceMetricsRequest

GetWorkspaceMetricsRequest names one Workspace, deleted ones included, and an optional time range. A missing start is the Workspace's earliest readable time and a missing end its latest reading. The range only chooses the step and the buckets: readings outside the store's retention or after now never appear.

  • workspace_idstring= 1
  • startgoogle.protobuf.Timestamp= 2

    start, when set, is the start of the range; ctrl rounds it down to whole seconds.

  • endgoogle.protobuf.Timestamp= 3

    end, when set, is the end of the range and must not be before start; ctrl rounds it up to whole seconds.

响应GetWorkspaceMetricsResponse

GetWorkspaceMetricsResponse holds the readings in buckets of one step, each point stamped with its bucket's start, in ascending order. The step follows from end - start:

shorter than 1 hour     5 seconds
1 to 6 hours            30 seconds
6 to 12 hours           1 minute
12 to 24 hours          2 minutes
1 to 7 days             5 minutes
7 days and longer       15 minutes

A range that would need more than 4,000 buckets is refused with INVALID_ARGUMENT. Only buckets that end at least the store's visibility delay before now are returned, so a bucket once answered does not change.

host and guest are two separate series. host is read on the host outside the guest: nothing in the guest can alter it, and it continues while the guest does not answer. guest is read from inside the guest, with the same values and formulas as the E2B sandbox metrics: root in the guest can alter it, and it has no points while the guest does not answer. Either series may lack any bucket.

  • stepgoogle.protobuf.Duration= 1

    step is the width of every bucket.

  • earliest_timegoogle.protobuf.Timestamp= 2

    earliest_time is the earliest time the store still holds readings of this Workspace for. It moves forward as the store's retention expires readings; callers must not assume a fixed length. Absent when the store holds none.

  • host is the host series, ascending.

  • guest is the guest series, ascending.

WorkspaceHostMetricsPoint

WorkspaceHostMetricsPoint is one bucket of host readings. A rate is the average over the bucket: the rate times the step is the bucket's total, and a bucket spanning two executions adds their totals. A level is the highest value in the bucket. A field the host recorded nothing for in the bucket is absent; a point is returned when at least one field is present.

WorkspaceGuestMetricsPoint

WorkspaceGuestMetricsPoint is one bucket of guest readings, each the highest value of the bucket. A bucket that lacks any of the seven is not returned.

  • timegoogle.protobuf.Timestamp= 1

    time is the bucket's start.

  • cpu_countuint32= 2

    cpu_count is the number of online CPUs in the guest.

  • cpu_used_percent is the share of CPU time, 0 to 100, the guest spent busy between two readings five seconds apart.

  • memory_total_bytes is MemTotal of the guest's /proc/meminfo, memory_used_bytes MemTotal - MemAvailable and memory_cache_bytes Cached.

  • disk_total_bytes and disk_used_bytes are the size and the used space of the guest's root filesystem.

本页内容