Container
容器属性
容器实例。
Attributes
| 键 | Stability | Value Type | 描述 | Example Values |
|---|---|---|---|---|
container.command | 字符串 | 用于运行容器的命令(即命令名)。[1] | otelcontribcol | |
container.command_args | string[] | 容器运行的所有命令参数(包括命令/可执行文件本身)。 | ["otelcontribcol", "--config", "config.yaml"] | |
container.command_line | 字符串 | 容器运行的完整命令,表示为单个字符串。 | otelcontribcol --config config.yaml | |
container.csi.plugin.name | 字符串 | 卷使用的 CSI(容器存储接口)插件的名称。[2] | pd.csi.storage.gke.io | |
container.csi.volume.id | 字符串 | CSI(容器存储接口)插件返回的唯一卷 ID。[3] | projects/my-gcp-project/zones/my-gcp-zone/disks/my-gcp-disk | |
container.id | 字符串 | 容器 ID。通常是一个 UUID,例如用于 标识 Docker 容器。UUID 可能会被缩写。 | a3bf90e006b2 | |
container.image.id | 字符串 | 运行时特定的镜像标识符。通常是哈希算法后跟一个 UUID。[4] | sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f | |
container.image.name | 字符串 | Name of the image the container was built on. | gcr.io/opentelemetry/operator | |
container.image.repo_digests | string[] | 由容器运行时提供的容器镜像的 Repo digests。[5] | ["example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb", "internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578"] | |
container.image.tags | string[] | 容器镜像标签。示例可在 Docker Image Inspect 中找到。应仅包含完整名称中的 <tag> 部分,例如从 registry.example.com/my-org/my-image:<tag> 中提取。 | ["v1.27.1", "3.5.7-0"] | |
container.label.<key> | 字符串 | 容器标签,<key> 为标签名称,值为标签值。[6] | nginx | |
container.name | 字符串 | 容器运行时使用的容器名称。 | opentelemetry-autoconf | |
container.runtime.description | 字符串 | 关于运行时的描述,可能包含例如使用的 CRI/API 版本或其他自定义的详细信息。 | docker://19.3.1 - CRI: 1.22.0 | |
container.runtime.name | 字符串 | 管理此容器的容器运行时。 | docker; containerd; rkt | |
container.runtime.version | 字符串 | 此进程运行时的版本,由运行时直接返回。 | 1.0.0 |
[1] container.command: 如果使用嵌入式凭据或敏感数据,建议将其移除,以防止潜在泄露。
[2] container.csi.plugin.name: 在 CSI 实现中,有时也称作“驱动程序”。这应代表 GetPluginInfo RPC 的 name 字段。
[3] container.csi.volume.id: 在 CSI 实现中,有时也称作“卷句柄”。这应代表 CSI 规范中的 Volume.volume_id 字段。
[4] container.image.id: Docker 定义了镜像 ID 的 sha256;container.image.id 对应于 Docker 容器 inspect API 端点的 Image 字段。K8s 定义了一个指向容器注册表仓库的链接,并带有摘要 "imageID": "registry.azurecr.io /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"。ID 由容器运行时分配,在不同环境中可能不同。如果识别同一镜像在不同环境/运行时很重要,请考虑使用 oci.manifest.digest。
[5] container.image.repo_digests: Docker 和 CRI 在 RepoDigests 字段下报告这些。
[6] container.label.<key>: 例如,一个值为 nginx 的 docker 容器标签 app 应记录为 container.label.app 属性,值为 "nginx"。
已弃用的容器属性
描述已弃用的容器属性。
Attributes
| 键 | Stability | Value Type | 描述 | Example Values |
|---|---|---|---|---|
container.cpu.state | 已由 cpu.mode 替换。 | 字符串 | 已弃用,请改用 cpu.mode。 | user; kernel |
container.labels.<key> | 已由 container.label 替换。 | 字符串 | 已弃用,请改用 container.label。 | nginx |
container.runtime | 已由 container.runtime.name 替换。 | 字符串 | 管理此容器的容器运行时。 | docker; containerd; rkt |
container.cpu.state 具有以下一组已知值。如果其中一个适用,则必须使用相应的值;否则,可以使用自定义值。
| 值 | 描述 | Stability |
|---|---|---|
kernel | 当 cgroup 的任务处于内核模式时(Linux)。当所有容器进程都处于内核模式时(Windows)。 | |
system | 当 CPU 被系统(主机 OS)使用时 | |
user | 当 cgroup 的任务处于用户模式时(Linux)。当所有容器进程都处于用户模式时(Windows)。 |