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

Add log attribute limit configuration #2861

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ release.

### SDK Configuration

- Add log-specific attribute limit configuration and clarify that general
attribute limit configuration also apply to log records.
([#2861](https://github.com/open-telemetry/opentelemetry-specification/pull/2861))

### Telemetry Schemas

### Common
Expand Down
10 changes: 5 additions & 5 deletions specification/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ limits programmatically. Names of the configuration options SHOULD be the same a
in the list below.

An SDK MAY implement model-specific limits, for example
`SpanAttributeCountLimit`. If both a general and a model-specific limit are
implemented, then the SDK MUST first attempt to use the model-specific limit, if
it isn't set, then the SDK MUST attempt to use the general limit. If neither are
defined, then the SDK MUST try to use the model-specific limit default value,
followed by the global limit default value.
`SpanAttributeCountLimit` or `LogRecordAttributeCountLimit`. If both a general
and a model-specific limit are implemented, then the SDK MUST first attempt to
use the model-specific limit, if it isn't set, then the SDK MUST attempt to use
the general limit. If neither are defined, then the SDK MUST try to use the
model-specific limit default value, followed by the global limit default value.

#### Configurable Parameters

Expand Down
31 changes: 31 additions & 0 deletions specification/logs/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- [Additional LogRecord interfaces](#additional-logrecord-interfaces)
* [ReadableLogRecord](#readablelogrecord)
* [ReadWriteLogRecord](#readwritelogrecord)
- [LogRecord Limits](#logrecord-limits)
- [LogRecordProcessor](#logrecordprocessor)
* [LogRecordProcessor operations](#logrecordprocessor-operations)
+ [OnEmit](#onemit)
Expand Down Expand Up @@ -130,6 +131,36 @@ information
that was added to the `LogRecord` (as with
[ReadableLogRecord](#readablelogrecord)).

## LogRecord Limits

`LogRecord` attributes MUST adhere to the [common rules of attribute limits](../common/README.md#attribute-limits).
djaglowski marked this conversation as resolved.
Show resolved Hide resolved

If the SDK implements attribute limits it MUST provide a way to change these
limits, via a configuration to the `LoggerProvider`, by allowing users to
configure individual limits like in the Java example below.

The options MAY be bundled in a class, which then SHOULD be called
`LogRecordLimits`.

```java
public final class LogRecordLimits {
LogRecordLimits(int attributeCountLimit, int attributeValueLengthLimit);

public int getAttributeCountLimit();

public int getAttributeValueLengthLimit();
}
```

**Configurable parameters:**

* [all common options applicable to attributes](../common/README.md#configurable-parameters)

There SHOULD be a log emitted to indicate to the user that an attribute was
discarded due to such a limit. To prevent excessive logging, the log
should be emitted at most once per log record (i.e., not per discarded
attribute.)
alanwest marked this conversation as resolved.
Show resolved Hide resolved

## LogRecordProcessor

`LogRecordProcessor` is an interface which allows hooks for `LogRecord`
Expand Down
13 changes: 12 additions & 1 deletion specification/sdk-environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ See the SDK [Attribute Limits](common/README.md#attribute-limits) section for th
| Name | Description | Default | Notes |
| --------------------------------- | ------------------------------------ | ------- | ----- |
| OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT | Maximum allowed attribute value size | | Empty value is treated as infinity. Non-integer and negative values are invalid. |
| OTEL_ATTRIBUTE_COUNT_LIMIT | Maximum allowed span attribute count | 128 | |
| OTEL_ATTRIBUTE_COUNT_LIMIT | Maximum allowed attribute count | 128 | |

## Span Limits

Expand All @@ -137,6 +137,17 @@ See the SDK [Span Limits](trace/sdk.md#span-limits) section for the definition o
| OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT | Maximum allowed attribute per span event count | 128 | |
| OTEL_LINK_ATTRIBUTE_COUNT_LIMIT | Maximum allowed attribute per span link count | 128 | |

## LogRecord Limits

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

See the SDK [LogRecord Limits](logs/sdk.md#logrecord-limits) section for the definition of the limits.

| Name | Description | Default | Notes |
| ------------------------------------------- | -------------------------------------------| ------- | ----- |
| OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT | Maximum allowed attribute value size | | Empty value is treated as infinity. Non-integer and negative values are invalid. |
| OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT | Maximum allowed log record attribute count | 128 | |
tigrannajaryan marked this conversation as resolved.
Show resolved Hide resolved

## OTLP Exporter

See [OpenTelemetry Protocol Exporter Configuration Options](./protocol/exporter.md).
Expand Down
21 changes: 12 additions & 9 deletions specification/trace/sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,23 +377,25 @@ Following configuration properties should be available when creating the sampler

Span attributes MUST adhere to the [common rules of attribute limits](../common/README.md#attribute-limits).

If the SDK implements attribute limits it MUST provide a way to change these
limits, via a configuration to the `TracerProvider`, by allowing users to
configure individual limits like in the Java example below.

SDK Spans MAY also discard links and events that would increase the number of
elements of each collection beyond the configured limit.

If the SDK implements the limits above it MUST provide a way to change these
limits, via a configuration to the TracerProvider, by allowing users to
configure individual limits like in the Java example bellow.

The name of the configuration options SHOULD be `EventCountLimit` and `LinkCountLimit`. The options MAY be bundled in a class,
which then SHOULD be called `SpanLimits`. Implementations MAY provide additional
configuration such as `AttributePerEventCountLimit` and `AttributePerLinkCountLimit`.
The options MAY be bundled in a class, which then SHOULD be called `SpanLimits`.
Implementations MAY provide additional configuration such as
`AttributePerEventCountLimit` and `AttributePerLinkCountLimit`.
tigrannajaryan marked this conversation as resolved.
Show resolved Hide resolved

```java
public final class SpanLimits {
SpanLimits(int attributeCountLimit, int linkCountLimit, int eventCountLimit);
SpanLimits(int attributeCountLimit, int attributeValueLengthLimit, int linkCountLimit, int eventCountLimit);
tigrannajaryan marked this conversation as resolved.
Show resolved Hide resolved

public int getAttributeCountLimit();

public int getAttributeValueLengthLimit();

public int getAttributeCountPerEventLimit();

public int getAttributeCountPerLinkLimit();
Expand All @@ -414,7 +416,8 @@ public final class SpanLimits {

There SHOULD be a log emitted to indicate to the user that an attribute, event,
or link was discarded due to such a limit. To prevent excessive logging, the log
should not be emitted once per span, or per discarded attribute, event, or links.
should be emitted at most once per span (i.e., not per discarded attribute,
event, or link).
tigrannajaryan marked this conversation as resolved.
Show resolved Hide resolved

## Id Generators

Expand Down