Skip to content

Commit

Permalink
organize operations
Browse files Browse the repository at this point in the history
  • Loading branch information
tedsuo committed Oct 16, 2024
1 parent 7663611 commit 2aa2b19
Showing 1 changed file with 41 additions and 28 deletions.
69 changes: 41 additions & 28 deletions specification/logs/bridge-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
- [LoggerProvider operations](#loggerprovider-operations)
- [Get a Logger](#get-a-logger)
- [Logger](#logger)
- [Logger operations](#logger-operations)
- [Log Bridge operations](#log-bridge-operations)
- [Emit a LogRecord](#emit-a-logrecord)
- [Enabled](#enabled)
- [Emit Event](#emit-event)
- [Log Instrumentation operations](#log-instrumentation-operations)
- [Emit an Event](#emit-an-event)
- [Optional and required parameters](#optional-and-required-parameters)
- [Concurrency requirements](#concurrency-requirements)
- [Artifact Naming](#artifact-naming)
Expand Down Expand Up @@ -93,18 +94,27 @@ instances where at least one parameter has a different value.

## Logger

The `Logger` is responsible for emitting `LogRecord`s.
The `Logger` is responsible for emitting `LogRecord`s. There are two types of
logging operations:

### Logger operations
* **Log Bridge** operations to be used when receiving data from other logging
libraries.
* **Log Instrumentation** operations to be used when writing instrumentation
for OpenTelemetry.
* **helper** operations to assist with using the logger.

The `Logger` MUST provide functions to:
The Logger contains methods for both types of operations. The `Logger` MUST
provide functions to:

- [Emit a `LogRecord`](#emit-a-logrecord)
- [Emit an `Event`](#emit-an-event)

The `Logger` SHOULD provide functions to:

- [Report if `Logger` is `Enabled`](#enabled)

### Log Bridge operations

#### Emit a LogRecord

The effect of calling this API is to emit a `LogRecord` to the processing pipeline.
Expand All @@ -123,6 +133,32 @@ The API MUST accept the following parameters:
- [Body](./data-model.md#field-body) (optional)
- [Attributes](./data-model.md#field-attributes) (optional)

### Log Instrumentation operations

#### Emit an Event

**Status**: [Development](../document-status.md)

Events are OpenTelemetry's standardized semantic formatting for LogRecords.
Beyond the structure provided by the LogRecord data model, it is helpful for
logs to have a common format within that structure. When OpenTelemetry
instrumentation emits logs, those logs SHOULD be formatted as Events.
All semantic conventions defined for logs MUST be formatted as Events.

**Parameters:**

* The `Name` of the Event, as described
in [event.name semantic conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/events.md).
* The (`AnyValue`) (optional) `Body` of the Event.
* The `Timestamp` (optional) of the Event.
* The [Context](../context/README.md) (optional) associated with the Event.
* The `SeverityNumber` (optional) of the Event.
* The `Attributes` (optional) of the Event. Event `Attributes` provide
additional details about the Event which are not part of the
well-defined event `Body`.

### Helper operations

#### Enabled

**Status**: [Development](../document-status.md)
Expand All @@ -146,29 +182,6 @@ The returned value is not always static, it can change over time. The API
SHOULD be documented that instrumentation authors needs to call this API each
time they [emit a LogRecord](#emit-a-logrecord) to ensure they have the most
up-to-date response.

#### Emit Event

**Status**: [Development](../document-status.md)

Events are OpenTelemetry's standardized semantic formatting for LogRecords.
Beyond the structure provided by the LogRecord data model, it is helpful for
logs to have a common format within that structure. When OpenTelemetry
instrumentation emits logs, those logs SHOULD be formatted as Events.
All semantic conventions defined for logs MUST be formatted as Events.

**Parameters:**

* The `Name` of the Event, as described
in [event.name semantic conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/general/events.md).
* The (`AnyValue`) (optional) `Body` of the Event.
* The `Timestamp` (optional) of the Event.
* The [Context](../context/README.md) (optional) associated with the Event.
* The `SeverityNumber` (optional) of the Event.
* The `Attributes` (optional) of the Event. Event `Attributes` provide
additional details about the Event which are not part of the
well-defined event `Body`.

## Optional and required parameters

The operations defined include various parameters, some of which are marked
Expand Down

0 comments on commit 2aa2b19

Please sign in to comment.