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

Update TraceConfig configuration option names #1824

Merged
merged 3 commits into from
Oct 18, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ Supported system properties and environment variables:
| System property | Environment variable | Purpose |
|----------------------------------|----------------------------------|-----------------------------------------------------------------------------------------------------|
| otel.config.sampler.probability | OTEL_CONFIG_SAMPLER_PROBABILITY | Sampler which is used when constructing a new span (default: 1) |
| otel.config.max.attrs | OTEL_CONFIG_MAX_ATTRS | Max number of attributes per span, extra will be dropped (default: 32) |
| otel.config.max.events | OTEL_CONFIG_MAX_EVENTS | Max number of Events per span, extra will be dropped (default: 128) |
| otel.config.max.links | OTEL_CONFIG_MAX_LINKS | Max number of Link entries per span, extra will be dropped (default: 32) |
| otel.span.attribute.count.limit | OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT | Max number of attributes per span, extra will be dropped (default: 1000) |
| otel.span.event.count.limit | OTEL_SPAN_EVENT_COUNT_LIMIT | Max number of Events per span, extra will be dropped (default: 1000) |
| otel.span.link.count.limit | OTEL_SPAN_LINK_COUNT_LIMIT | Max number of Link entries per span, extra will be dropped (default: 1000) |
| otel.config.max.event.attrs | OTEL_CONFIG_MAX_EVENT_ATTRS | Max number of attributes per event, extra will be dropped (default: 32) |
| otel.config.max.link.attrs | OTEL_CONFIG_MAX_LINK_ATTRS | Max number of attributes per link, extra will be dropped (default: 32) |
| otel.config.max.attr.length | OTEL_CONFIG_MAX_ATTR_LENGTH | Max length of string attribute value in characters, too long will be truncated (default: unlimited) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
* <ul>
* <li>{@code otel.config.sampler.probability}: to set the global default sampler which is used
* when constructing a new {@code Span}.
* <li>{@code otel.config.max.attrs}: to set the global default max number of attributes per
* <li>{@code otel.span.attribute.count.limit}: to set the global default max number of attributes
* per {@link Span}.
* <li>{@code otel.span.event.count.limit}: to set the global default max number of events per
* {@link Span}.
* <li>{@code otel.span.link.count.limit}: to set the global default max number of links per
* {@link Span}.
* <li>{@code otel.config.max.events}: to set the global default max number of events per {@link
* Span}.
* <li>{@code otel.config.max.links}: to set the global default max number of links per {@link
* Span}.
* <li>{@code otel.config.max.event.attrs}: to set the global default max number of attributes per
* event.
* <li>{@code otel.config.max.link.attrs}: to set the global default max number of attributes per
Expand All @@ -55,12 +55,12 @@
* <ul>
* <li>{@code OTEL_CONFIG_SAMPLER_PROBABILITY}: to set the global default sampler which is used
* when constructing a new {@code Span}.
* <li>{@code OTEL_CONFIG_MAX_ATTRS}: to set the global default max number of attributes per
* <li>{@code OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT}: to set the global default max number of attributes
* per {@link Span}.
* <li>{@code OTEL_SPAN_EVENT_COUNT_LIMIT}: to set the global default max number of events per
* {@link Span}.
* <li>{@code OTEL_SPAN_LINK_COUNT_LIMIT}: to set the global default max number of links per
* {@link Span}.
* <li>{@code OTEL_CONFIG_MAX_EVENTS}: to set the global default max number of events per {@link
* Span}.
* <li>{@code OTEL_CONFIG_MAX_LINKS}: to set the global default max number of links per {@link
* Span}.
* <li>{@code OTEL_CONFIG_MAX_EVENT_ATTRS}: to set the global default max number of attributes per
* event.
* <li>{@code OTEL_CONFIG_MAX_LINK_ATTRS}: to set the global default max number of attributes per
Expand All @@ -75,9 +75,9 @@ public abstract class TraceConfig {
// These values are the default values for all the global parameters.
// TODO: decide which default sampler to use
private static final Sampler DEFAULT_SAMPLER = Samplers.parentBased(Samplers.alwaysOn());
private static final int DEFAULT_SPAN_MAX_NUM_ATTRIBUTES = 32;
private static final int DEFAULT_SPAN_MAX_NUM_EVENTS = 128;
private static final int DEFAULT_SPAN_MAX_NUM_LINKS = 32;
private static final int DEFAULT_SPAN_MAX_NUM_ATTRIBUTES = 1000;
private static final int DEFAULT_SPAN_MAX_NUM_EVENTS = 1000;
private static final int DEFAULT_SPAN_MAX_NUM_LINKS = 1000;
private static final int DEFAULT_SPAN_MAX_NUM_ATTRIBUTES_PER_EVENT = 32;
private static final int DEFAULT_SPAN_MAX_NUM_ATTRIBUTES_PER_LINK = 32;

Expand Down Expand Up @@ -176,9 +176,9 @@ private static Builder builder() {
@AutoValue.Builder
public abstract static class Builder extends ConfigBuilder<Builder> {
private static final String KEY_SAMPLER_PROBABILITY = "otel.config.sampler.probability";
private static final String KEY_SPAN_MAX_NUM_ATTRIBUTES = "otel.config.max.attrs";
private static final String KEY_SPAN_MAX_NUM_EVENTS = "otel.config.max.events";
private static final String KEY_SPAN_MAX_NUM_LINKS = "otel.config.max.links";
private static final String KEY_SPAN_MAX_NUM_ATTRIBUTES = "otel.span.attribute.count.limit";
private static final String KEY_SPAN_MAX_NUM_EVENTS = "otel.span.event.count.limit";
private static final String KEY_SPAN_MAX_NUM_LINKS = "otel.span.link.count.limit";
dengliming marked this conversation as resolved.
Show resolved Hide resolved
private static final String KEY_SPAN_MAX_NUM_ATTRIBUTES_PER_EVENT =
"otel.config.max.event.attrs";
private static final String KEY_SPAN_MAX_NUM_ATTRIBUTES_PER_LINK = "otel.config.max.link.attrs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
* <ul>
* <li>{@code otel.config.sampler.probability}: to set the global default sampler which is used
* when constructing a new {@code Span}.
* <li>{@code otel.config.max.attrs}: to set the global default max number of attributes per
* <li>{@code otel.span.attribute.count.limit}: to set the global default max number of attributes
* per {@code Span}.
* <li>{@code otel.span.event.count.limit}: to set the global default max number of events per
* {@code Span}.
* <li>{@code otel.span.link.count.limit}: to set the global default max number of links per
* {@code Span}.
* <li>{@code otel.config.max.events}: to set the global default max number of events per {@code
* Span}.
* <li>{@code otel.config.max.links}: to set the global default max number of links per {@code
* Span}.
* <li>{@code otel.config.max.event.attrs}: to set the global default max number of attributes per
* event.
* <li>{@code otel.config.max.link.attrs}: to set the global default max number of attributes per
Expand All @@ -50,12 +50,12 @@
* <ul>
* <li>{@code OTEL_CONFIG_SAMPLER_PROBABILITY}: to set the global default sampler which is used
* when constructing a new {@code Span}.
* <li>{@code OTEL_CONFIG_MAX_ATTRS}: to set the global default max number of attributes per
* {@code Span}.
* <li>{@code OTEL_CONFIG_MAX_EVENTS}: to set the global default max number of events per {@code
* Span}.
* <li>{@code OTEL_CONFIG_MAX_LINKS}: to set the global default max number of links entries per
* <li>{@code OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT}: to set the global default max number of attributes
* per {@code Span}.
* <li>{@code OTEL_SPAN_EVENT_COUNT_LIMIT}: to set the global default max number of events per
* {@code Span}.
* <li>{@code OTEL_SPAN_LINK_COUNT_LIMIT}: to set the global default max number of links entries
* per {@code Span}.
* <li>{@code OTEL_CONFIG_MAX_EVENT_ATTRS}: to set the global default max number of attributes per
* event.
* <li>{@code OTEL_CONFIG_MAX_LINK_ATTRS}: to set the global default max number of attributes per
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ public class TraceConfigSystemPropertiesTest {
@AfterEach
void tearDown() {
System.clearProperty("otel.config.sampler.probability");
System.clearProperty("otel.config.max.attrs");
System.clearProperty("otel.config.max.events");
System.clearProperty("otel.config.max.links");
System.clearProperty("otel.span.attribute.count.limit");
System.clearProperty("otel.span.event.count.limit");
System.clearProperty("otel.span.link.count.limit");
System.clearProperty("otel.config.max.event.attrs");
System.clearProperty("otel.config.max.link.attrs");
}

@Test
void updateTraceConfig_SystemProperties() {
System.setProperty("otel.config.sampler.probability", "0.3");
System.setProperty("otel.config.max.attrs", "5");
System.setProperty("otel.config.max.events", "6");
System.setProperty("otel.config.max.links", "9");
System.setProperty("otel.span.attribute.count.limit", "5");
System.setProperty("otel.span.event.count.limit", "6");
System.setProperty("otel.span.link.count.limit", "9");
System.setProperty("otel.config.max.event.attrs", "7");
System.setProperty("otel.config.max.link.attrs", "11");
TraceConfig traceConfig =
Expand Down Expand Up @@ -58,23 +58,23 @@ void updateTraceConfig_InvalidSamplerProbability() {

@Test
void updateTraceConfig_NonPositiveMaxNumberOfAttributes() {
System.setProperty("otel.config.max.attrs", "-5");
System.setProperty("otel.span.attribute.count.limit", "-5");
assertThrows(
IllegalArgumentException.class,
() -> TraceConfig.getDefault().toBuilder().readSystemProperties().build());
}

@Test
void updateTraceConfig_NonPositiveMaxNumberOfEvents() {
System.setProperty("otel.config.max.events", "-6");
System.setProperty("otel.span.event.count.limit", "-6");
assertThrows(
IllegalArgumentException.class,
() -> TraceConfig.getDefault().toBuilder().readSystemProperties().build());
}

@Test
void updateTraceConfig_NonPositiveMaxNumberOfLinks() {
System.setProperty("otel.config.max.links", "-9");
System.setProperty("otel.span.link.count.limit", "-9");
assertThrows(
IllegalArgumentException.class,
() -> TraceConfig.getDefault().toBuilder().readSystemProperties().build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class TraceConfigTest {
void defaultTraceConfig() {
assertThat(TraceConfig.getDefault().getSampler().getDescription())
.isEqualTo(Samplers.parentBased(Samplers.alwaysOn()).getDescription());
assertThat(TraceConfig.getDefault().getMaxNumberOfAttributes()).isEqualTo(32);
assertThat(TraceConfig.getDefault().getMaxNumberOfEvents()).isEqualTo(128);
assertThat(TraceConfig.getDefault().getMaxNumberOfLinks()).isEqualTo(32);
assertThat(TraceConfig.getDefault().getMaxNumberOfAttributes()).isEqualTo(1000);
assertThat(TraceConfig.getDefault().getMaxNumberOfEvents()).isEqualTo(1000);
assertThat(TraceConfig.getDefault().getMaxNumberOfLinks()).isEqualTo(1000);
assertThat(TraceConfig.getDefault().getMaxNumberOfAttributesPerEvent()).isEqualTo(32);
assertThat(TraceConfig.getDefault().getMaxNumberOfAttributesPerLink()).isEqualTo(32);
}
Expand Down