-
Notifications
You must be signed in to change notification settings - Fork 931
Add minimum_severity
and trace_based
logger configuration parameters
#4612
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
base: main
Are you sure you want to change the base?
Changes from all commits
9df9ca2
29126d2
d8875ce
c0fdbd3
1cc275b
c68bba4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,8 @@ accommodate common use cases: | |
* Select one or more loggers by name, with exact match or pattern matching. | ||
* Disable one or more specific loggers. | ||
* Disable all loggers, and selectively enable one or more specific loggers. | ||
* Set the minimum severity levels for specific loggers or logger patterns. | ||
* Enable trace-based filtering for specific loggers or logger patterns. | ||
|
||
### Shutdown | ||
|
||
|
@@ -192,24 +194,61 @@ It consists of the following parameters: | |
If a `Logger` is disabled, it MUST behave equivalently | ||
to [No-op Logger](./noop.md#logger). | ||
|
||
The value of `disabled` MUST be used to resolve whether a `Logger` | ||
is [Enabled](./api.md#enabled). If `disabled` is `true`, `Enabled` | ||
returns `false`. If `disabled` is `false`, `Enabled` returns `true`. It is not | ||
necessary for implementations to ensure that changes to `disabled` are | ||
immediately visible to callers of `Enabled`. | ||
* `minimum_severity`: A [SeverityNumber](./data-model.md#field-severitynumber) | ||
indicating the minimum severity level for log records to be processed. | ||
|
||
If not explicitly set, the `minimum_severity` parameter MUST default to `0`. | ||
|
||
If a log record's [SeverityNumber](./data-model.md#field-severitynumber) is | ||
specified and less than the configured `minimum_severity`, the log record MUST | ||
be dropped by the `Logger`. Log records with an unspecified severity or severity set to `0` MUST NOT be | ||
affected by this parameter by default. | ||
|
||
* `trace_based`: A boolean indication of whether the logger should | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a more explicit name? is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there was some prior discussion around this name: #4290 (comment) though certainly we can change it if others feel similarly |
||
only process log records associated with sampled traces. | ||
|
||
If not explicitly set, the `trace_based` parameter MUST default to `false`. | ||
|
||
If `trace_based` is `true`, log records associated with unsampled traces MUST | ||
be dropped by the `Logger`. Log records that aren't associated with a trace | ||
trask marked this conversation as resolved.
Show resolved
Hide resolved
|
||
context are not affected by this parameter. | ||
|
||
It is not necessary for implementations to ensure that changes to any of these | ||
parameters are immediately visible to callers of `Enabled`. | ||
pellared marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Emit a LogRecord | ||
|
||
If [Observed Timestamp](./data-model.md#field-observedtimestamp) is unspecified, | ||
the implementation SHOULD set it equal to the current time. | ||
|
||
**Status**: [Development](../document-status.md) Before processing a log record, | ||
the implementation MUST apply the filtering rules defined by the | ||
[LoggerConfig](#loggerconfig) (in case `Enabled` was not called prior to | ||
emitting the record): | ||
|
||
1. **Minimum severity**: If the log record's | ||
[SeverityNumber](./data-model.md#field-severitynumber) is specified | ||
(i.e. not `0`) and is less than the configured `minimum_severity`, the log | ||
record MUST be dropped. | ||
|
||
2. **Trace-based**: If `trace_based` is `true`, and if the log record has a | ||
[`SpanId`](./data-model.md#field-spanid) and the | ||
[`TraceFlags`](./data-model.md#field-traceflags) SAMPLED flag is unset, | ||
the log record MUST be dropped. | ||
|
||
### Enabled | ||
|
||
`Enabled` MUST return `false` when either: | ||
|
||
- there are no registered [`LogRecordProcessors`](#logrecordprocessor), | ||
- there are no registered [`LogRecordProcessors`](#logrecordprocessor). | ||
- **Status**: [Development](../document-status.md) - `Logger` is disabled | ||
([`LoggerConfig.disabled`](#loggerconfig) is `true`), | ||
([`LoggerConfig.disabled`](#loggerconfig) is `true`). | ||
- **Status**: [Development](../document-status.md) - the provided severity | ||
(if specified) is less than the configured `minimum_severity` in the | ||
[`LoggerConfig`](#loggerconfig). | ||
- **Status**: [Development](../document-status.md) - `trace_based` is | ||
`true` in the [`LoggerConfig`](#loggerconfig) and the current context is | ||
associated with an unsampled trace. | ||
- **Status**: [Development](../document-status.md) - all registered | ||
`LogRecordProcessors` implement [`Enabled`](#enabled-1), | ||
and a call to `Enabled` on each of them returns `false`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see @lmolkova's concern here: #4612 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume @pellared's point is that
SHOULD NOT
is permissive enough so thatby default
is redundant. I still feel that 'by default' makes spec easier to read and explains intent for it to be configurable down the road, but if anyone feels strong about removing it, go ahead, I don't mind.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmolkova check out #4612 (comment)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch!
@pellared
sounds too restrictive - like we would never drop records with 0 severity (and would never have config option for it) - I don't want to close this door.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lmolkova
I do not agree. This is only describing the behavior of
minimum_severity
parameter.We can introduce another parameter in future e.g.
drop_unset_severity
if users want to drop log records with unspecified severity level. The behavior ofminimum_severity
should be consistent in all SDKs.