mirror of
https://github.com/hanzoai/runtime.git
synced 2026-10-30 18:23:13 +00:00
Every sandbox was created privileged under the daemon's default runtime, and the setting that would have changed it defaulted to an empty string that silently meant runc. For a service whose whole premise is running code somebody else wrote, that is not a boundary. An org sets its isolation and the create request carries it, so a sandbox records what it was made with: changing the policy moves new sandboxes and leaves running ones alone. gvisor is the default. firecracker is delivered through kata's shim, which is why it is one name rather than two. runc is refused unless the runner names that org, and an empty list names nobody. Absent means the default, unknown is a refusal, and a runtime the daemon does not have is a refusal. Nothing substitutes quietly. The runner took an organization in a field called UserId with a note beside it saying so. Deciding who may have runc through a field named after something else is not reviewable. Privileged is replaced by dropping everything and granting the eight the daemon uses. Nothing the sandbox does broke; what stopped working is mount, mknod, raw sockets, chroot, writing to proc, and seeing the host's disks. AUDIT_WRITE is among them because without it sudo works and complains every time. The creation histogram's lowest bucket was a tenth of a second, so the metric could not observe the claim the product makes about its own speed. It can now, and it carries the isolation, so comparing them is a query. Co-authored-by: Hanzo Dev <[email protected]>
45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
// Copyright 2025 Hanzo Industries Inc.
|
|
// SPDX-License-Identifier: AGPL-3.0
|
|
|
|
package common
|
|
|
|
import (
|
|
metric "github.com/luxfi/metric"
|
|
)
|
|
|
|
type PrometheusOperationStatus string
|
|
|
|
const (
|
|
PrometheusOperationStatusSuccess PrometheusOperationStatus = "success"
|
|
PrometheusOperationStatusFailure PrometheusOperationStatus = "failure"
|
|
)
|
|
|
|
// Define your metrics
|
|
var (
|
|
// Histogram to track duration of container operations, by the boundary the
|
|
// sandbox runs behind, which is what makes one boundary comparable to
|
|
// another.
|
|
//
|
|
// The lowest bucket used to be 0.1s, so every creation that met the
|
|
// sub-90ms claim landed in the same bucket as one that missed it and the
|
|
// claim could not be observed at all. There is a boundary at 0.09 now: the
|
|
// share of creations meeting it is one query.
|
|
ContainerOperationDuration = metric.NewHistogramVec(
|
|
metric.HistogramOpts{
|
|
Name: "container_operation_duration_seconds",
|
|
Help: "Time taken for container operations in seconds",
|
|
Buckets: []float64{0.01, 0.025, 0.05, 0.075, 0.09, 0.1, 0.25, 0.5, 1, 2, 5, 10, 30, 60, 120, 300},
|
|
},
|
|
[]string{"operation", "isolation"},
|
|
)
|
|
|
|
// Counter to track occurrence of container operations with status
|
|
ContainerOperationCount = metric.NewCounterVec(
|
|
metric.CounterOpts{
|
|
Name: "container_operation_total",
|
|
Help: "Total number of container operations",
|
|
},
|
|
[]string{"operation", "status"},
|
|
)
|
|
)
|