Skip to content

Commit

Permalink
Merge branch 'main' into messaging-span-kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Sep 12, 2024
2 parents 358eac9 + 156daec commit cf17a35
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 66 deletions.
22 changes: 22 additions & 0 deletions .chloggen/process-build_id.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: process

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Extend process.executable with build_id attributes.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [1329]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: For correct symbolization it is important to uniquely identify executables.
22 changes: 22 additions & 0 deletions .chloggen/updete_host.id_lookup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Use this changelog template to create an entry for release notes.
#
# If your change doesn't affect end users you should instead start
# your pull request title with [chore] or use the "Skip Changelog" label.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
component: host

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: update lookup for os.build_id

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
# The values here must be integers.
issues: [1396]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:
2 changes: 1 addition & 1 deletion dependencies.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Dependabot can keep this file up to date with latest containers.

# Weaver is used to generate markdown docs, and enforce policies on the model.
FROM otel/weaver:v0.9.1 AS weaver
FROM otel/weaver:v0.9.2 AS weaver

# OPA is used to test policies enforced by weaver.
FROM openpolicyagent/opa:0.68.0 AS opa
Expand Down
65 changes: 34 additions & 31 deletions docs/attributes-registry/process.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/non-normative/code-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ This section contains suggestions on how to structure semantic convention artifa
This section describes how to do code-generation with weaver.

> [!IMPORTANT]
> We're transitioning from [build-tools](https://github.com/open-telemetry/build-tools/blob/main/semantic-conventions/README.md#code-generator)
> We're transitioning away from [build-tools](https://github.com/open-telemetry/build-tools/blob/main/semantic-conventions/README.md#code-generator)
> to [opentelemetry-weaver](https://github.com/open-telemetry/weaver/blob/main/crates/weaver_forge/README.md) to generate code for semantic conventions.
> All new code-generation should be done using weaver, build-tools may become incompatible with future version of semantic conventions.
> Weaver supports Semantic Conventions version starting from [1.26.0](https://github.com/open-telemetry/semantic-conventions/tree/v1.26.0).
Code-generation is based on YAML definitions in the specific version of semantic conventions.
Usually, it involves several steps where some can be semi-automated:
Expand Down Expand Up @@ -182,12 +183,11 @@ Notable changes on helper methods:

- `attr.fqn | to_const_name` -> `attr.name | screaming_snake_case`
- `attr.fqn | to_camelcase(True)` -> `attr.name | pascal_case`
- `attr.brief | to_doc_brief | indent` -> `attr.brief | comment_with_prefix(" ")` (prefix is used to indent)
- `attr.brief | to_doc_brief | indent` -> `attr.brief | comment(indent=4)`, check out extensive [comment formatting configuration](https://github.com/open-telemetry/weaver/blob/main/crates/weaver_forge/README.md#comment-filter)
- stability/deprecation checks:
- `attribute is stable` if checking one attribute, `attributes | select("stable")` to filter stable attributes
- `attribute is experimental` if checking one attribute, `attributes | select("experimental")` to filter experimental attributes
- `attribute is deprecated` if checking one attribute, `attributes | select("deprecated")` to filter deprecated attributes
- check if attribute is a template: `attribute.type is template_type`
- `print_member_value` - no replacement at this time, use something like `{%- if type == "string" -%}"{{value}}"{%-else-%}{{value}}{%-endif-%}`
- new way to simplify switch-like logic: `key | map_text("map_name")`. Maps can be defined in the weaver config.
It can be very useful to convert semantic convention attribute types to language-specific types.
62 changes: 31 additions & 31 deletions docs/resource/host.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,44 @@ To report host metrics, the `system.*` namespace SHOULD be used.
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`host.arch`](/docs/attributes-registry/host.md) | string | The CPU architecture the host system is running on. | `amd64`; `arm32`; `arm64` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.id`](/docs/attributes-registry/host.md) | string | Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system. | `fdbf79e8af94cb7f9e8df36789187052` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.id`](/docs/attributes-registry/host.md) | string | Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. For non-containerized systems, this should be the `machine-id`. See the table below for the sources to use to determine the `machine-id` based on operating system. [1] | `fdbf79e8af94cb7f9e8df36789187052` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.image.id`](/docs/attributes-registry/host.md) | string | VM image ID or host OS image ID. For Cloud, this value is from the provider. | `ami-07b06b442921831e5` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.image.name`](/docs/attributes-registry/host.md) | string | Name of the VM image or OS install the host was instantiated from. | `infra-ami-eks-worker-node-7d4ec78312`; `CentOS-8-x86_64-1905` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.image.version`](/docs/attributes-registry/host.md) | string | The version string of the VM image or host OS as defined in [Version Attributes](/docs/resource/README.md#version-attributes). | `0.1` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.name`](/docs/attributes-registry/host.md) | string | Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user. | `opentelemetry-test` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.type`](/docs/attributes-registry/host.md) | string | Type of host. For Cloud, this must be the machine type. | `n1-standard-1` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.ip`](/docs/attributes-registry/host.md) | string[] | Available IP addresses of the host, excluding loopback interfaces. [1] | `["192.168.1.140", "fe80::abc2:4a28:737a:609e"]` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.mac`](/docs/attributes-registry/host.md) | string[] | Available MAC addresses of the host, excluding loopback interfaces. [2] | `["AC-DE-48-23-45-67", "AC-DE-48-23-45-67-01-9F"]` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.ip`](/docs/attributes-registry/host.md) | string[] | Available IP addresses of the host, excluding loopback interfaces. [2] | `["192.168.1.140", "fe80::abc2:4a28:737a:609e"]` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| [`host.mac`](/docs/attributes-registry/host.md) | string[] | Available MAC addresses of the host, excluding loopback interfaces. [3] | `["AC-DE-48-23-45-67", "AC-DE-48-23-45-67-01-9F"]` | `Opt-In` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

