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

Clarification on what an Event is, and what the event.domain and event.name attributes represent #2848

Merged
merged 12 commits into from
Nov 9, 2022
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ release.

- Add `Context` as argument to `LogRecordProcessor#onEmit`.
([#2927](https://github.com/open-telemetry/opentelemetry-specification/pull/2927))
- Clarification on what an Event is, and what the event.domain and event.name attributes represent
([#2848](https://github.com/open-telemetry/opentelemetry-specification/pull/2848))
scheler marked this conversation as resolved.
Show resolved Hide resolved

### Resource

Expand Down
7 changes: 3 additions & 4 deletions semantic_conventions/logs/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ groups:
examples: ['click', 'exception']
- id: domain
brief: >
The domain identifies the context in which an event happened. An event name is unique only within a domain.
The domain identifies the business context for the events.
type:
allow_custom_values: true
members:
Expand All @@ -27,6 +27,5 @@ groups:
brief: 'Events from Kubernetes'
requirement_level: required
note: |
An `event.name` is supposed to be unique only in the context of an
`event.domain`, so this allows for two events in different domains to
have same `event.name`, yet be unrelated events.
Events across different domains may have same `event.name`, yet be
scheler marked this conversation as resolved.
Show resolved Hide resolved
unrelated events.
35 changes: 28 additions & 7 deletions specification/logs/semantic_conventions/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,40 @@
**Status**: [Experimental](../../document-status.md)

This document describes the attributes of standalone Events that are represented
by `LogRecord`s. All standalone Events have a name and a domain. The Event domain
is a namespace for event names and is used as a mechanism to avoid conflicts of
in the data model by `LogRecord`s. Events are recorded as LogRecords that are shaped
in a special way:

- They have a LogRecord attribute `event.name` (and possibly other LogRecord attributes).
- They have an InstrumentationScope with a non-empty `Name` and with an
InstrumentationScope attribute `event.domain` (and possibly other InstrumentationScope attributes).
tigrannajaryan marked this conversation as resolved.
Show resolved Hide resolved

The `event.domain` attribute is used to logically separate events from different
systems. For example, to record Events from browser apps, mobile apps and
Kubernetes, we could use `browser`, `device` and `k8s` as the domain for their
Events. This provides a clean separation of semantics for events in each of the
domains.

Within a particular domain, the `event.name` attribute identifies the event.
Events with same domain and name are structurally similar to one another. For
example, some domains could have well-defined schema for their events based on
event names.

When recording events from an existing system as OpenTelemetry Events, it is
possible that the existing system does not have the equivalent of a name or
requires multiple fields to identify the structure of the events. In such cases,
OpenTelemetry recommends using a combination of one or more fields as the name
such that the name identifies the event structurally. It is also recommended that
the event names have low-cardinality, so care must be taken to not use fields
that identify the instance of the Event and not the class of Events.

<!-- semconv event -->
| Attribute | Type | Description | Examples | Requirement Level |
|---|---|---|---|---|
| `event.name` | string | The name identifies the event. | `click`; `exception` | Required |
| `event.domain` | string | The domain identifies the context in which an event happened. An event name is unique only within a domain. [1] | `browser` | Required |
| `event.domain` | string | The domain identifies the business context for the events. [1] | `browser` | Required |

**[1]:** An `event.name` is supposed to be unique only in the context of an
`event.domain`, so this allows for two events in different domains to
have same `event.name`, yet be unrelated events.
**[1]:** Events across different domains may have same `event.name`, yet be
unrelated events.

`event.domain` has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

Expand All @@ -24,4 +45,4 @@ have same `event.name`, yet be unrelated events.
| `browser` | Events from browser apps |
| `device` | Events from mobile apps |
| `k8s` | Events from Kubernetes |
<!-- endsemconv -->
<!-- endsemconv -->