Skip to content

Commit

Permalink
Events and logs api (#2676)
Browse files Browse the repository at this point in the history
This PR is a follow up to the OTEP [Events and Logs API](https://github.com/open-telemetry/oteps/blob/main/text/0202-events-and-logs-api.md). It describes the specification for an Events and Logs API and also defines semantic conventions for attributes to be used for Events that are represented using Log Records.

For non-trivial changes, follow the [change proposal
process](../CONTRIBUTING.md#proposing-a-change) and link to the related issue(s)
and/or [OTEP(s)](https://github.com/open-telemetry/oteps), update the
[`CHANGELOG.md`](../CHANGELOG.md), and also be sure to update
[`spec-compliance-matrix.md`](../spec-compliance-matrix.md) if necessary.


Related [OTEP(s)](https://github.com/open-telemetry/oteps) #

[Events and Logs API](https://github.com/open-telemetry/oteps/blob/main/text/0202-events-and-logs-api.md)
  • Loading branch information
scheler authored Aug 31, 2022
1 parent db65960 commit 2503e77
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
32 changes: 32 additions & 0 deletions semantic_conventions/logs/events.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
groups:
- id: event
prefix: event
brief: >
This document defines attributes for Events represented using Log Records.
attributes:
- id: name
type: string
requirement_level: required
brief: >
The name identifies the event.
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.
type:
allow_custom_values: true
members:
- id: browser
value: 'browser'
brief: 'Events from browser apps'
- id: device
value: 'device'
brief: 'Events from mobile apps'
- id: k8s
value: 'k8s'
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.
4 changes: 4 additions & 0 deletions specification/logs/semantic_conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The following semantic conventions for logs are defined:

* [Log Media](media.md): Semantic attributes that may be used in describing the source of a log.

The following semantic conventions for events are defined:

* [Events](events.md): Semantic attributes that must be used to represent Events using log data model.

Apart from semantic conventions for logs, [traces](../../trace/semantic_conventions/README.md), and [metrics](../../metrics/semantic_conventions/README.md),
OpenTelemetry also defines the concept of overarching [Resources](../../resource/sdk.md) with their own
[Resource Semantic Conventions](../../resource/semantic_conventions/README.md).
27 changes: 27 additions & 0 deletions specification/logs/semantic_conventions/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Semantic Convention for event attributes

**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
event names.

<!-- 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 |

**[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.

`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.

| Value | Description |
|---|---|
| `browser` | Events from browser apps |
| `device` | Events from mobile apps |
| `k8s` | Events from Kubernetes |
<!-- endsemconv -->

0 comments on commit 2503e77

Please sign in to comment.