**[1]:** IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 addresses MUST be specified in the [RFC 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format.
**[1]:** Collecting `host.id` from non-containerized systems

**[2]:** MAC Addresses MUST be represented in [IEEE RA hexadecimal form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): as hyphen-separated octets in uppercase hexadecimal form from most to least significant.
**Non-privileged Machine ID Lookup**

When collecting `host.id` for non-containerized systems non-privileged lookups
of the machine id are preferred. SDK detector implementations MUST use the
sources listed below to obtain the machine id.

| OS | Primary | Fallback |
|---------|---------|---------|
| Linux | contents of `/etc/machine-id` | contents of `/var/lib/dbus/machine-id` |
| BSD | contents of `/etc/hostid` | output of `kenv -q smbios.system.uuid` |
| MacOS | `IOPlatformUUID` line from the output of `ioreg -rd1 -c "IOPlatformExpertDevice"` | - |
| Windows | `MachineGuid` from registry `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography` | - |

**Privileged Machine ID Lookup**

The `host.id` can be looked up using privileged sources. For example, Linux
systems can use the output of `dmidecode -t system`, `dmidecode -t baseboard`,
`dmidecode -t chassis`, or read the corresponding data from the filesystem
(e.g. `cat /sys/devices/virtual/dmi/id/product_id`,
`cat /sys/devices/virtual/dmi/id/product_uuid`, etc), however, SDK resource
detector implementations MUST not collect `host.id` from privileged sources. If
privileged lookup of `host.id` is required, the value should be injected via the
`OTEL_RESOURCE_ATTRIBUTES` environment variable.

**[2]:** IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 addresses MUST be specified in the [RFC 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format.

**[3]:** MAC Addresses MUST be represented in [IEEE RA hexadecimal form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): as hyphen-separated octets in uppercase hexadecimal form from most to least significant.



Expand Down Expand Up @@ -82,30 +108,4 @@ To report host metrics, the `system.*` namespace SHOULD be used.
<!-- END AUTOGENERATED TEXT -->
<!-- endsemconv -->

## Collecting host.id from non-containerized systems

### Non-privileged Machine ID Lookup

When collecting `host.id` for non-containerized systems non-privileged lookups
of the machine id are preferred. SDK detector implementations MUST use the
sources listed below to obtain the machine id.

| OS | Primary | Fallback |
|---------|-----------------------------------------------------------------------------------|----------------------------------------|
| Linux | contents of `/etc/machine-id` | contents of `/var/lib/dbus/machine-id` |
| BSD | contents of `/etc/hostid` | output of `kenv -q smbios.system.uuid` |
| MacOS | `IOPlatformUUID` line from the output of `ioreg -rd1 -c "IOPlatformExpertDevice"` | - |
| Windows | `MachineGuid` from registry `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography` | - |

### Privileged Machine ID Lookup

The `host.id` can be looked up using privileged sources. For example, Linux
systems can use the output of `dmidecode -t system`, `dmidecode -t baseboard`,
`dmidecode -t chassis`, or read the corresponding data from the filesystem
(e.g. `cat /sys/devices/virtual/dmi/id/product_id`,
`cat /sys/devices/virtual/dmi/id/product_uuid`, etc), however, SDK resource
detector implementations MUST not collect `host.id` from privileged sources. If
privileged lookup of `host.id` is required, the value should be injected via the
`OTEL_RESOURCE_ATTRIBUTES` environment variable.

[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status
19 changes: 19 additions & 0 deletions model/registry/process.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ groups:
The PID of the process's group leader. This is also the process group
ID (PGID) of the process.
examples: [23]
- id: process.executable.build_id.gnu
stability: experimental
type: string
brief: >
The GNU build ID as found in the `.note.gnu.build-id` ELF section (hex string).
examples: ['c89b11207f6479603b0d49bf291c092c2b719293']
- id: process.executable.build_id.go
stability: experimental
type: string
brief: >
The Go build ID as retrieved by `go tool buildid <go executable>`.
examples: ['foh3mEXu7BLZjsN9pOwG/kATcXlYVCDEFouRMQed_/WwRFB1hPo9LBkekthSPG/x8hMC8emW2cCjXD0_1aY']
- id: process.executable.build_id.profiling
stability: experimental
type: string
brief: >
Profiling specific build ID for executables. See the OTel specification
for Profiles for more information.
examples: ['600DCAFE4A110000F2BF38C493F5FB92']
- id: process.executable.name
type: string
stability: experimental
Expand Down
26 changes: 26 additions & 0 deletions model/resource/host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,32 @@ groups:
A host is defined as a computing instance. For example, physical servers, virtual machines, switches or disk array.
attributes:
- ref: host.id
note: |
Collecting `host.id` from non-containerized systems
**Non-privileged Machine ID Lookup**
When collecting `host.id` for non-containerized systems non-privileged lookups
of the machine id are preferred. SDK detector implementations MUST use the
sources listed below to obtain the machine id.
| OS | Primary | Fallback |
|---------|---------|---------|
| Linux | contents of `/etc/machine-id` | contents of `/var/lib/dbus/machine-id` |
| BSD | contents of `/etc/hostid` | output of `kenv -q smbios.system.uuid` |
| MacOS | `IOPlatformUUID` line from the output of `ioreg -rd1 -c "IOPlatformExpertDevice"` | - |
| Windows | `MachineGuid` from registry `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography` | - |
**Privileged Machine ID Lookup**
The `host.id` can be looked up using privileged sources. For example, Linux
systems can use the output of `dmidecode -t system`, `dmidecode -t baseboard`,
`dmidecode -t chassis`, or read the corresponding data from the filesystem
(e.g. `cat /sys/devices/virtual/dmi/id/product_id`,
`cat /sys/devices/virtual/dmi/id/product_uuid`, etc), however, SDK resource
detector implementations MUST not collect `host.id` from privileged sources. If
privileged lookup of `host.id` is required, the value should be injected via the
`OTEL_RESOURCE_ATTRIBUTES` environment variable.
- ref: host.name
- ref: host.type
- ref: host.arch
Expand Down

0 comments on commit cf17a35

Please sign in to comment.