Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attribute names in semantic guidelines should be hierarchical #3131

Closed
sebastien-rosset opened this issue Jan 23, 2023 · 3 comments
Closed
Assignees
Labels
area:semantic-conventions Related to semantic conventions spec:metrics Related to the specification/metrics directory

Comments

@sebastien-rosset
Copy link
Contributor

sebastien-rosset commented Jan 23, 2023

What are you trying to achieve?

Fix the names of the attributes in the semantic guidelines to make them hierarchical. Some names are not hierarchical in hardware, system.

What did you expect to see?

Under the hardware semantic guidelines, the names of the attributes should be hierarchical.

Elsewhere, HTTP, RPC, Database, System, Process, Runtime Environment, FaaS are consistently using hierarchical names, with state noted as an exception. However, in the Hardware guidelines, many names have a flat structure, which is not compliant with the naming guidelines.

If exceptions to the naming hierarchy requirement are allowed, IMO that should be explicit in the spec.

Additional context.

The spec states:

Metric names and attributes exist within a single universe and a single hierarchy. Metric names and attributes MUST be considered within the universe of all existing metric names. When defining new metric names and attributes, consider the prior art of existing standard metrics and metrics from frameworks/libraries.

Defining lots of attributes with no name hierarchy has the side effect of preventing any future use of that word as a namespace. These attributes are declared with a flat naming structure:

  1. In hardware: direction, vendor, model, serial_number, vendor, firmware_version, bios_version, driver_version, firmware_version, id, name, parent, chemistry, capacity, limit_type, state, sensor_location, type, task, raid_level, logical_addresses, physical_addresses, smart_attribute.
  2. In system: state, type, direction, device, cpu, mode, mountpoint, protocol, status.
  3. In process: state, direction, type.
  4. In runtime environment: state, pool, type, daemon, gc, action.

capacity is defined as the capacity in Watts-hours or Amper-hours, which is highly specific to batteries. However, the word capacity is contextual, it could mean something entirely different in another namespace. It seems that by allowing names to be flat, more flat-names will be created in short order, which inevitably will lead to collisions or other naming problems. At some point, shouldn't there be a registry of namespaces, similar to what was done at the IETF or IEEE?

Device

  1. The device attribute is defined under disk controller metrics
  2. The device.id attribute is defined in device attributes

This means the word device is both a namespace and attribute name. This breaks this attribute naming rule:

Names SHOULD NOT coincide with namespaces. For example, if service.instance.id is an attribute name then it is no longer valid to have an attribute named service.instance because service.instance is already a namespace. Adhering to this rule necessitates careful choice of names: every existing name prohibits existence of an equally named namespace in the future, and vice versa: any existing namespace prohibits existence of an equally named attribute key in the future.

State

Out of curiosity, I looked at all the possible values for state:

state: idle | user | system | ...
state: used | cached | free | ...
state: idle, used (for database connection pool)
state: idle, user, system, interrupt, etc
state: used, free, cached, etc.
state: used, free, reserved
state: close, close_wait, closing, delete, established, fin_wait_1, fin_wait_2, last_ack, listen, syn_recv, syn_sent, time_wait.
state: system, user, wait
state: ok, degraded, failed
state: charging, discharging
state: ok, degraded, failed, charging, discharging
state: ok, degraded, failed, predicted_failure
state: ok, degraded, failed, open
state: remaining
state: ok, degraded, failed, needs_cleaning

@sebastien-rosset sebastien-rosset added the spec:metrics Related to the specification/metrics directory label Jan 23, 2023
@sebastien-rosset sebastien-rosset changed the title Attribute names in hardware semantic guidelines should be hierarchical Attribute names in semantic guidelines should be hierarchical Jan 25, 2023
@arminru arminru added the area:semantic-conventions Related to semantic conventions label Mar 28, 2023
@trask
Copy link
Member

trask commented Apr 21, 2023

  1. In process: state, direction, type.

I created PR #3431 to explore what namespaced metric attributes could look like for process metrics

@jmacd
Copy link
Contributor

jmacd commented May 9, 2023

I wonder if there's a way for us to preserve the short attribute names we have and add an attribute-namespace concept to be determined at the instrument-level, for example. A hardware metric can use "state" and we'll know that it's a hardware "state" because of perhaps a scope-level attribute ("attribute.namespace=hardware").

@dyladan
Copy link
Member

dyladan commented May 21, 2024

Attribute names are indeed namespaced now. If you have any examples not yet converted please open issues for them in the semconv repo.

@dyladan dyladan closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:semantic-conventions Related to semantic conventions spec:metrics Related to the specification/metrics directory
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants