Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ public MetricReader create(DeclarativeConfigProperties config) {
prometheusBuilder.setHost(host);
}

Boolean withoutTargetInfo = config.getBoolean("without_target_info");
Boolean withoutTargetInfo = config.getBoolean("target_info_enabled/development");
if (withoutTargetInfo != null) {
prometheusBuilder.setTargetInfoMetricEnabled(!withoutTargetInfo);
}
Boolean withoutScopeInfo = config.getBoolean("without_scope_info");
Boolean withoutScopeInfo = config.getBoolean("scope_info_enabled");
if (withoutScopeInfo != null) {
prometheusBuilder.setOtelScopeLabelsEnabled(!withoutScopeInfo);
}

DeclarativeConfigProperties withResourceConstantLabels =
config.getStructured("with_resource_constant_labels");
config.getStructured("resource_constant_labels");
if (withResourceConstantLabels != null) {
List<String> included = withResourceConstantLabels.getScalarList("included", String.class);
List<String> excluded = withResourceConstantLabels.getScalarList("excluded", String.class);
Expand Down
2 changes: 1 addition & 1 deletion sdk-extensions/declarative-config/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dependencies {
// The generated POJOs are committed to src/main/java and are NOT regenerated as part of the normal build.
// To regenerate (e.g. after a schema update), run: ./gradlew :sdk-extensions:declarative-config:syncPojoModelsToSrc

val configurationTag = "1.0.0"
val configurationTag = "1.1.0"
val configurationRef = "refs/tags/v$configurationTag" // Replace with commit SHA to point to experiment with a specific commit
val configurationRepoZip = "https://github.com/open-telemetry/opentelemetry-configuration/archive/$configurationRef.zip"
val buildDirectory = layout.buildDirectory.asFile.get()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.autoconfigure.declarativeconfig;

import io.opentelemetry.sdk.autoconfigure.declarativeconfig.model.IdGeneratorModel;
import io.opentelemetry.sdk.trace.IdGenerator;

final class IdGeneratorFactory implements Factory<IdGeneratorModel, IdGenerator> {

private static final IdGeneratorFactory INSTANCE = new IdGeneratorFactory();

private IdGeneratorFactory() {}

static IdGeneratorFactory getInstance() {
return INSTANCE;
}

@Override
public IdGenerator create(IdGeneratorModel model, DeclarativeConfigContext context) {
// We don't use the variable till later but call validate first to confirm there are not
// multiple IdGenerators.
ConfigKeyValue processorKeyValue =
FileConfigUtil.validateSingleKeyValue(context, model, "id generator");

if (model.getRandom() != null) {
return IdGenerator.random();
}

return context.loadComponent(IdGenerator.class, processorKeyValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io.opentelemetry.sdk.autoconfigure.declarativeconfig.model.LogRecordExporterModel;
import io.opentelemetry.sdk.autoconfigure.declarativeconfig.model.LogRecordProcessorModel;
import io.opentelemetry.sdk.autoconfigure.declarativeconfig.model.SimpleLogRecordProcessorModel;
import io.opentelemetry.sdk.extension.incubator.logs.EventToSpanEventBridge;
import io.opentelemetry.sdk.logs.LogRecordProcessor;
import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor;
import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder;
Expand Down Expand Up @@ -42,6 +43,9 @@ public LogRecordProcessor create(
if (model.getSimple() != null) {
return createSimpleLogRecordProcessor(model.getSimple(), context);
}
if (model.getEventToSpanEventBridgeDevelopment() != null) {
return EventToSpanEventBridge.create();
}

return context.loadComponent(LogRecordProcessor.class, processorKeyValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.opentelemetry.sdk.metrics.export.MetricReader;
import io.opentelemetry.sdk.metrics.export.PeriodicMetricReader;
import io.opentelemetry.sdk.metrics.export.PeriodicMetricReaderBuilder;
import io.opentelemetry.sdk.metrics.internal.SdkMeterProviderUtil;
import java.time.Duration;

final class MetricReaderFactory
Expand Down Expand Up @@ -71,6 +72,10 @@ public MetricReaderAndCardinalityLimits create(
cardinalityLimitSelector =
CardinalityLimitsFactory.getInstance().create(model.getCardinalityLimits(), context);
}
if (model.getMaxExportBatchSizeDevelopment() != null) {
SdkMeterProviderUtil.setMaxExportBatchSize(
builder, model.getMaxExportBatchSizeDevelopment());
}

MetricReader reader = context.addCloseable(builder.build());
return MetricReaderAndCardinalityLimits.create(reader, cardinalityLimitSelector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ final class OpenTelemetryConfigurationFactory

private static final Logger logger =
Logger.getLogger(OpenTelemetryConfigurationFactory.class.getName());
private static final Pattern SUPPORTED_FILE_FORMATS = Pattern.compile("^(0.4)|(1.0(-rc.\\d*)?)$");
private static final String EXPECTED_FILE_FORMAT = "1.0";
private static final Pattern SUPPORTED_FILE_FORMATS =
Pattern.compile("^(0.4)|(1.\\d+(-rc.\\d+)?)$");
private static final String EXPECTED_FILE_FORMAT = "1.1";

private static final OpenTelemetryConfigurationFactory INSTANCE =
new OpenTelemetryConfigurationFactory();
Expand All @@ -52,7 +53,7 @@ public DeclarativeConfigResult create(
String fileFormat = model.getFileFormat();
if (fileFormat == null || !SUPPORTED_FILE_FORMATS.matcher(fileFormat).matches()) {
throw new DeclarativeConfigException(
"Unsupported file format '" + fileFormat + "'. Supported formats include 0.4, 1.0*");
"Unsupported file format '" + fileFormat + "'. Supported formats include 0.4, 1.*");
}
if (!EXPECTED_FILE_FORMAT.equals(fileFormat)) {
logger.warning(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public SdkTracerProviderBuilder create(
SpanProcessorFactory.getInstance().create(processor, context)));
}

if (tracerProviderModel.getIdGenerator() != null) {
builder.setIdGenerator(
IdGeneratorFactory.getInstance().create(tracerProviderModel.getIdGenerator(), context));
}

ExperimentalTracerConfiguratorModel tracerConfiguratorModel =
tracerProviderModel.getTracerConfiguratorDevelopment();
if (tracerConfiguratorModel != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public class AttributeNameValueModel {
private String name;

/**
* The attribute value. The type of value must match .type. Property is required and must be
* non-null.
* The attribute value. The type of value must match .type. Property must be present, but if null
* the entry is ignored.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With POJOs checked into VCS now, its cool /useful to see these diffs as we update to the new version of the schema

*
* <p>(Required)
*/
@JsonProperty("value")
@JsonPropertyDescription(
"The attribute value.\nThe type of value must match .type.\nProperty is required and must be non-null.\n")
"The attribute value.\nThe type of value must match .type.\nProperty must be present, but if null the entry is ignored.\n")
@Nonnull
private Object value;

Expand All @@ -67,8 +67,8 @@ public AttributeNameValueModel withName(String name) {
}

/**
* The attribute value. The type of value must match .type. Property is required and must be
* non-null.
* The attribute value. The type of value must match .type. Property must be present, but if null
* the entry is ignored.
*
* <p>(Required)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@ public class ExperimentalComposableRuleBasedSamplerRuleAttributePatternsModel {
private String key;

/**
* Configure list of value patterns to include. Values are evaluated to match as follows: * If the
* value exactly matches. * If the value matches the wildcard pattern, where '?' matches any
* single character and '*' matches any number of characters including none. If omitted, all
* values are included.
* Configure list of value patterns to include. Matching is case-sensitive. Values are evaluated
* to match as follows: * If the value exactly matches. * If the value matches the wildcard
* pattern, where '?' matches any single character and '*' matches any number of characters
* including none. If omitted, all values are included.
*
* <p>(Can be null)
*/
@Nullable
@JsonProperty("included")
@JsonPropertyDescription(
"Configure list of value patterns to include.\nValues are evaluated to match as follows:\n * If the value exactly matches.\n * If the value matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nIf omitted, all values are included.\n")
"Configure list of value patterns to include.\nMatching is case-sensitive. Values are evaluated to match as follows:\n * If the value exactly matches.\n * If the value matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nIf omitted, all values are included.\n")
private List<String> included;

/**
* Configure list of value patterns to exclude. Applies after .included (i.e. excluded has higher
* priority than included). Values are evaluated to match as follows: * If the value exactly
* matches. * If the value matches the wildcard pattern, where '?' matches any single character
* and '*' matches any number of characters including none. If omitted, .included attributes are
* included.
* priority than included). Matching is case-sensitive. Values are evaluated to match as follows:
* * If the value exactly matches. * If the value matches the wildcard pattern, where '?' matches
* any single character and '*' matches any number of characters including none. If omitted,
* .included attributes are included.
*
* <p>(Can be null)
*/
@Nullable
@JsonProperty("excluded")
@JsonPropertyDescription(
"Configure list of value patterns to exclude. Applies after .included (i.e. excluded has higher priority than included).\nValues are evaluated to match as follows:\n * If the value exactly matches.\n * If the value matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nIf omitted, .included attributes are included.\n")
"Configure list of value patterns to exclude. Applies after .included (i.e. excluded has higher priority than included).\nMatching is case-sensitive. Values are evaluated to match as follows:\n * If the value exactly matches.\n * If the value matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nIf omitted, .included attributes are included.\n")
private List<String> excluded;

/**
Expand All @@ -77,10 +77,10 @@ public ExperimentalComposableRuleBasedSamplerRuleAttributePatternsModel withKey(
}

/**
* Configure list of value patterns to include. Values are evaluated to match as follows: * If the
* value exactly matches. * If the value matches the wildcard pattern, where '?' matches any
* single character and '*' matches any number of characters including none. If omitted, all
* values are included.
* Configure list of value patterns to include. Matching is case-sensitive. Values are evaluated
* to match as follows: * If the value exactly matches. * If the value matches the wildcard
* pattern, where '?' matches any single character and '*' matches any number of characters
* including none. If omitted, all values are included.
*/
@JsonProperty("included")
@Nullable
Expand All @@ -96,10 +96,10 @@ public ExperimentalComposableRuleBasedSamplerRuleAttributePatternsModel withIncl

/**
* Configure list of value patterns to exclude. Applies after .included (i.e. excluded has higher
* priority than included). Values are evaluated to match as follows: * If the value exactly
* matches. * If the value matches the wildcard pattern, where '?' matches any single character
* and '*' matches any number of characters including none. If omitted, .included attributes are
* included.
* priority than included). Matching is case-sensitive. Values are evaluated to match as follows:
* * If the value exactly matches. * If the value matches the wildcard pattern, where '?' matches
* any single character and '*' matches any number of characters including none. If omitted,
* .included attributes are included.
*/
@JsonProperty("excluded")
@Nullable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.sdk.autoconfigure.declarativeconfig.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import javax.annotation.Generated;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({})
@Generated("jsonschema2pojo")
@SuppressWarnings({"NullAway", "rawtypes", "BoxedPrimitiveEquality"})
public class ExperimentalEventToSpanEventBridgeLogRecordProcessorModel {

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(ExperimentalEventToSpanEventBridgeLogRecordProcessorModel.class.getName())
.append('@')
.append(Integer.toHexString(System.identityHashCode(this)))
.append('[');
if (sb.charAt((sb.length() - 1)) == ',') {
sb.setCharAt((sb.length() - 1), ']');
} else {
sb.append(']');
}
return sb.toString();
}

@Override
public int hashCode() {
int result = 1;
return result;
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof ExperimentalEventToSpanEventBridgeLogRecordProcessorModel) == false) {
return false;
}
ExperimentalEventToSpanEventBridgeLogRecordProcessorModel rhs =
((ExperimentalEventToSpanEventBridgeLogRecordProcessorModel) other);
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class ExperimentalLoggerMatcherAndConfigModel {

/**
* Configure logger names to match, evaluated as follows:
* Configure logger names to match. Matching is case-sensitive, evaluated as follows:
*
* <p>* If the logger name exactly matches. * If the logger name matches the wildcard pattern,
* where '?' matches any single character and '*' matches any number of characters including none.
Expand All @@ -30,7 +30,7 @@ public class ExperimentalLoggerMatcherAndConfigModel {
*/
@JsonProperty("name")
@JsonPropertyDescription(
"Configure logger names to match, evaluated as follows:\n\n * If the logger name exactly matches.\n * If the logger name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nProperty is required and must be non-null.\n")
"Configure logger names to match. Matching is case-sensitive, evaluated as follows:\n\n * If the logger name exactly matches.\n * If the logger name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nProperty is required and must be non-null.\n")
@Nonnull
private String name;

Expand All @@ -40,7 +40,7 @@ public class ExperimentalLoggerMatcherAndConfigModel {
private ExperimentalLoggerConfigModel config;

/**
* Configure logger names to match, evaluated as follows:
* Configure logger names to match. Matching is case-sensitive, evaluated as follows:
*
* <p>* If the logger name exactly matches. * If the logger name matches the wildcard pattern,
* where '?' matches any single character and '*' matches any number of characters including none.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
public class ExperimentalMeterMatcherAndConfigModel {

/**
* Configure meter names to match, evaluated as follows:
* Configure meter names to match. Matching is case-sensitive, evaluated as follows:
*
* <p>* If the meter name exactly matches. * If the meter name matches the wildcard pattern, where
* '?' matches any single character and '*' matches any number of characters including none.
Expand All @@ -30,7 +30,7 @@ public class ExperimentalMeterMatcherAndConfigModel {
*/
@JsonProperty("name")
@JsonPropertyDescription(
"Configure meter names to match, evaluated as follows:\n\n * If the meter name exactly matches.\n * If the meter name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nProperty is required and must be non-null.\n")
"Configure meter names to match. Matching is case-sensitive, evaluated as follows:\n\n * If the meter name exactly matches.\n * If the meter name matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nProperty is required and must be non-null.\n")
@Nonnull
private String name;

Expand All @@ -40,7 +40,7 @@ public class ExperimentalMeterMatcherAndConfigModel {
private ExperimentalMeterConfigModel config;

/**
* Configure meter names to match, evaluated as follows:
* Configure meter names to match. Matching is case-sensitive, evaluated as follows:
*
* <p>* If the meter name exactly matches. * If the meter name matches the wildcard pattern, where
* '?' matches any single character and '*' matches any number of characters including none.
Expand Down
Loading
Loading