Skip to content

Commit ea3111b

Browse files
authored
Define Enabled parameters for Logger (#4203)
1 parent 213b919 commit ea3111b

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ release.
2020

2121
### Logs
2222

23+
- Define `Enabled` parameters for `Logger`.
24+
([#4203](https://github.com/open-telemetry/opentelemetry-specification/pull/4203))
25+
2326
### Events
2427

2528
### Baggage

specification/logs/bridge-api.md

+26-14
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,17 @@ The effect of calling this API is to emit a `LogRecord` to the processing pipeli
119119

120120
The API MUST accept the following parameters:
121121

122-
- [Timestamp](./data-model.md#field-timestamp)
123-
- [Observed Timestamp](./data-model.md#field-observedtimestamp). If unspecified the
122+
- [Timestamp](./data-model.md#field-timestamp) (optional)
123+
- [Observed Timestamp](./data-model.md#field-observedtimestamp) (optional). If unspecified the
124124
implementation SHOULD set it equal to the current time.
125-
- The [Context](../context/README.md) associated with the `LogRecord`. The API
126-
MAY implicitly use the current Context as a default
127-
behavior.
128-
- [Severity Number](./data-model.md#field-severitynumber)
129-
- [Severity Text](./data-model.md#field-severitytext)
130-
- [Body](./data-model.md#field-body)
131-
- [Attributes](./data-model.md#field-attributes)
132-
133-
All parameters are optional.
125+
- The [Context](../context/README.md) associated with the `LogRecord`.
126+
When implicit Context is supported, then this parameter SHOULD be optional and
127+
if unspecified then MUST use current Context.
128+
When only explicit Context is supported, this parameter SHOULD be required.
129+
- [Severity Number](./data-model.md#field-severitynumber) (optional)
130+
- [Severity Text](./data-model.md#field-severitytext) (optional)
131+
- [Body](./data-model.md#field-body) (optional)
132+
- [Attributes](./data-model.md#field-attributes) (optional)
134133

135134
#### Enabled
136135

@@ -139,9 +138,22 @@ All parameters are optional.
139138
To help users avoid performing computationally expensive operations when
140139
generating a `LogRecord`, a `Logger` SHOULD provide this `Enabled` API.
141140

142-
There are currently no required parameters for this API. Parameters can be
143-
added in the future, therefore, the API MUST be structured in a way for
144-
parameters to be added.
141+
The API SHOULD accept the following parameters:
142+
143+
- The [Context](../context/README.md) to be associated with the `LogRecord`.
144+
When implicit Context is supported, then this parameter SHOULD be optional and
145+
if unspecified then MUST use current Context.
146+
When only explicit Context is supported, accepting this parameter is REQUIRED.
147+
- [Severity Number](./data-model.md#field-severitynumber) (optional)
148+
149+
Additional optional parameters can be added in the future, therefore,
150+
the API MUST be structured in a way for these parameters to be added.
151+
152+
It SHOULD be possible to distinguish between an unspecified parameter value from
153+
a parameter value set explicitly to a valid default value of given type
154+
(e.g. distinguish unspecified attributes for empty attributes). The exception
155+
from this rule is when the default value of given type is not seen as a valid
156+
value like 0 for [Severity Number](./data-model.md#field-severitynumber).
145157

146158
This API MUST return a language idiomatic boolean type. A returned value of
147159
`true` means the `Logger` is enabled for the provided arguments, and a returned

0 commit comments

Comments
 (0)