diff --git a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java index 7fd5d515f4c..06722b8cb18 100644 --- a/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java +++ b/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java @@ -551,7 +551,7 @@ private static AutoConfiguredOpenTelemetrySdk maybeConfigureFromFile(ConfigPrope Object model = parse.invoke(null, fis); Class openTelemetryConfiguration = Class.forName( - "io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfiguration"); + "io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel"); Method create = configurationFactory.getMethod("create", openTelemetryConfiguration); OpenTelemetrySdk sdk = (OpenTelemetrySdk) create.invoke(null, model); Method toConfigProperties = diff --git a/sdk-extensions/incubator/build.gradle.kts b/sdk-extensions/incubator/build.gradle.kts index f562360655e..b7c50f4dee1 100644 --- a/sdk-extensions/incubator/build.gradle.kts +++ b/sdk-extensions/incubator/build.gradle.kts @@ -100,6 +100,9 @@ jsonSchema2Pojo { // Force java 9+ @Generated annotation, since java 8 @Generated annotation isn't detected by // jsonSchema2Pojo and annotation is skipped altogether targetVersion = "1.9" + + // Append Model as suffix to the generated classes. + classNameSuffix = "Model" } val generateJsonSchema2Pojo = tasks.getByName("generateJsonSchema2Pojo") diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactory.java index 45feb74c8cc..6e35ecbdbfb 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactory.java @@ -7,14 +7,14 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Aggregation; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Base2ExponentialBucketHistogram; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogram; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AggregationModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Base2ExponentialBucketHistogramModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogramModel; import java.io.Closeable; import java.util.List; final class AggregationFactory - implements Factory { + implements Factory { private static final AggregationFactory INSTANCE = new AggregationFactory(); @@ -26,7 +26,7 @@ static AggregationFactory getInstance() { @Override public io.opentelemetry.sdk.metrics.Aggregation create( - Aggregation model, SpiHelper spiHelper, List closeables) { + AggregationModel model, SpiHelper spiHelper, List closeables) { if (model.getDrop() != null) { return io.opentelemetry.sdk.metrics.Aggregation.drop(); } @@ -36,7 +36,7 @@ public io.opentelemetry.sdk.metrics.Aggregation create( if (model.getLastValue() != null) { return io.opentelemetry.sdk.metrics.Aggregation.lastValue(); } - Base2ExponentialBucketHistogram exponentialBucketHistogram = + Base2ExponentialBucketHistogramModel exponentialBucketHistogram = model.getBase2ExponentialBucketHistogram(); if (exponentialBucketHistogram != null) { Integer maxScale = exponentialBucketHistogram.getMaxScale(); @@ -54,7 +54,7 @@ public io.opentelemetry.sdk.metrics.Aggregation create( throw new ConfigurationException("Invalid exponential bucket histogram", e); } } - ExplicitBucketHistogram explicitBucketHistogram = model.getExplicitBucketHistogram(); + ExplicitBucketHistogramModel explicitBucketHistogram = model.getExplicitBucketHistogram(); if (explicitBucketHistogram != null) { List boundaries = explicitBucketHistogram.getBoundaries(); if (boundaries == null) { diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AttributesFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AttributesFactory.java index 70cd2e186ae..a45031a85f3 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AttributesFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AttributesFactory.java @@ -11,12 +11,12 @@ import io.opentelemetry.api.common.AttributesBuilder; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Attributes; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributesModel; import java.io.Closeable; import java.util.List; final class AttributesFactory - implements Factory { + implements Factory { private static final AttributesFactory INSTANCE = new AttributesFactory(); @@ -28,7 +28,7 @@ static AttributesFactory getInstance() { @Override public io.opentelemetry.api.common.Attributes create( - Attributes model, SpiHelper spiHelper, List closeables) { + AttributesModel model, SpiHelper spiHelper, List closeables) { AttributesBuilder builder = io.opentelemetry.api.common.Attributes.builder(); String serviceName = model.getServiceName(); diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfiguration.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfiguration.java index ec7fe6407ac..06ab3cc755c 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfiguration.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfiguration.java @@ -14,8 +14,8 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfiguration; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sampler; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SamplerModel; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; @@ -68,12 +68,12 @@ public final class FileConfiguration { private FileConfiguration() {} /** - * Combines {@link #parse(InputStream)} and {@link #create(OpenTelemetryConfiguration)}. + * Combines {@link #parse(InputStream)} and {@link #create(OpenTelemetryConfigurationModel)}. * * @throws ConfigurationException if unable to parse or interpret */ public static OpenTelemetrySdk parseAndCreate(InputStream inputStream) { - OpenTelemetryConfiguration configurationModel = parse(inputStream); + OpenTelemetryConfigurationModel configurationModel = parse(inputStream); return create(configurationModel); } @@ -85,7 +85,7 @@ public static OpenTelemetrySdk parseAndCreate(InputStream inputStream) { * @return the {@link OpenTelemetrySdk} * @throws ConfigurationException if unable to interpret */ - public static OpenTelemetrySdk create(OpenTelemetryConfiguration configurationModel) { + public static OpenTelemetrySdk create(OpenTelemetryConfigurationModel configurationModel) { return createAndMaybeCleanup( OpenTelemetryConfigurationFactory.getInstance(), SpiHelper.create(FileConfiguration.class.getClassLoader()), @@ -93,14 +93,14 @@ public static OpenTelemetrySdk create(OpenTelemetryConfiguration configurationMo } /** - * Parse the {@code configuration} YAML and return the {@link OpenTelemetryConfiguration}. + * Parse the {@code configuration} YAML and return the {@link OpenTelemetryConfigurationModel}. * *

Before parsing, environment variable substitution is performed as described in {@link * EnvSubstitutionConstructor}. * * @throws ConfigurationException if unable to parse */ - public static OpenTelemetryConfiguration parse(InputStream configuration) { + public static OpenTelemetryConfigurationModel parse(InputStream configuration) { try { return parse(configuration, System.getenv()); } catch (RuntimeException e) { @@ -109,10 +109,10 @@ public static OpenTelemetryConfiguration parse(InputStream configuration) { } // Visible for testing - static OpenTelemetryConfiguration parse( + static OpenTelemetryConfigurationModel parse( InputStream configuration, Map environmentVariables) { Object yamlObj = loadYaml(configuration, environmentVariables); - return MAPPER.convertValue(yamlObj, OpenTelemetryConfiguration.class); + return MAPPER.convertValue(yamlObj, OpenTelemetryConfigurationModel.class); } // Visible for testing @@ -128,7 +128,8 @@ static Object loadYaml(InputStream inputStream, Map environmentV * @param model the configuration model * @return a generic {@link StructuredConfigProperties} representation of the model */ - public static StructuredConfigProperties toConfigProperties(OpenTelemetryConfiguration model) { + public static StructuredConfigProperties toConfigProperties( + OpenTelemetryConfigurationModel model) { return toConfigProperties((Object) model); } @@ -150,18 +151,18 @@ static StructuredConfigProperties toConfigProperties(Object model) { } /** - * Create a {@link Sampler} from the {@code samplerModel} representing the sampler config. + * Create a {@link SamplerModel} from the {@code samplerModel} representing the sampler config. * *

This is used when samplers are composed, with one sampler accepting one or more additional * samplers as config properties. The {@link ComponentProvider} implementation can call this to - * configure a delegate {@link Sampler} from the {@link StructuredConfigProperties} corresponding - * to a particular config property. + * configure a delegate {@link SamplerModel} from the {@link StructuredConfigProperties} + * corresponding to a particular config property. */ // TODO(jack-berg): add create methods for all SDK extension components supported by // ComponentProvider public static io.opentelemetry.sdk.trace.samplers.Sampler createSampler( StructuredConfigProperties genericSamplerModel) { - Sampler samplerModel = convertToModel(genericSamplerModel, Sampler.class); + SamplerModel samplerModel = convertToModel(genericSamplerModel, SamplerModel.class); return createAndMaybeCleanup( SamplerFactory.getInstance(), SpiHelper.create(FileConfiguration.class.getClassLoader()), diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/InstrumentSelectorFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/InstrumentSelectorFactory.java index f89a94ea507..767908c6595 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/InstrumentSelectorFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/InstrumentSelectorFactory.java @@ -7,14 +7,14 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Selector; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SelectorModel; import io.opentelemetry.sdk.metrics.InstrumentSelector; import io.opentelemetry.sdk.metrics.InstrumentSelectorBuilder; import io.opentelemetry.sdk.metrics.InstrumentType; import java.io.Closeable; import java.util.List; -final class InstrumentSelectorFactory implements Factory { +final class InstrumentSelectorFactory implements Factory { private static final InstrumentSelectorFactory INSTANCE = new InstrumentSelectorFactory(); @@ -26,7 +26,7 @@ static InstrumentSelectorFactory getInstance() { @Override public InstrumentSelector create( - Selector model, SpiHelper spiHelper, List closeables) { + SelectorModel model, SpiHelper spiHelper, List closeables) { InstrumentSelectorBuilder builder = InstrumentSelector.builder(); if (model.getInstrumentName() != null) { builder.setName(model.getInstrumentName()); diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogLimitsFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogLimitsFactory.java index 765fdd5100e..a2f4ba2e6c4 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogLimitsFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogLimitsFactory.java @@ -6,8 +6,8 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimits; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimitsModel; import io.opentelemetry.sdk.logs.LogLimits; import io.opentelemetry.sdk.logs.LogLimitsBuilder; import java.io.Closeable; @@ -28,7 +28,7 @@ public LogLimits create( LogRecordLimitsAndAttributeLimits model, SpiHelper spiHelper, List closeables) { LogLimitsBuilder builder = LogLimits.builder(); - AttributeLimits attributeLimitsModel = model.getAttributeLimits(); + AttributeLimitsModel attributeLimitsModel = model.getAttributeLimits(); if (attributeLimitsModel != null) { if (attributeLimitsModel.getAttributeCountLimit() != null) { builder.setMaxNumberOfAttributes(attributeLimitsModel.getAttributeCountLimit()); @@ -38,7 +38,7 @@ public LogLimits create( } } - LogRecordLimits logRecordLimitsModel = model.getLogRecordLimits(); + LogRecordLimitsModel logRecordLimitsModel = model.getLogRecordLimits(); if (logRecordLimitsModel != null) { if (logRecordLimitsModel.getAttributeCountLimit() != null) { builder.setMaxNumberOfAttributes(logRecordLimitsModel.getAttributeCountLimit()); diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordExporterFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordExporterFactory.java index 58ce105eddd..05be1719dbb 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordExporterFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordExporterFactory.java @@ -9,16 +9,14 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; import io.opentelemetry.sdk.logs.export.LogRecordExporter; import java.io.Closeable; import java.util.List; import java.util.Map; -final class LogRecordExporterFactory - implements Factory< - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporter, - LogRecordExporter> { +final class LogRecordExporterFactory implements Factory { private static final LogRecordExporterFactory INSTANCE = new LogRecordExporterFactory(); @@ -30,10 +28,8 @@ static LogRecordExporterFactory getInstance() { @Override public LogRecordExporter create( - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporter model, - SpiHelper spiHelper, - List closeables) { - Otlp otlpModel = model.getOtlp(); + LogRecordExporterModel model, SpiHelper spiHelper, List closeables) { + OtlpModel otlpModel = model.getOtlp(); if (otlpModel != null) { model.getAdditionalProperties().put("otlp", otlpModel); } diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordLimitsAndAttributeLimits.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordLimitsAndAttributeLimits.java index ffcb42cdd48..bfea53b9a0e 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordLimitsAndAttributeLimits.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordLimitsAndAttributeLimits.java @@ -6,21 +6,21 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import com.google.auto.value.AutoValue; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimits; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimitsModel; import javax.annotation.Nullable; @AutoValue abstract class LogRecordLimitsAndAttributeLimits { static LogRecordLimitsAndAttributeLimits create( - @Nullable AttributeLimits attributeLimits, @Nullable LogRecordLimits spanLimits) { + @Nullable AttributeLimitsModel attributeLimits, @Nullable LogRecordLimitsModel spanLimits) { return new AutoValue_LogRecordLimitsAndAttributeLimits(attributeLimits, spanLimits); } @Nullable - abstract AttributeLimits getAttributeLimits(); + abstract AttributeLimitsModel getAttributeLimits(); @Nullable - abstract LogRecordLimits getLogRecordLimits(); + abstract LogRecordLimitsModel getLogRecordLimits(); } diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordProcessorFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordProcessorFactory.java index 882db7db24f..a9cec70455a 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordProcessorFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordProcessorFactory.java @@ -9,7 +9,10 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporter; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleLogRecordProcessorModel; import io.opentelemetry.sdk.logs.LogRecordProcessor; import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessor; import io.opentelemetry.sdk.logs.export.BatchLogRecordProcessorBuilder; @@ -20,9 +23,7 @@ import java.util.Map; final class LogRecordProcessorFactory - implements Factory< - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessor, - LogRecordProcessor> { + implements Factory { private static final LogRecordProcessorFactory INSTANCE = new LogRecordProcessorFactory(); @@ -34,13 +35,10 @@ static LogRecordProcessorFactory getInstance() { @Override public LogRecordProcessor create( - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessor model, - SpiHelper spiHelper, - List closeables) { - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessor - batchModel = model.getBatch(); + LogRecordProcessorModel model, SpiHelper spiHelper, List closeables) { + BatchLogRecordProcessorModel batchModel = model.getBatch(); if (batchModel != null) { - LogRecordExporter exporterModel = + LogRecordExporterModel exporterModel = FileConfigUtil.requireNonNull( batchModel.getExporter(), "batch log record processor exporter"); @@ -62,10 +60,9 @@ public LogRecordProcessor create( return FileConfigUtil.addAndReturn(closeables, builder.build()); } - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleLogRecordProcessor - simpleModel = model.getSimple(); + SimpleLogRecordProcessorModel simpleModel = model.getSimple(); if (simpleModel != null) { - LogRecordExporter exporterModel = + LogRecordExporterModel exporterModel = FileConfigUtil.requireNonNull( simpleModel.getExporter(), "simple log record processor exporter"); io.opentelemetry.sdk.logs.export.LogRecordExporter logRecordExporter = diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderAndAttributeLimits.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderAndAttributeLimits.java index 43263c0972b..06abbb623f3 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderAndAttributeLimits.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderAndAttributeLimits.java @@ -6,21 +6,22 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import com.google.auto.value.AutoValue; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProvider; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProviderModel; import javax.annotation.Nullable; @AutoValue abstract class LoggerProviderAndAttributeLimits { static LoggerProviderAndAttributeLimits create( - @Nullable AttributeLimits attributeLimits, @Nullable LoggerProvider loggerProvider) { + @Nullable AttributeLimitsModel attributeLimits, + @Nullable LoggerProviderModel loggerProvider) { return new AutoValue_LoggerProviderAndAttributeLimits(attributeLimits, loggerProvider); } @Nullable - abstract AttributeLimits getAttributeLimits(); + abstract AttributeLimitsModel getAttributeLimits(); @Nullable - abstract LoggerProvider getLoggerProvider(); + abstract LoggerProviderModel getLoggerProvider(); } diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderFactory.java index 3d46098ae9e..ceb208697a2 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderFactory.java @@ -6,8 +6,8 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProvider; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProviderModel; import io.opentelemetry.sdk.logs.LogLimits; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.logs.SdkLoggerProviderBuilder; @@ -30,7 +30,7 @@ public SdkLoggerProviderBuilder create( LoggerProviderAndAttributeLimits model, SpiHelper spiHelper, List closeables) { SdkLoggerProviderBuilder builder = SdkLoggerProvider.builder(); - LoggerProvider loggerProviderModel = model.getLoggerProvider(); + LoggerProviderModel loggerProviderModel = model.getLoggerProvider(); if (loggerProviderModel == null) { return builder; } @@ -44,7 +44,7 @@ public SdkLoggerProviderBuilder create( closeables); builder.setLogLimits(() -> logLimits); - List processors = loggerProviderModel.getProcessors(); + List processors = loggerProviderModel.getProcessors(); if (processors != null) { processors.forEach( processor -> diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MeterProviderFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MeterProviderFactory.java index c675920a797..dd400eeeb1e 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MeterProviderFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MeterProviderFactory.java @@ -8,17 +8,17 @@ import static io.opentelemetry.sdk.extension.incubator.fileconfig.FileConfigUtil.requireNonNull; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MeterProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Selector; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Stream; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.View; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MeterProviderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SelectorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.StreamModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ViewModel; import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.metrics.SdkMeterProviderBuilder; import java.io.Closeable; import java.util.List; -final class MeterProviderFactory implements Factory { +final class MeterProviderFactory implements Factory { private static final MeterProviderFactory INSTANCE = new MeterProviderFactory(); @@ -30,10 +30,10 @@ static MeterProviderFactory getInstance() { @Override public SdkMeterProviderBuilder create( - MeterProvider model, SpiHelper spiHelper, List closeables) { + MeterProviderModel model, SpiHelper spiHelper, List closeables) { SdkMeterProviderBuilder builder = SdkMeterProvider.builder(); - List readerModels = model.getReaders(); + List readerModels = model.getReaders(); if (readerModels != null) { readerModels.forEach( readerModel -> { @@ -45,12 +45,12 @@ public SdkMeterProviderBuilder create( }); } - List viewModels = model.getViews(); + List viewModels = model.getViews(); if (viewModels != null) { viewModels.forEach( viewModel -> { - Selector selector = requireNonNull(viewModel.getSelector(), "view selector"); - Stream stream = requireNonNull(viewModel.getStream(), "view stream"); + SelectorModel selector = requireNonNull(viewModel.getSelector(), "view selector"); + StreamModel stream = requireNonNull(viewModel.getStream(), "view stream"); builder.registerView( InstrumentSelectorFactory.getInstance().create(selector, spiHelper, closeables), ViewFactory.getInstance().create(stream, spiHelper, closeables)); diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricExporterFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricExporterFactory.java index f614761728a..cfda507de32 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricExporterFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricExporterFactory.java @@ -9,16 +9,14 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetricModel; import io.opentelemetry.sdk.metrics.export.MetricExporter; import java.io.Closeable; import java.util.List; import java.util.Map; -final class MetricExporterFactory - implements Factory< - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporter, - MetricExporter> { +final class MetricExporterFactory implements Factory { private static final MetricExporterFactory INSTANCE = new MetricExporterFactory(); @@ -30,10 +28,8 @@ static MetricExporterFactory getInstance() { @Override public MetricExporter create( - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporter model, - SpiHelper spiHelper, - List closeables) { - OtlpMetric otlpModel = model.getOtlp(); + MetricExporterModel model, SpiHelper spiHelper, List closeables) { + OtlpMetricModel otlpModel = model.getOtlp(); if (otlpModel != null) { model.getAdditionalProperties().put("otlp", otlpModel); } diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricReaderFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricReaderFactory.java index 00f3dfa17a0..1041d50ec6c 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricReaderFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricReaderFactory.java @@ -9,20 +9,18 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Prometheus; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PullMetricReader; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PrometheusModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PullMetricReaderModel; import io.opentelemetry.sdk.metrics.export.MetricReader; import io.opentelemetry.sdk.metrics.export.PeriodicMetricReaderBuilder; import java.io.Closeable; import java.time.Duration; import java.util.List; -final class MetricReaderFactory - implements Factory< - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReader, - MetricReader> { +final class MetricReaderFactory implements Factory { private static final MetricReaderFactory INSTANCE = new MetricReaderFactory(); @@ -34,12 +32,10 @@ static MetricReaderFactory getInstance() { @Override public MetricReader create( - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReader model, - SpiHelper spiHelper, - List closeables) { - PeriodicMetricReader periodicModel = model.getPeriodic(); + MetricReaderModel model, SpiHelper spiHelper, List closeables) { + PeriodicMetricReaderModel periodicModel = model.getPeriodic(); if (periodicModel != null) { - MetricExporter exporterModel = + MetricExporterModel exporterModel = requireNonNull(periodicModel.getExporter(), "periodic metric reader exporter"); io.opentelemetry.sdk.metrics.export.MetricExporter metricExporter = MetricExporterFactory.getInstance().create(exporterModel, spiHelper, closeables); @@ -52,11 +48,11 @@ public MetricReader create( return FileConfigUtil.addAndReturn(closeables, builder.build()); } - PullMetricReader pullModel = model.getPull(); + PullMetricReaderModel pullModel = model.getPull(); if (pullModel != null) { - MetricExporter exporterModel = + MetricExporterModel exporterModel = requireNonNull(pullModel.getExporter(), "pull metric reader exporter"); - Prometheus prometheusModel = exporterModel.getPrometheus(); + PrometheusModel prometheusModel = exporterModel.getPrometheus(); if (prometheusModel != null) { MetricReader metricReader = FileConfigUtil.loadComponent( diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactory.java index 1677361d8ae..0213839ee30 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactory.java @@ -9,14 +9,14 @@ import io.opentelemetry.sdk.OpenTelemetrySdkBuilder; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfiguration; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel; import io.opentelemetry.sdk.resources.Resource; import java.io.Closeable; import java.util.List; import java.util.Objects; final class OpenTelemetryConfigurationFactory - implements Factory { + implements Factory { private static final OpenTelemetryConfigurationFactory INSTANCE = new OpenTelemetryConfigurationFactory(); @@ -29,7 +29,7 @@ static OpenTelemetryConfigurationFactory getInstance() { @Override public OpenTelemetrySdk create( - OpenTelemetryConfiguration model, SpiHelper spiHelper, List closeables) { + OpenTelemetryConfigurationModel model, SpiHelper spiHelper, List closeables) { OpenTelemetrySdkBuilder builder = OpenTelemetrySdk.builder(); if (!"0.1".equals(model.getFileFormat())) { throw new ConfigurationException("Unsupported file format. Supported formats include: 0.1"); diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/PropagatorFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/PropagatorFactory.java index d9572fd8406..c53b6699062 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/PropagatorFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/PropagatorFactory.java @@ -10,11 +10,11 @@ import io.opentelemetry.context.propagation.ContextPropagators; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Propagator; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PropagatorModel; import java.io.Closeable; import java.util.List; -final class PropagatorFactory implements Factory { +final class PropagatorFactory implements Factory { private static final PropagatorFactory INSTANCE = new PropagatorFactory(); @@ -26,7 +26,7 @@ static PropagatorFactory getInstance() { @Override public ContextPropagators create( - Propagator model, SpiHelper spiHelper, List closeables) { + PropagatorModel model, SpiHelper spiHelper, List closeables) { List compositeModel = requireNonNull(model.getComposite(), "composite propagator"); TextMapPropagator textMapPropagator = TextMapPropagatorFactory.getInstance().create(compositeModel, spiHelper, closeables); diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ResourceFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ResourceFactory.java index eaaf1ae98b3..f2d5da54fc2 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ResourceFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ResourceFactory.java @@ -10,7 +10,7 @@ import io.opentelemetry.sdk.autoconfigure.spi.Ordered; import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Attributes; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributesModel; import io.opentelemetry.sdk.resources.Resource; import java.io.Closeable; import java.util.ArrayList; @@ -21,7 +21,8 @@ final class ResourceFactory implements Factory< - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Resource, Resource> { + io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ResourceModel, + Resource> { private static final StructuredConfigProperties EMPTY_CONFIG = FileConfiguration.toConfigProperties(Collections.emptyMap()); @@ -35,7 +36,7 @@ static ResourceFactory getInstance() { @Override public Resource create( - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Resource model, + io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ResourceModel model, SpiHelper spiHelper, List closeables) { Resource result = Resource.getDefault(); @@ -45,7 +46,7 @@ public Resource create( result = result.merge(resourceProviderResource); } - Attributes attributesModel = model.getAttributes(); + AttributesModel attributesModel = model.getAttributes(); if (attributesModel != null) { result = result.toBuilder() diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SamplerFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SamplerFactory.java index 2f8c3bc4520..0b38631e0db 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SamplerFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SamplerFactory.java @@ -9,18 +9,17 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.JaegerRemote; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ParentBased; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TraceIdRatioBased; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.JaegerRemoteModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ParentBasedModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SamplerModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TraceIdRatioBasedModel; import io.opentelemetry.sdk.trace.samplers.ParentBasedSamplerBuilder; import io.opentelemetry.sdk.trace.samplers.Sampler; import java.io.Closeable; import java.util.List; import java.util.Map; -final class SamplerFactory - implements Factory< - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sampler, Sampler> { +final class SamplerFactory implements Factory { private static final SamplerFactory INSTANCE = new SamplerFactory(); @@ -31,17 +30,14 @@ static SamplerFactory getInstance() { } @Override - public Sampler create( - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sampler model, - SpiHelper spiHelper, - List closeables) { + public Sampler create(SamplerModel model, SpiHelper spiHelper, List closeables) { if (model.getAlwaysOn() != null) { return Sampler.alwaysOn(); } if (model.getAlwaysOff() != null) { return Sampler.alwaysOff(); } - TraceIdRatioBased traceIdRatioBasedModel = model.getTraceIdRatioBased(); + TraceIdRatioBasedModel traceIdRatioBasedModel = model.getTraceIdRatioBased(); if (traceIdRatioBasedModel != null) { Double ratio = traceIdRatioBasedModel.getRatio(); if (ratio == null) { @@ -49,7 +45,7 @@ public Sampler create( } return Sampler.traceIdRatioBased(ratio); } - ParentBased parentBasedModel = model.getParentBased(); + ParentBasedModel parentBasedModel = model.getParentBased(); if (parentBasedModel != null) { Sampler root = parentBasedModel.getRoot() == null @@ -77,7 +73,7 @@ public Sampler create( return builder.build(); } - JaegerRemote jaegerRemoteModel = model.getJaegerRemote(); + JaegerRemoteModel jaegerRemoteModel = model.getJaegerRemote(); if (jaegerRemoteModel != null) { model.getAdditionalProperties().put("jaeger_remote", jaegerRemoteModel); } diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanExporterFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanExporterFactory.java index a48af93fb75..652b3917acf 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanExporterFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanExporterFactory.java @@ -9,17 +9,15 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Zipkin; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ZipkinModel; import io.opentelemetry.sdk.trace.export.SpanExporter; import java.io.Closeable; import java.util.List; import java.util.Map; -final class SpanExporterFactory - implements Factory< - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporter, - SpanExporter> { +final class SpanExporterFactory implements Factory { private static final SpanExporterFactory INSTANCE = new SpanExporterFactory(); @@ -31,10 +29,8 @@ static SpanExporterFactory getInstance() { @Override public SpanExporter create( - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporter model, - SpiHelper spiHelper, - List closeables) { - Otlp otlpModel = model.getOtlp(); + SpanExporterModel model, SpiHelper spiHelper, List closeables) { + OtlpModel otlpModel = model.getOtlp(); if (otlpModel != null) { model.getAdditionalProperties().put("otlp", otlpModel); } @@ -43,7 +39,7 @@ public SpanExporter create( model.getAdditionalProperties().put("console", model.getConsole()); } - Zipkin zipkinModel = model.getZipkin(); + ZipkinModel zipkinModel = model.getZipkin(); if (zipkinModel != null) { model.getAdditionalProperties().put("zipkin", model.getZipkin()); } diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsAndAttributeLimits.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsAndAttributeLimits.java index 26049538a58..dad8dab1019 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsAndAttributeLimits.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsAndAttributeLimits.java @@ -6,21 +6,21 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import com.google.auto.value.AutoValue; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanLimits; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanLimitsModel; import javax.annotation.Nullable; @AutoValue abstract class SpanLimitsAndAttributeLimits { static SpanLimitsAndAttributeLimits create( - @Nullable AttributeLimits attributeLimits, @Nullable SpanLimits spanLimits) { + @Nullable AttributeLimitsModel attributeLimits, @Nullable SpanLimitsModel spanLimits) { return new AutoValue_SpanLimitsAndAttributeLimits(attributeLimits, spanLimits); } @Nullable - abstract AttributeLimits getAttributeLimits(); + abstract AttributeLimitsModel getAttributeLimits(); @Nullable - abstract SpanLimits getSpanLimits(); + abstract SpanLimitsModel getSpanLimits(); } diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsFactory.java index b3e83b7a2ba..b669c99bf06 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsFactory.java @@ -6,8 +6,8 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanLimits; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanLimitsModel; import io.opentelemetry.sdk.trace.SpanLimitsBuilder; import java.io.Closeable; import java.util.List; @@ -28,7 +28,7 @@ public io.opentelemetry.sdk.trace.SpanLimits create( SpanLimitsAndAttributeLimits model, SpiHelper spiHelper, List closeables) { SpanLimitsBuilder builder = io.opentelemetry.sdk.trace.SpanLimits.builder(); - AttributeLimits attributeLimitsModel = model.getAttributeLimits(); + AttributeLimitsModel attributeLimitsModel = model.getAttributeLimits(); if (attributeLimitsModel != null) { if (attributeLimitsModel.getAttributeCountLimit() != null) { builder.setMaxNumberOfAttributes(attributeLimitsModel.getAttributeCountLimit()); @@ -38,7 +38,7 @@ public io.opentelemetry.sdk.trace.SpanLimits create( } } - SpanLimits spanLimitsModel = model.getSpanLimits(); + SpanLimitsModel spanLimitsModel = model.getSpanLimits(); if (spanLimitsModel != null) { if (spanLimitsModel.getAttributeCountLimit() != null) { builder.setMaxNumberOfAttributes(spanLimitsModel.getAttributeCountLimit()); diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanProcessorFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanProcessorFactory.java index 9d2e4362078..04a5a144303 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanProcessorFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanProcessorFactory.java @@ -9,7 +9,10 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporter; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleSpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessorModel; import io.opentelemetry.sdk.trace.SpanProcessor; import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; import io.opentelemetry.sdk.trace.export.BatchSpanProcessorBuilder; @@ -19,10 +22,7 @@ import java.util.List; import java.util.Map; -final class SpanProcessorFactory - implements Factory< - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessor, - SpanProcessor> { +final class SpanProcessorFactory implements Factory { private static final SpanProcessorFactory INSTANCE = new SpanProcessorFactory(); @@ -34,13 +34,10 @@ static SpanProcessorFactory getInstance() { @Override public SpanProcessor create( - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessor model, - SpiHelper spiHelper, - List closeables) { - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessor - batchModel = model.getBatch(); + SpanProcessorModel model, SpiHelper spiHelper, List closeables) { + BatchSpanProcessorModel batchModel = model.getBatch(); if (batchModel != null) { - SpanExporter exporterModel = + SpanExporterModel exporterModel = FileConfigUtil.requireNonNull(batchModel.getExporter(), "batch span processor exporter"); io.opentelemetry.sdk.trace.export.SpanExporter spanExporter = SpanExporterFactory.getInstance().create(exporterModel, spiHelper, closeables); @@ -60,10 +57,9 @@ public SpanProcessor create( return FileConfigUtil.addAndReturn(closeables, builder.build()); } - io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleSpanProcessor - simpleModel = model.getSimple(); + SimpleSpanProcessorModel simpleModel = model.getSimple(); if (simpleModel != null) { - SpanExporter exporterModel = + SpanExporterModel exporterModel = FileConfigUtil.requireNonNull( simpleModel.getExporter(), "simple span processor exporter"); io.opentelemetry.sdk.trace.export.SpanExporter spanExporter = diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderAndAttributeLimits.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderAndAttributeLimits.java index afc1a41a66e..bcc73943b63 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderAndAttributeLimits.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderAndAttributeLimits.java @@ -6,21 +6,22 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import com.google.auto.value.AutoValue; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProvider; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProviderModel; import javax.annotation.Nullable; @AutoValue abstract class TracerProviderAndAttributeLimits { static TracerProviderAndAttributeLimits create( - @Nullable AttributeLimits attributeLimits, @Nullable TracerProvider tracerProvider) { + @Nullable AttributeLimitsModel attributeLimits, + @Nullable TracerProviderModel tracerProvider) { return new AutoValue_TracerProviderAndAttributeLimits(attributeLimits, tracerProvider); } @Nullable - abstract AttributeLimits getAttributeLimits(); + abstract AttributeLimitsModel getAttributeLimits(); @Nullable - abstract TracerProvider getTracerProvider(); + abstract TracerProviderModel getTracerProvider(); } diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderFactory.java index ff8000806c7..8634710b2c6 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderFactory.java @@ -6,8 +6,8 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProvider; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProviderModel; import io.opentelemetry.sdk.trace.SdkTracerProvider; import io.opentelemetry.sdk.trace.SdkTracerProviderBuilder; import io.opentelemetry.sdk.trace.SpanLimits; @@ -30,7 +30,7 @@ static TracerProviderFactory getInstance() { public SdkTracerProviderBuilder create( TracerProviderAndAttributeLimits model, SpiHelper spiHelper, List closeables) { SdkTracerProviderBuilder builder = SdkTracerProvider.builder(); - TracerProvider tracerProviderModel = model.getTracerProvider(); + TracerProviderModel tracerProviderModel = model.getTracerProvider(); if (tracerProviderModel == null) { return builder; } @@ -51,7 +51,7 @@ public SdkTracerProviderBuilder create( builder.setSampler(sampler); } - List processors = tracerProviderModel.getProcessors(); + List processors = tracerProviderModel.getProcessors(); if (processors != null) { processors.forEach( processor -> diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactory.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactory.java index cb23d699ecc..fecc4a81c59 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactory.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactory.java @@ -6,14 +6,14 @@ package io.opentelemetry.sdk.extension.incubator.fileconfig; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Stream; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.StreamModel; import io.opentelemetry.sdk.metrics.View; import io.opentelemetry.sdk.metrics.ViewBuilder; import java.io.Closeable; import java.util.HashSet; import java.util.List; -final class ViewFactory implements Factory { +final class ViewFactory implements Factory { private static final ViewFactory INSTANCE = new ViewFactory(); @@ -24,7 +24,7 @@ static ViewFactory getInstance() { } @Override - public View create(Stream model, SpiHelper spiHelper, List closeables) { + public View create(StreamModel model, SpiHelper spiHelper, List closeables) { ViewBuilder builder = View.builder(); if (model.getName() != null) { builder.setName(model.getName()); diff --git a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigProperties.java b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigProperties.java index bc74b333cd4..04c432ce8a7 100644 --- a/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigProperties.java +++ b/sdk-extensions/incubator/src/main/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigProperties.java @@ -10,7 +10,7 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfiguration; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; @@ -54,7 +54,7 @@ private YamlStructuredConfigProperties( * com.fasterxml.jackson.databind.ObjectMapper}), and have values which are scalars, lists of * scalars, lists of maps, and maps. * - * @see FileConfiguration#toConfigProperties(OpenTelemetryConfiguration) + * @see FileConfiguration#toConfigProperties(OpenTelemetryConfigurationModel) */ @SuppressWarnings("unchecked") static YamlStructuredConfigProperties create(Map properties) { diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactoryTest.java index 8e7dafad412..0efe2691b0a 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AggregationFactoryTest.java @@ -9,12 +9,12 @@ import static org.mockito.Mockito.mock; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Aggregation; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Base2ExponentialBucketHistogram; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Drop; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogram; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LastValue; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sum; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AggregationModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Base2ExponentialBucketHistogramModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.DropModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogramModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LastValueModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SumModel; import java.util.ArrayList; import java.util.Arrays; import java.util.stream.Stream; @@ -26,7 +26,7 @@ class AggregationFactoryTest { @ParameterizedTest @MethodSource("createTestCases") - void create(Aggregation model, io.opentelemetry.sdk.metrics.Aggregation expectedResult) { + void create(AggregationModel model, io.opentelemetry.sdk.metrics.Aggregation expectedResult) { io.opentelemetry.sdk.metrics.Aggregation aggregation = AggregationFactory.getInstance().create(model, mock(SpiHelper.class), new ArrayList<>()); assertThat(aggregation.toString()).isEqualTo(expectedResult.toString()); @@ -35,32 +35,34 @@ void create(Aggregation model, io.opentelemetry.sdk.metrics.Aggregation expected private static Stream createTestCases() { return Stream.of( Arguments.of( - new Aggregation(), io.opentelemetry.sdk.metrics.Aggregation.defaultAggregation()), + new AggregationModel(), io.opentelemetry.sdk.metrics.Aggregation.defaultAggregation()), Arguments.of( - new Aggregation().withDrop(new Drop()), + new AggregationModel().withDrop(new DropModel()), io.opentelemetry.sdk.metrics.Aggregation.drop()), Arguments.of( - new Aggregation().withSum(new Sum()), io.opentelemetry.sdk.metrics.Aggregation.sum()), + new AggregationModel().withSum(new SumModel()), + io.opentelemetry.sdk.metrics.Aggregation.sum()), Arguments.of( - new Aggregation().withLastValue(new LastValue()), + new AggregationModel().withLastValue(new LastValueModel()), io.opentelemetry.sdk.metrics.Aggregation.lastValue()), Arguments.of( - new Aggregation() - .withBase2ExponentialBucketHistogram(new Base2ExponentialBucketHistogram()), + new AggregationModel() + .withBase2ExponentialBucketHistogram(new Base2ExponentialBucketHistogramModel()), io.opentelemetry.sdk.metrics.Aggregation.base2ExponentialBucketHistogram()), Arguments.of( - new Aggregation() + new AggregationModel() .withBase2ExponentialBucketHistogram( - new Base2ExponentialBucketHistogram().withMaxSize(2).withMaxScale(2)), + new Base2ExponentialBucketHistogramModel().withMaxSize(2).withMaxScale(2)), io.opentelemetry.sdk.metrics.Aggregation.base2ExponentialBucketHistogram(2, 2)), Arguments.of( - new Aggregation() - .withExplicitBucketHistogram(new ExplicitBucketHistogram().withBoundaries(null)), + new AggregationModel() + .withExplicitBucketHistogram( + new ExplicitBucketHistogramModel().withBoundaries(null)), io.opentelemetry.sdk.metrics.Aggregation.explicitBucketHistogram()), Arguments.of( - new Aggregation() + new AggregationModel() .withExplicitBucketHistogram( - new ExplicitBucketHistogram().withBoundaries(Arrays.asList(1.0, 2.0))), + new ExplicitBucketHistogramModel().withBoundaries(Arrays.asList(1.0, 2.0))), io.opentelemetry.sdk.metrics.Aggregation.explicitBucketHistogram( Arrays.asList(1.0, 2.0)))); } diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AttributesFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AttributesFactoryTest.java index e50fa61209d..5bd8e42a540 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AttributesFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/AttributesFactoryTest.java @@ -11,7 +11,7 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Attributes; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributesModel; import java.util.Arrays; import java.util.Collections; import java.util.stream.Stream; @@ -24,7 +24,7 @@ class AttributesFactoryTest { @ParameterizedTest @MethodSource("invalidAttributes") - void create_InvalidAttributes(Attributes model, String expectedMessage) { + void create_InvalidAttributes(AttributesModel model, String expectedMessage) { assertThatThrownBy( () -> AttributesFactory.getInstance() @@ -36,16 +36,16 @@ void create_InvalidAttributes(Attributes model, String expectedMessage) { private static Stream invalidAttributes() { return Stream.of( Arguments.of( - new Attributes().withAdditionalProperty("key", null), + new AttributesModel().withAdditionalProperty("key", null), "Error processing attribute with key \"key\": unexpected null value"), Arguments.of( - new Attributes().withAdditionalProperty("key", new Object()), + new AttributesModel().withAdditionalProperty("key", new Object()), "Error processing attribute with key \"key\": unrecognized value type java.lang.Object"), Arguments.of( - new Attributes().withAdditionalProperty("key", Arrays.asList(1L, 1)), + new AttributesModel().withAdditionalProperty("key", Arrays.asList(1L, 1)), "Error processing attribute with key \"key\": expected value entries to be of type class java.lang.Long but found entry with type class java.lang.Integer"), Arguments.of( - new Attributes().withAdditionalProperty("key", Arrays.asList(1L, null)), + new AttributesModel().withAdditionalProperty("key", Arrays.asList(1L, null)), "Error processing attribute with key \"key\": unexpected null element in value")); } @@ -54,7 +54,7 @@ void create() { assertThat( AttributesFactory.getInstance() .create( - new Attributes() + new AttributesModel() .withServiceName("my-service") .withAdditionalProperty("strKey", "val") .withAdditionalProperty("longKey", 1L) diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java index bfb0fe09f1b..0c03bdbd751 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/FileConfigurationParseTest.java @@ -9,44 +9,43 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Aggregation; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOff; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOn; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Attributes; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Console; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogram; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Headers; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MeterProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfiguration; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric.DefaultHistogramAggregation; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ParentBased; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Prometheus; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Propagator; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PullMetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Resource; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sampler; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Selector; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleSpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Stream; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TraceIdRatioBased; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.View; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Zipkin; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AggregationModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOffModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOnModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributesModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ConsoleModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogramModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.HeadersModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProviderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MeterProviderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetricModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ParentBasedModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PrometheusModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PropagatorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PullMetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ResourceModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SamplerModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SelectorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleSpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.StreamModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TraceIdRatioBasedModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProviderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ViewModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ZipkinModel; import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.IOException; @@ -76,32 +75,33 @@ void parse_BadInputStream() { @Test void parse_KitchenSinkExampleFile() throws IOException { - OpenTelemetryConfiguration expected = new OpenTelemetryConfiguration(); + OpenTelemetryConfigurationModel expected = new OpenTelemetryConfigurationModel(); expected.withFileFormat("0.1"); expected.withDisabled(false); // General config - Resource resource = - new Resource().withAttributes(new Attributes().withServiceName("unknown_service")); + ResourceModel resource = + new ResourceModel() + .withAttributes(new AttributesModel().withServiceName("unknown_service")); expected.withResource(resource); - AttributeLimits attributeLimits = - new AttributeLimits().withAttributeValueLengthLimit(4096).withAttributeCountLimit(128); + AttributeLimitsModel attributeLimits = + new AttributeLimitsModel().withAttributeValueLengthLimit(4096).withAttributeCountLimit(128); expected.withAttributeLimits(attributeLimits); - Propagator propagator = - new Propagator() + PropagatorModel propagator = + new PropagatorModel() .withComposite( Arrays.asList( "tracecontext", "baggage", "b3", "b3multi", "jaeger", "xray", "ottrace")); expected.withPropagator(propagator); // TracerProvider config - TracerProvider tracerProvider = new TracerProvider(); + TracerProviderModel tracerProvider = new TracerProviderModel(); - SpanLimits spanLimits = - new SpanLimits() + SpanLimitsModel spanLimits = + new SpanLimitsModel() .withAttributeValueLengthLimit(4096) .withAttributeCountLimit(128) .withEventCountLimit(128) @@ -110,86 +110,90 @@ void parse_KitchenSinkExampleFile() throws IOException { .withLinkAttributeCountLimit(128); tracerProvider.withLimits(spanLimits); - Sampler sampler = - new Sampler() + SamplerModel sampler = + new SamplerModel() .withParentBased( - new ParentBased() + new ParentBasedModel() .withRoot( - new Sampler() - .withTraceIdRatioBased(new TraceIdRatioBased().withRatio(0.0001))) - .withRemoteParentSampled(new Sampler().withAlwaysOn(new AlwaysOn())) - .withRemoteParentNotSampled(new Sampler().withAlwaysOff(new AlwaysOff())) - .withLocalParentSampled(new Sampler().withAlwaysOn(new AlwaysOn())) - .withLocalParentNotSampled(new Sampler().withAlwaysOff(new AlwaysOff()))); + new SamplerModel() + .withTraceIdRatioBased(new TraceIdRatioBasedModel().withRatio(0.0001))) + .withRemoteParentSampled(new SamplerModel().withAlwaysOn(new AlwaysOnModel())) + .withRemoteParentNotSampled( + new SamplerModel().withAlwaysOff(new AlwaysOffModel())) + .withLocalParentSampled(new SamplerModel().withAlwaysOn(new AlwaysOnModel())) + .withLocalParentNotSampled( + new SamplerModel().withAlwaysOff(new AlwaysOffModel()))); tracerProvider.withSampler(sampler); - SpanProcessor spanProcessor1 = - new SpanProcessor() + SpanProcessorModel spanProcessor1 = + new SpanProcessorModel() .withBatch( - new BatchSpanProcessor() + new BatchSpanProcessorModel() .withScheduleDelay(5_000) .withExportTimeout(30_000) .withMaxQueueSize(2048) .withMaxExportBatchSize(512) .withExporter( - new SpanExporter() + new SpanExporterModel() .withOtlp( - new Otlp() + new OtlpModel() .withProtocol("http/protobuf") .withEndpoint("http://localhost:4318") .withCertificate("/app/cert.pem") .withClientKey("/app/cert.pem") .withClientCertificate("/app/cert.pem") .withHeaders( - new Headers().withAdditionalProperty("api-key", "1234")) + new HeadersModel() + .withAdditionalProperty("api-key", "1234")) .withCompression("gzip") .withTimeout(10_000)))); - SpanProcessor spanProcessor2 = - new SpanProcessor() + SpanProcessorModel spanProcessor2 = + new SpanProcessorModel() .withBatch( - new BatchSpanProcessor() + new BatchSpanProcessorModel() .withExporter( - new SpanExporter() + new SpanExporterModel() .withZipkin( - new Zipkin() + new ZipkinModel() .withEndpoint("http://localhost:9411/api/v2/spans") .withTimeout(10_000)))); - SpanProcessor spanProcessor3 = - new SpanProcessor() + SpanProcessorModel spanProcessor3 = + new SpanProcessorModel() .withSimple( - new SimpleSpanProcessor() - .withExporter(new SpanExporter().withConsole(new Console()))); + new SimpleSpanProcessorModel() + .withExporter(new SpanExporterModel().withConsole(new ConsoleModel()))); tracerProvider.withProcessors(Arrays.asList(spanProcessor1, spanProcessor2, spanProcessor3)); expected.withTracerProvider(tracerProvider); // end TracerProvider config // LoggerProvider config - LoggerProvider loggerProvider = new LoggerProvider(); + LoggerProviderModel loggerProvider = new LoggerProviderModel(); - LogRecordLimits logRecordLimits = - new LogRecordLimits().withAttributeValueLengthLimit(4096).withAttributeCountLimit(128); + LogRecordLimitsModel logRecordLimits = + new LogRecordLimitsModel().withAttributeValueLengthLimit(4096).withAttributeCountLimit(128); loggerProvider.withLimits(logRecordLimits); - LogRecordProcessor logRecordProcessor = - new LogRecordProcessor() + LogRecordProcessorModel logRecordProcessor = + new LogRecordProcessorModel() .withBatch( - new BatchLogRecordProcessor() + new BatchLogRecordProcessorModel() .withScheduleDelay(5_000) .withExportTimeout(30_000) .withMaxQueueSize(2048) .withMaxExportBatchSize(512) .withExporter( - new LogRecordExporter() + new LogRecordExporterModel() .withOtlp( - new Otlp() + new OtlpModel() .withProtocol("http/protobuf") .withEndpoint("http://localhost:4318") .withCertificate("/app/cert.pem") .withClientKey("/app/cert.pem") .withClientCertificate("/app/cert.pem") .withHeaders( - new Headers().withAdditionalProperty("api-key", "1234")) + new HeadersModel() + .withAdditionalProperty("api-key", "1234")) .withCompression("gzip") .withTimeout(10_000)))); loggerProvider.withProcessors(Collections.singletonList(logRecordProcessor)); @@ -198,64 +202,65 @@ void parse_KitchenSinkExampleFile() throws IOException { // end LoggerProvider config // MeterProvider config - MeterProvider meterProvider = new MeterProvider(); + MeterProviderModel meterProvider = new MeterProviderModel(); - MetricReader metricReader1 = - new MetricReader() + MetricReaderModel metricReader1 = + new MetricReaderModel() .withPull( - new PullMetricReader() + new PullMetricReaderModel() .withExporter( - new MetricExporter() + new MetricExporterModel() .withPrometheus( - new Prometheus().withHost("localhost").withPort(9464)))); - MetricReader metricReader2 = - new MetricReader() + new PrometheusModel().withHost("localhost").withPort(9464)))); + MetricReaderModel metricReader2 = + new MetricReaderModel() .withPeriodic( - new PeriodicMetricReader() + new PeriodicMetricReaderModel() .withInterval(5_000) .withTimeout(30_000) .withExporter( - new MetricExporter() + new MetricExporterModel() .withOtlp( - new OtlpMetric() + new OtlpMetricModel() .withProtocol("http/protobuf") .withEndpoint("http://localhost:4318") .withCertificate("/app/cert.pem") .withClientKey("/app/cert.pem") .withClientCertificate("/app/cert.pem") .withHeaders( - new Headers().withAdditionalProperty("api-key", "1234")) + new HeadersModel() + .withAdditionalProperty("api-key", "1234")) .withCompression("gzip") .withTimeout(10_000) .withTemporalityPreference("delta") .withDefaultHistogramAggregation( - DefaultHistogramAggregation + OtlpMetricModel.DefaultHistogramAggregation .BASE_2_EXPONENTIAL_BUCKET_HISTOGRAM)))); - MetricReader metricReader3 = - new MetricReader() + MetricReaderModel metricReader3 = + new MetricReaderModel() .withPeriodic( - new PeriodicMetricReader() - .withExporter(new MetricExporter().withConsole(new Console()))); + new PeriodicMetricReaderModel() + .withExporter(new MetricExporterModel().withConsole(new ConsoleModel()))); meterProvider.withReaders(Arrays.asList(metricReader1, metricReader2, metricReader3)); - View view = - new View() + ViewModel view = + new ViewModel() .withSelector( - new Selector() + new SelectorModel() .withInstrumentName("my-instrument") - .withInstrumentType(Selector.InstrumentType.HISTOGRAM) + .withInstrumentType(SelectorModel.InstrumentType.HISTOGRAM) .withUnit("ms") .withMeterName("my-meter") .withMeterVersion("1.0.0") .withMeterSchemaUrl("https://opentelemetry.io/schemas/1.16.0")) .withStream( - new Stream() + new StreamModel() .withName("new_instrument_name") .withDescription("new_description") .withAggregation( - new Aggregation() + new AggregationModel() .withExplicitBucketHistogram( - new ExplicitBucketHistogram() + new ExplicitBucketHistogramModel() .withBoundaries( Arrays.asList( 0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, @@ -269,7 +274,7 @@ void parse_KitchenSinkExampleFile() throws IOException { try (FileInputStream configExampleFile = new FileInputStream(System.getenv("CONFIG_EXAMPLE_DIR") + "/kitchen-sink.yaml")) { - OpenTelemetryConfiguration config = FileConfiguration.parse(configExampleFile); + OpenTelemetryConfigurationModel config = FileConfiguration.parse(configExampleFile); // General config assertThat(config.getFileFormat()).isEqualTo("0.1"); @@ -278,20 +283,20 @@ void parse_KitchenSinkExampleFile() throws IOException { assertThat(config.getPropagator()).isEqualTo(propagator); // TracerProvider config - TracerProvider configTracerProvider = config.getTracerProvider(); + TracerProviderModel configTracerProvider = config.getTracerProvider(); assertThat(configTracerProvider.getLimits()).isEqualTo(spanLimits); assertThat(configTracerProvider.getSampler()).isEqualTo(sampler); assertThat(configTracerProvider.getProcessors()) .isEqualTo(Arrays.asList(spanProcessor1, spanProcessor2, spanProcessor3)); // LoggerProvider config - LoggerProvider configLoggerProvider = config.getLoggerProvider(); + LoggerProviderModel configLoggerProvider = config.getLoggerProvider(); assertThat(configLoggerProvider.getLimits()).isEqualTo(logRecordLimits); assertThat(configLoggerProvider.getProcessors()) .isEqualTo(Collections.singletonList(logRecordProcessor)); // MeterProvider config - MeterProvider configMeterProvider = config.getMeterProvider(); + MeterProviderModel configMeterProvider = config.getMeterProvider(); assertThat(configMeterProvider.getReaders()) .isEqualTo(Arrays.asList(metricReader1, metricReader2, metricReader3)); assertThat(configMeterProvider.getViews()).isEqualTo(Collections.singletonList(view)); @@ -317,7 +322,7 @@ void parse_nullValuesParsedToEmptyObjects() { + " stream:\n" + " aggregation:\n" + " drop: {}\n"; - OpenTelemetryConfiguration objectPlaceholderModel = + OpenTelemetryConfigurationModel objectPlaceholderModel = FileConfiguration.parse( new ByteArrayInputStream(objectPlaceholderString.getBytes(StandardCharsets.UTF_8))); @@ -335,11 +340,11 @@ void parse_nullValuesParsedToEmptyObjects() { + " stream:\n" + " aggregation:\n" + " drop:\n"; - OpenTelemetryConfiguration noObjectPlaceholderModel = + OpenTelemetryConfigurationModel noObjectPlaceholderModel = FileConfiguration.parse( new ByteArrayInputStream(noOjbectPlaceholderString.getBytes(StandardCharsets.UTF_8))); - SpanExporter exporter = + SpanExporterModel exporter = noObjectPlaceholderModel .getTracerProvider() .getProcessors() @@ -349,7 +354,7 @@ void parse_nullValuesParsedToEmptyObjects() { assertThat(exporter.getConsole()).isNotNull(); assertThat(exporter.getOtlp()).isNull(); - Aggregation aggregation = + AggregationModel aggregation = noObjectPlaceholderModel.getMeterProvider().getViews().get(0).getStream().getAggregation(); assertThat(aggregation.getDrop()).isNotNull(); assertThat(aggregation.getSum()).isNull(); @@ -369,7 +374,7 @@ void parse_nullBoxedPrimitivesParsedToNull() { + " trace_id_ratio_based:\n" + " ratio:\n"; // Double - OpenTelemetryConfiguration model = + OpenTelemetryConfigurationModel model = FileConfiguration.parse(new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8))); assertThat(model.getFileFormat()).isNull(); @@ -379,12 +384,13 @@ void parse_nullBoxedPrimitivesParsedToNull() { assertThat(model) .isEqualTo( - new OpenTelemetryConfiguration() - .withAttributeLimits(new AttributeLimits()) + new OpenTelemetryConfigurationModel() + .withAttributeLimits(new AttributeLimitsModel()) .withTracerProvider( - new TracerProvider() + new TracerProviderModel() .withSampler( - new Sampler().withTraceIdRatioBased(new TraceIdRatioBased())))); + new SamplerModel() + .withTraceIdRatioBased(new TraceIdRatioBasedModel())))); } @ParameterizedTest @@ -494,30 +500,31 @@ void read_WithEnvironmentVariables() { + " endpoint: ${UNSET_ENV_VAR}\n"; Map envVars = new HashMap<>(); envVars.put("OTEL_EXPORTER_OTLP_ENDPOINT", "http://collector:4317"); - OpenTelemetryConfiguration model = + OpenTelemetryConfigurationModel model = FileConfiguration.parse( new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8)), envVars); assertThat(model) .isEqualTo( - new OpenTelemetryConfiguration() + new OpenTelemetryConfigurationModel() .withFileFormat("0.1") .withTracerProvider( - new TracerProvider() + new TracerProviderModel() .withProcessors( Arrays.asList( - new SpanProcessor() + new SpanProcessorModel() .withBatch( - new BatchSpanProcessor() + new BatchSpanProcessorModel() .withExporter( - new SpanExporter() + new SpanExporterModel() .withOtlp( - new Otlp() + new OtlpModel() .withEndpoint( "http://collector:4317")))), - new SpanProcessor() + new SpanProcessorModel() .withBatch( - new BatchSpanProcessor() + new BatchSpanProcessorModel() .withExporter( - new SpanExporter().withOtlp(new Otlp()))))))); + new SpanExporterModel() + .withOtlp(new OtlpModel()))))))); } } diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/InstrumentSelectorFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/InstrumentSelectorFactoryTest.java index 9b3ada1a6fe..fd9a2640708 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/InstrumentSelectorFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/InstrumentSelectorFactoryTest.java @@ -11,7 +11,7 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Selector; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SelectorModel; import io.opentelemetry.sdk.metrics.InstrumentSelector; import io.opentelemetry.sdk.metrics.InstrumentType; import java.util.Collections; @@ -24,7 +24,7 @@ void create_Defaults() { assertThatThrownBy( () -> InstrumentSelectorFactory.getInstance() - .create(new Selector(), mock(SpiHelper.class), Collections.emptyList())) + .create(new SelectorModel(), mock(SpiHelper.class), Collections.emptyList())) .isInstanceOf(ConfigurationException.class) .hasMessage("Invalid selector"); } @@ -34,9 +34,9 @@ void create() { assertThat( InstrumentSelectorFactory.getInstance() .create( - new Selector() + new SelectorModel() .withInstrumentName("instrument-name") - .withInstrumentType(Selector.InstrumentType.COUNTER) + .withInstrumentType(SelectorModel.InstrumentType.COUNTER) .withMeterName("meter-name") .withMeterSchemaUrl("https://opentelemetry.io/schemas/1.16.0") .withMeterVersion("1.0.0"), diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogLimitsFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogLimitsFactoryTest.java index 492b8c4b425..53e811e6629 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogLimitsFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogLimitsFactoryTest.java @@ -9,8 +9,8 @@ import static org.mockito.Mockito.mock; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimits; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimitsModel; import io.opentelemetry.sdk.logs.LogLimits; import java.util.Collections; import java.util.stream.Stream; @@ -34,17 +34,24 @@ private static Stream createArguments() { Arguments.of( LogRecordLimitsAndAttributeLimits.create(null, null), LogLimits.builder().build()), Arguments.of( - LogRecordLimitsAndAttributeLimits.create(new AttributeLimits(), new LogRecordLimits()), + LogRecordLimitsAndAttributeLimits.create( + new AttributeLimitsModel(), new LogRecordLimitsModel()), LogLimits.builder().build()), Arguments.of( LogRecordLimitsAndAttributeLimits.create( - new AttributeLimits().withAttributeValueLengthLimit(1).withAttributeCountLimit(2), - new LogRecordLimits()), + new AttributeLimitsModel() + .withAttributeValueLengthLimit(1) + .withAttributeCountLimit(2), + new LogRecordLimitsModel()), LogLimits.builder().setMaxAttributeValueLength(1).setMaxNumberOfAttributes(2).build()), Arguments.of( LogRecordLimitsAndAttributeLimits.create( - new AttributeLimits().withAttributeValueLengthLimit(1).withAttributeCountLimit(2), - new LogRecordLimits().withAttributeValueLengthLimit(3).withAttributeCountLimit(4)), + new AttributeLimitsModel() + .withAttributeValueLengthLimit(1) + .withAttributeCountLimit(2), + new LogRecordLimitsModel() + .withAttributeValueLengthLimit(3) + .withAttributeCountLimit(4)), LogLimits.builder().setMaxAttributeValueLength(3).setMaxNumberOfAttributes(4).build())); } } diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordExporterFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordExporterFactoryTest.java index a2a6d057139..e826411feee 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordExporterFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordExporterFactoryTest.java @@ -22,8 +22,9 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; import io.opentelemetry.sdk.extension.incubator.fileconfig.component.LogRecordExporterComponentProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Headers; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.HeadersModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; import io.opentelemetry.sdk.logs.export.LogRecordExporter; import java.io.Closeable; import java.io.IOException; @@ -67,8 +68,8 @@ void create_OtlpDefaults() { LogRecordExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .LogRecordExporter() - .withOtlp(new Otlp()), + .LogRecordExporterModel() + .withOtlp(new OtlpModel()), spiHelper, closeables); cleanup.addCloseable(exporter); @@ -122,13 +123,13 @@ void create_OtlpConfigured(@TempDir Path tempDir) LogRecordExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .LogRecordExporter() + .LogRecordExporterModel() .withOtlp( - new Otlp() + new OtlpModel() .withProtocol("http/protobuf") .withEndpoint("http://example:4318") .withHeaders( - new Headers() + new HeadersModel() .withAdditionalProperty("key1", "value1") .withAdditionalProperty("key2", "value2")) .withCompression("gzip") @@ -171,7 +172,7 @@ void create_SpiExporter_Unknown() { LogRecordExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .LogRecordExporter() + .LogRecordExporterModel() .withAdditionalProperty( "unknown_key", ImmutableMap.of("key1", "value1")), spiHelper, @@ -187,8 +188,7 @@ void create_SpiExporter_Valid() { LogRecordExporter logRecordExporter = LogRecordExporterFactory.getInstance() .create( - new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .LogRecordExporter() + new LogRecordExporterModel() .withAdditionalProperty("test", ImmutableMap.of("key1", "value1")), spiHelper, new ArrayList<>()); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordProcessorFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordProcessorFactoryTest.java index 31038580e82..3f3adb75066 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordProcessorFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LogRecordProcessorFactoryTest.java @@ -14,11 +14,11 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.extension.incubator.fileconfig.component.LogRecordProcessorComponentProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleLogRecordProcessor; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleLogRecordProcessorModel; import java.io.Closeable; import java.time.Duration; import java.util.ArrayList; @@ -41,7 +41,7 @@ void create_BatchNullExporter() { () -> LogRecordProcessorFactory.getInstance() .create( - new LogRecordProcessor().withBatch(new BatchLogRecordProcessor()), + new LogRecordProcessorModel().withBatch(new BatchLogRecordProcessorModel()), spiHelper, Collections.emptyList())) .isInstanceOf(ConfigurationException.class) @@ -60,10 +60,10 @@ void create_BatchDefaults() { io.opentelemetry.sdk.logs.LogRecordProcessor processor = LogRecordProcessorFactory.getInstance() .create( - new LogRecordProcessor() + new LogRecordProcessorModel() .withBatch( - new BatchLogRecordProcessor() - .withExporter(new LogRecordExporter().withOtlp(new Otlp()))), + new BatchLogRecordProcessorModel() + .withExporter(new LogRecordExporterModel().withOtlp(new OtlpModel()))), spiHelper, closeables); cleanup.addCloseable(processor); @@ -87,10 +87,10 @@ void create_BatchConfigured() { io.opentelemetry.sdk.logs.LogRecordProcessor processor = LogRecordProcessorFactory.getInstance() .create( - new LogRecordProcessor() + new LogRecordProcessorModel() .withBatch( - new BatchLogRecordProcessor() - .withExporter(new LogRecordExporter().withOtlp(new Otlp())) + new BatchLogRecordProcessorModel() + .withExporter(new LogRecordExporterModel().withOtlp(new OtlpModel())) .withScheduleDelay(1) .withMaxExportBatchSize(2) .withExportTimeout(3)), @@ -108,7 +108,8 @@ void create_SimpleNullExporter() { () -> LogRecordProcessorFactory.getInstance() .create( - new LogRecordProcessor().withSimple(new SimpleLogRecordProcessor()), + new LogRecordProcessorModel() + .withSimple(new SimpleLogRecordProcessorModel()), spiHelper, Collections.emptyList())) .isInstanceOf(ConfigurationException.class) @@ -126,10 +127,10 @@ void create_SimpleConfigured() { io.opentelemetry.sdk.logs.LogRecordProcessor processor = LogRecordProcessorFactory.getInstance() .create( - new LogRecordProcessor() + new LogRecordProcessorModel() .withSimple( - new SimpleLogRecordProcessor() - .withExporter(new LogRecordExporter().withOtlp(new Otlp()))), + new SimpleLogRecordProcessorModel() + .withExporter(new LogRecordExporterModel().withOtlp(new OtlpModel()))), spiHelper, closeables); cleanup.addCloseable(processor); @@ -144,7 +145,7 @@ void create_SpiProcessor_Unknown() { () -> LogRecordProcessorFactory.getInstance() .create( - new LogRecordProcessor() + new LogRecordProcessorModel() .withAdditionalProperty( "unknown_key", ImmutableMap.of("key1", "value1")), spiHelper, @@ -159,7 +160,7 @@ void create_SpiExporter_Valid() { io.opentelemetry.sdk.logs.LogRecordProcessor logRecordProcessor = LogRecordProcessorFactory.getInstance() .create( - new LogRecordProcessor() + new LogRecordProcessorModel() .withAdditionalProperty("test", ImmutableMap.of("key1", "value1")), spiHelper, new ArrayList<>()); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderFactoryTest.java index 312c8dc85d4..5293520b700 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/LoggerProviderFactoryTest.java @@ -10,13 +10,13 @@ import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporter; import io.opentelemetry.internal.testing.CleanupExtension; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProviderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; import io.opentelemetry.sdk.logs.LogLimits; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import java.io.Closeable; @@ -56,23 +56,25 @@ private static Stream createArguments() { LoggerProviderAndAttributeLimits.create(null, null), SdkLoggerProvider.builder().build()), Arguments.of( - LoggerProviderAndAttributeLimits.create(new AttributeLimits(), new LoggerProvider()), + LoggerProviderAndAttributeLimits.create( + new AttributeLimitsModel(), new LoggerProviderModel()), SdkLoggerProvider.builder().build()), Arguments.of( LoggerProviderAndAttributeLimits.create( - new AttributeLimits(), - new LoggerProvider() + new AttributeLimitsModel(), + new LoggerProviderModel() .withLimits( - new LogRecordLimits() + new LogRecordLimitsModel() .withAttributeCountLimit(1) .withAttributeValueLengthLimit(2)) .withProcessors( Collections.singletonList( - new LogRecordProcessor() + new LogRecordProcessorModel() .withBatch( - new BatchLogRecordProcessor() + new BatchLogRecordProcessorModel() .withExporter( - new LogRecordExporter().withOtlp(new Otlp())))))), + new LogRecordExporterModel() + .withOtlp(new OtlpModel())))))), SdkLoggerProvider.builder() .setLogLimits( () -> diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MeterProviderFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MeterProviderFactoryTest.java index b2ac1d838d0..8094bb639c0 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MeterProviderFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MeterProviderFactoryTest.java @@ -10,13 +10,13 @@ import io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter; import io.opentelemetry.internal.testing.CleanupExtension; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MeterProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Selector; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Stream; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MeterProviderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetricModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SelectorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.StreamModel; import io.opentelemetry.sdk.metrics.InstrumentSelector; import io.opentelemetry.sdk.metrics.SdkMeterProvider; import io.opentelemetry.sdk.metrics.View; @@ -42,7 +42,7 @@ void create_Defaults() { SdkMeterProvider provider = MeterProviderFactory.getInstance() - .create(new MeterProvider(), spiHelper, closeables) + .create(new MeterProviderModel(), spiHelper, closeables) .build(); cleanup.addCloseable(provider); cleanup.addCloseables(closeables); @@ -68,21 +68,25 @@ void create_Configured() { SdkMeterProvider provider = MeterProviderFactory.getInstance() .create( - new MeterProvider() + new MeterProviderModel() .withReaders( Collections.singletonList( - new MetricReader() + new MetricReaderModel() .withPeriodic( - new PeriodicMetricReader() + new PeriodicMetricReaderModel() .withExporter( - new MetricExporter().withOtlp(new OtlpMetric()))))) + new MetricExporterModel() + .withOtlp(new OtlpMetricModel()))))) .withViews( Collections.singletonList( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .View() - .withSelector(new Selector().withInstrumentName("instrument-name")) + .ViewModel() + .withSelector( + new SelectorModel().withInstrumentName("instrument-name")) .withStream( - new Stream().withName("stream-name").withAttributeKeys(null)))), + new StreamModel() + .withName("stream-name") + .withAttributeKeys(null)))), spiHelper, closeables) .build(); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricExporterFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricExporterFactoryTest.java index 64f0db469ec..3707a2d582c 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricExporterFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricExporterFactoryTest.java @@ -23,11 +23,10 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; import io.opentelemetry.sdk.extension.incubator.fileconfig.component.MetricExporterComponentProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Console; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Headers; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric.DefaultHistogramAggregation; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Prometheus; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ConsoleModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.HeadersModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetricModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PrometheusModel; import io.opentelemetry.sdk.metrics.Aggregation; import io.opentelemetry.sdk.metrics.InstrumentType; import io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector; @@ -74,8 +73,8 @@ void create_OtlpDefaults() { MetricExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .MetricExporter() - .withOtlp(new OtlpMetric()), + .MetricExporterModel() + .withOtlp(new OtlpMetricModel()), spiHelper, closeables); cleanup.addCloseable(exporter); @@ -132,13 +131,13 @@ void create_OtlpConfigured(@TempDir Path tempDir) MetricExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .MetricExporter() + .MetricExporterModel() .withOtlp( - new OtlpMetric() + new OtlpMetricModel() .withProtocol("http/protobuf") .withEndpoint("http://example:4318") .withHeaders( - new Headers() + new HeadersModel() .withAdditionalProperty("key1", "value1") .withAdditionalProperty("key2", "value2")) .withCompression("gzip") @@ -148,7 +147,8 @@ void create_OtlpConfigured(@TempDir Path tempDir) .withClientCertificate(clientCertificatePath) .withTemporalityPreference("delta") .withDefaultHistogramAggregation( - DefaultHistogramAggregation.BASE_2_EXPONENTIAL_BUCKET_HISTOGRAM)), + OtlpMetricModel.DefaultHistogramAggregation + .BASE_2_EXPONENTIAL_BUCKET_HISTOGRAM)), spiHelper, closeables); cleanup.addCloseable(exporter); @@ -188,8 +188,8 @@ void create_Console() { MetricExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .MetricExporter() - .withConsole(new Console()), + .MetricExporterModel() + .withConsole(new ConsoleModel()), spiHelper, closeables); cleanup.addCloseable(exporter); @@ -207,8 +207,8 @@ void create_PrometheusExporter() { MetricExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .MetricExporter() - .withPrometheus(new Prometheus()), + .MetricExporterModel() + .withPrometheus(new PrometheusModel()), spiHelper, closeables)) .isInstanceOf(ConfigurationException.class) @@ -223,7 +223,7 @@ void create_SpiExporter_Unknown() { MetricExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .MetricExporter() + .MetricExporterModel() .withAdditionalProperty( "unknown_key", ImmutableMap.of("key1", "value1")), spiHelper, @@ -239,7 +239,7 @@ void create_SpiExporter_Valid() { MetricExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .MetricExporter() + .MetricExporterModel() .withAdditionalProperty("test", ImmutableMap.of("key1", "value1")), spiHelper, new ArrayList<>()); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricReaderFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricReaderFactoryTest.java index 22a7d36106d..976bb6da3a2 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricReaderFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/MetricReaderFactoryTest.java @@ -17,12 +17,12 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Prometheus; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PullMetricReader; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetricModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PrometheusModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PullMetricReaderModel; import java.io.Closeable; import java.io.IOException; import java.net.ServerSocket; @@ -49,7 +49,7 @@ void create_PeriodicNullExporter() { () -> MetricReaderFactory.getInstance() .create( - new MetricReader().withPeriodic(new PeriodicMetricReader()), + new MetricReaderModel().withPeriodic(new PeriodicMetricReaderModel()), spiHelper, Collections.emptyList())) .isInstanceOf(ConfigurationException.class) @@ -68,10 +68,11 @@ void create_PeriodicDefaults() { io.opentelemetry.sdk.metrics.export.MetricReader reader = MetricReaderFactory.getInstance() .create( - new MetricReader() + new MetricReaderModel() .withPeriodic( - new PeriodicMetricReader() - .withExporter(new MetricExporter().withOtlp(new OtlpMetric()))), + new PeriodicMetricReaderModel() + .withExporter( + new MetricExporterModel().withOtlp(new OtlpMetricModel()))), spiHelper, closeables); cleanup.addCloseable(reader); @@ -93,10 +94,10 @@ void create_PeriodicConfigured() { io.opentelemetry.sdk.metrics.export.MetricReader reader = MetricReaderFactory.getInstance() .create( - new MetricReader() + new MetricReaderModel() .withPeriodic( - new PeriodicMetricReader() - .withExporter(new MetricExporter().withOtlp(new OtlpMetric())) + new PeriodicMetricReaderModel() + .withExporter(new MetricExporterModel().withOtlp(new OtlpMetricModel())) .withInterval(1)), spiHelper, closeables); @@ -118,12 +119,12 @@ void create_PullPrometheusDefault() throws IOException { io.opentelemetry.sdk.metrics.export.MetricReader reader = MetricReaderFactory.getInstance() .create( - new MetricReader() + new MetricReaderModel() .withPull( - new PullMetricReader() + new PullMetricReaderModel() .withExporter( - new MetricExporter() - .withPrometheus(new Prometheus().withPort(port)))), + new MetricExporterModel() + .withPrometheus(new PrometheusModel().withPort(port)))), spiHelper, closeables); cleanup.addCloseable(reader); @@ -148,13 +149,15 @@ void create_PullPrometheusConfigured() throws IOException { io.opentelemetry.sdk.metrics.export.MetricReader reader = MetricReaderFactory.getInstance() .create( - new MetricReader() + new MetricReaderModel() .withPull( - new PullMetricReader() + new PullMetricReaderModel() .withExporter( - new MetricExporter() + new MetricExporterModel() .withPrometheus( - new Prometheus().withHost("localhost").withPort(port)))), + new PrometheusModel() + .withHost("localhost") + .withPort(port)))), spiHelper, closeables); cleanup.addCloseable(reader); @@ -171,7 +174,7 @@ void create_InvalidPullReader() { () -> MetricReaderFactory.getInstance() .create( - new MetricReader().withPull(new PullMetricReader()), + new MetricReaderModel().withPull(new PullMetricReaderModel()), spiHelper, Collections.emptyList())) .isInstanceOf(ConfigurationException.class) @@ -181,8 +184,10 @@ void create_InvalidPullReader() { () -> MetricReaderFactory.getInstance() .create( - new MetricReader() - .withPull(new PullMetricReader().withExporter(new MetricExporter())), + new MetricReaderModel() + .withPull( + new PullMetricReaderModel() + .withExporter(new MetricExporterModel())), spiHelper, Collections.emptyList())) .isInstanceOf(ConfigurationException.class) @@ -192,10 +197,11 @@ void create_InvalidPullReader() { () -> MetricReaderFactory.getInstance() .create( - new MetricReader() + new MetricReaderModel() .withPull( - new PullMetricReader() - .withExporter(new MetricExporter().withOtlp(new OtlpMetric()))), + new PullMetricReaderModel() + .withExporter( + new MetricExporterModel().withOtlp(new OtlpMetricModel()))), spiHelper, Collections.emptyList())) .isInstanceOf(ConfigurationException.class) diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactoryTest.java index 7de50047ece..247e5932a23 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/OpenTelemetryConfigurationFactoryTest.java @@ -23,30 +23,30 @@ import io.opentelemetry.sdk.OpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOn; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Attributes; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MeterProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfiguration; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetric; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReader; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Propagator; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Resource; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sampler; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Selector; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleLogRecordProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Stream; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProvider; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOnModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributesModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchLogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.LoggerProviderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MeterProviderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.MetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpMetricModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PeriodicMetricReaderModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PropagatorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ResourceModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SamplerModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SelectorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleLogRecordProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.StreamModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProviderModel; import io.opentelemetry.sdk.logs.LogLimits; import io.opentelemetry.sdk.logs.SdkLoggerProvider; import io.opentelemetry.sdk.metrics.InstrumentSelector; @@ -71,12 +71,13 @@ class OpenTelemetryConfigurationFactoryTest { @Test void create_InvalidFileFormat() { - List testCases = + List testCases = Arrays.asList( - new OpenTelemetryConfiguration(), new OpenTelemetryConfiguration().withFileFormat("1")); + new OpenTelemetryConfigurationModel(), + new OpenTelemetryConfigurationModel().withFileFormat("1")); List closeables = new ArrayList<>(); - for (OpenTelemetryConfiguration testCase : testCases) { + for (OpenTelemetryConfigurationModel testCase : testCases) { assertThatThrownBy( () -> OpenTelemetryConfigurationFactory.getInstance() @@ -95,7 +96,8 @@ void create_Defaults() { OpenTelemetrySdk sdk = OpenTelemetryConfigurationFactory.getInstance() - .create(new OpenTelemetryConfiguration().withFileFormat("0.1"), spiHelper, closeables); + .create( + new OpenTelemetryConfigurationModel().withFileFormat("0.1"), spiHelper, closeables); cleanup.addCloseable(sdk); cleanup.addCloseables(closeables); @@ -111,20 +113,20 @@ void create_Disabled() { OpenTelemetrySdk sdk = OpenTelemetryConfigurationFactory.getInstance() .create( - new OpenTelemetryConfiguration() + new OpenTelemetryConfigurationModel() .withFileFormat("0.1") .withDisabled(true) // Logger provider configuration should be ignored since SDK is disabled .withLoggerProvider( - new LoggerProvider() + new LoggerProviderModel() .withProcessors( Collections.singletonList( - new LogRecordProcessor() + new LogRecordProcessorModel() .withSimple( - new SimpleLogRecordProcessor() + new SimpleLogRecordProcessorModel() .withExporter( - new LogRecordExporter() - .withOtlp(new Otlp())))))), + new LogRecordExporterModel() + .withOtlp(new OtlpModel())))))), spiHelper, closeables); cleanup.addCloseable(sdk); @@ -205,10 +207,10 @@ void create_Configured() { OpenTelemetrySdk sdk = OpenTelemetryConfigurationFactory.getInstance() .create( - new OpenTelemetryConfiguration() + new OpenTelemetryConfigurationModel() .withFileFormat("0.1") .withPropagator( - new Propagator() + new PropagatorModel() .withComposite( Arrays.asList( "tracecontext", @@ -218,62 +220,64 @@ void create_Configured() { "b3", "jaeger"))) .withResource( - new Resource() + new ResourceModel() .withAttributes( - new Attributes() + new AttributesModel() .withServiceName("my-service") .withAdditionalProperty("key", "val"))) .withLoggerProvider( - new LoggerProvider() + new LoggerProviderModel() .withLimits( - new LogRecordLimits() + new LogRecordLimitsModel() .withAttributeValueLengthLimit(1) .withAttributeCountLimit(2)) .withProcessors( Collections.singletonList( - new LogRecordProcessor() + new LogRecordProcessorModel() .withBatch( - new BatchLogRecordProcessor() + new BatchLogRecordProcessorModel() .withExporter( - new LogRecordExporter() - .withOtlp(new Otlp())))))) + new LogRecordExporterModel() + .withOtlp(new OtlpModel())))))) .withTracerProvider( - new TracerProvider() + new TracerProviderModel() .withLimits( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal - .model.SpanLimits() + .model.SpanLimitsModel() .withAttributeCountLimit(1) .withAttributeValueLengthLimit(2) .withEventCountLimit(3) .withLinkCountLimit(4) .withEventAttributeCountLimit(5) .withLinkAttributeCountLimit(6)) - .withSampler(new Sampler().withAlwaysOn(new AlwaysOn())) + .withSampler(new SamplerModel().withAlwaysOn(new AlwaysOnModel())) .withProcessors( Collections.singletonList( - new SpanProcessor() + new SpanProcessorModel() .withBatch( - new BatchSpanProcessor() + new BatchSpanProcessorModel() .withExporter( - new SpanExporter().withOtlp(new Otlp())))))) + new SpanExporterModel() + .withOtlp(new OtlpModel())))))) .withMeterProvider( - new MeterProvider() + new MeterProviderModel() .withReaders( Collections.singletonList( - new MetricReader() + new MetricReaderModel() .withPeriodic( - new PeriodicMetricReader() + new PeriodicMetricReaderModel() .withExporter( - new MetricExporter() - .withOtlp(new OtlpMetric()))))) + new MetricExporterModel() + .withOtlp(new OtlpMetricModel()))))) .withViews( Collections.singletonList( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal - .model.View() + .model.ViewModel() .withSelector( - new Selector().withInstrumentName("instrument-name")) + new SelectorModel() + .withInstrumentName("instrument-name")) .withStream( - new Stream() + new StreamModel() .withName("stream-name") .withAttributeKeys(null))))), spiHelper, diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/PropagatorFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/PropagatorFactoryTest.java index 8eb099cffa5..80377f417d0 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/PropagatorFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/PropagatorFactoryTest.java @@ -15,7 +15,7 @@ import io.opentelemetry.extension.trace.propagation.JaegerPropagator; import io.opentelemetry.extension.trace.propagation.OtTracePropagator; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Propagator; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.PropagatorModel; import java.util.Arrays; import java.util.Collections; import java.util.stream.Stream; @@ -30,7 +30,7 @@ class PropagatorFactoryTest { @ParameterizedTest @MethodSource("createArguments") - void create(Propagator model, ContextPropagators expectedPropagators) { + void create(PropagatorModel model, ContextPropagators expectedPropagators) { ContextPropagators propagators = PropagatorFactory.getInstance().create(model, spiHelper, Collections.emptyList()); @@ -40,7 +40,7 @@ void create(Propagator model, ContextPropagators expectedPropagators) { private static Stream createArguments() { return Stream.of( Arguments.of( - new Propagator() + new PropagatorModel() .withComposite( Arrays.asList("tracecontext", "baggage", "ottrace", "b3multi", "b3", "jaeger")), ContextPropagators.create( diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ResourceFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ResourceFactoryTest.java index 584f908431c..d567d7f45e4 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ResourceFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ResourceFactoryTest.java @@ -9,7 +9,8 @@ import static org.mockito.Mockito.spy; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Attributes; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributesModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ResourceModel; import io.opentelemetry.sdk.resources.Resource; import java.util.Collections; import org.junit.jupiter.api.Test; @@ -24,10 +25,9 @@ void create() { assertThat( ResourceFactory.getInstance() .create( - new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .Resource() + new ResourceModel() .withAttributes( - new Attributes() + new AttributesModel() .withServiceName("my-service") .withAdditionalProperty("key", "val") // Should override shape attribute from ResourceComponentProvider diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SamplerFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SamplerFactoryTest.java index 4413ddb34c7..363bb301975 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SamplerFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SamplerFactoryTest.java @@ -14,12 +14,12 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.extension.incubator.fileconfig.component.SamplerComponentProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOff; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOn; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.JaegerRemote; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ParentBased; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sampler; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TraceIdRatioBased; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOffModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOnModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.JaegerRemoteModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ParentBasedModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SamplerModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TraceIdRatioBasedModel; import io.opentelemetry.sdk.extension.trace.jaeger.sampler.JaegerRemoteSampler; import java.io.Closeable; import java.time.Duration; @@ -45,7 +45,7 @@ class SamplerFactoryTest { @ParameterizedTest @MethodSource("createArguments") void create( - @Nullable Sampler model, io.opentelemetry.sdk.trace.samplers.Sampler expectedSampler) { + @Nullable SamplerModel model, io.opentelemetry.sdk.trace.samplers.Sampler expectedSampler) { // Some samplers like JaegerRemoteSampler are Closeable - ensure these get cleaned up if (expectedSampler instanceof Closeable) { cleanup.addCloseable((Closeable) expectedSampler); @@ -62,40 +62,45 @@ void create( private static Stream createArguments() { return Stream.of( Arguments.of( - new Sampler().withAlwaysOn(new AlwaysOn()), + new SamplerModel().withAlwaysOn(new AlwaysOnModel()), io.opentelemetry.sdk.trace.samplers.Sampler.alwaysOn()), Arguments.of( - new Sampler().withAlwaysOff(new AlwaysOff()), + new SamplerModel().withAlwaysOff(new AlwaysOffModel()), io.opentelemetry.sdk.trace.samplers.Sampler.alwaysOff()), Arguments.of( - new Sampler().withTraceIdRatioBased(new TraceIdRatioBased()), + new SamplerModel().withTraceIdRatioBased(new TraceIdRatioBasedModel()), io.opentelemetry.sdk.trace.samplers.Sampler.traceIdRatioBased(1.0d)), Arguments.of( - new Sampler().withTraceIdRatioBased(new TraceIdRatioBased().withRatio(0.5d)), + new SamplerModel().withTraceIdRatioBased(new TraceIdRatioBasedModel().withRatio(0.5d)), io.opentelemetry.sdk.trace.samplers.Sampler.traceIdRatioBased(0.5)), Arguments.of( - new Sampler().withParentBased(new ParentBased()), + new SamplerModel().withParentBased(new ParentBasedModel()), io.opentelemetry.sdk.trace.samplers.Sampler.parentBased( io.opentelemetry.sdk.trace.samplers.Sampler.alwaysOn())), Arguments.of( - new Sampler() + new SamplerModel() .withParentBased( - new ParentBased() + new ParentBasedModel() .withRoot( - new Sampler() - .withTraceIdRatioBased(new TraceIdRatioBased().withRatio(0.1d))) + new SamplerModel() + .withTraceIdRatioBased( + new TraceIdRatioBasedModel().withRatio(0.1d))) .withRemoteParentSampled( - new Sampler() - .withTraceIdRatioBased(new TraceIdRatioBased().withRatio(0.2d))) + new SamplerModel() + .withTraceIdRatioBased( + new TraceIdRatioBasedModel().withRatio(0.2d))) .withRemoteParentNotSampled( - new Sampler() - .withTraceIdRatioBased(new TraceIdRatioBased().withRatio(0.3d))) + new SamplerModel() + .withTraceIdRatioBased( + new TraceIdRatioBasedModel().withRatio(0.3d))) .withLocalParentSampled( - new Sampler() - .withTraceIdRatioBased(new TraceIdRatioBased().withRatio(0.4d))) + new SamplerModel() + .withTraceIdRatioBased( + new TraceIdRatioBasedModel().withRatio(0.4d))) .withLocalParentNotSampled( - new Sampler() - .withTraceIdRatioBased(new TraceIdRatioBased().withRatio(0.5d)))), + new SamplerModel() + .withTraceIdRatioBased( + new TraceIdRatioBasedModel().withRatio(0.5d)))), io.opentelemetry.sdk.trace.samplers.Sampler.parentBasedBuilder( io.opentelemetry.sdk.trace.samplers.Sampler.traceIdRatioBased(0.1d)) .setRemoteParentSampled( @@ -108,12 +113,13 @@ private static Stream createArguments() { io.opentelemetry.sdk.trace.samplers.Sampler.traceIdRatioBased(0.5d)) .build()), Arguments.of( - new Sampler() + new SamplerModel() .withJaegerRemote( - new JaegerRemote() + new JaegerRemoteModel() .withEndpoint("http://jaeger-remote-endpoint") .withInterval(10_000) - .withInitialSampler(new Sampler().withAlwaysOff(new AlwaysOff()))), + .withInitialSampler( + new SamplerModel().withAlwaysOff(new AlwaysOffModel()))), JaegerRemoteSampler.builder() .setEndpoint("http://jaeger-remote-endpoint") .setPollingInterval(Duration.ofSeconds(10)) @@ -129,8 +135,7 @@ void create_SpiExporter_Unknown() { () -> SamplerFactory.getInstance() .create( - new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .Sampler() + new SamplerModel() .withAdditionalProperty( "unknown_key", ImmutableMap.of("key1", "value1")), spiHelper, @@ -146,7 +151,7 @@ void create_SpiExporter_Valid() { io.opentelemetry.sdk.trace.samplers.Sampler sampler = SamplerFactory.getInstance() .create( - new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sampler() + new SamplerModel() .withAdditionalProperty("test", ImmutableMap.of("key1", "value1")), spiHelper, new ArrayList<>()); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanExporterFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanExporterFactoryTest.java index b4192410110..942c9f4352e 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanExporterFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanExporterFactoryTest.java @@ -24,10 +24,10 @@ import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; import io.opentelemetry.sdk.extension.incubator.fileconfig.component.SpanExporterComponentProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Console; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Headers; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Zipkin; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ConsoleModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.HeadersModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ZipkinModel; import io.opentelemetry.sdk.trace.export.SpanExporter; import java.io.Closeable; import java.io.IOException; @@ -70,8 +70,8 @@ void create_OtlpDefaults() { SpanExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .SpanExporter() - .withOtlp(new Otlp()), + .SpanExporterModel() + .withOtlp(new OtlpModel()), spiHelper, closeables); cleanup.addCloseable(exporter); @@ -122,13 +122,13 @@ void create_OtlpConfigured(@TempDir Path tempDir) SpanExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .SpanExporter() + .SpanExporterModel() .withOtlp( - new Otlp() + new OtlpModel() .withProtocol("http/protobuf") .withEndpoint("http://example:4318") .withHeaders( - new Headers() + new HeadersModel() .withAdditionalProperty("key1", "value1") .withAdditionalProperty("key2", "value2")) .withCompression("gzip") @@ -172,8 +172,8 @@ void create_Console() { SpanExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .SpanExporter() - .withConsole(new Console()), + .SpanExporterModel() + .withConsole(new ConsoleModel()), spiHelper, closeables); cleanup.addCloseable(exporter); @@ -194,8 +194,8 @@ void create_ZipkinDefaults() { SpanExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .SpanExporter() - .withZipkin(new Zipkin()), + .SpanExporterModel() + .withZipkin(new ZipkinModel()), spiHelper, closeables); cleanup.addCloseable(exporter); @@ -226,9 +226,9 @@ void create_ZipkinConfigured() { SpanExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .SpanExporter() + .SpanExporterModel() .withZipkin( - new Zipkin() + new ZipkinModel() .withEndpoint("http://zipkin:9411/v1/v2/spans") .withTimeout(15_000)), spiHelper, @@ -255,7 +255,7 @@ void create_SpiExporter_Unknown() { SpanExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .SpanExporter() + .SpanExporterModel() .withAdditionalProperty( "unknown_key", ImmutableMap.of("key1", "value1")), spiHelper, @@ -272,7 +272,7 @@ void create_SpiExporter_Valid() { SpanExporterFactory.getInstance() .create( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .SpanExporter() + .SpanExporterModel() .withAdditionalProperty("test", ImmutableMap.of("key1", "value1")), spiHelper, new ArrayList<>()); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsFactoryTest.java index c6d78c3b777..c6879ecc529 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanLimitsFactoryTest.java @@ -9,8 +9,8 @@ import static org.mockito.Mockito.mock; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanLimits; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanLimitsModel; import java.util.Collections; import java.util.stream.Stream; import org.junit.jupiter.params.ParameterizedTest; @@ -36,20 +36,24 @@ private static Stream createArguments() { SpanLimitsAndAttributeLimits.create(null, null), io.opentelemetry.sdk.trace.SpanLimits.getDefault()), Arguments.of( - SpanLimitsAndAttributeLimits.create(new AttributeLimits(), new SpanLimits()), + SpanLimitsAndAttributeLimits.create(new AttributeLimitsModel(), new SpanLimitsModel()), io.opentelemetry.sdk.trace.SpanLimits.getDefault()), Arguments.of( SpanLimitsAndAttributeLimits.create( - new AttributeLimits().withAttributeCountLimit(1).withAttributeValueLengthLimit(2), - new SpanLimits()), + new AttributeLimitsModel() + .withAttributeCountLimit(1) + .withAttributeValueLengthLimit(2), + new SpanLimitsModel()), io.opentelemetry.sdk.trace.SpanLimits.builder() .setMaxNumberOfAttributes(1) .setMaxAttributeValueLength(2) .build()), Arguments.of( SpanLimitsAndAttributeLimits.create( - new AttributeLimits().withAttributeCountLimit(1).withAttributeValueLengthLimit(2), - new SpanLimits() + new AttributeLimitsModel() + .withAttributeCountLimit(1) + .withAttributeValueLengthLimit(2), + new SpanLimitsModel() .withAttributeCountLimit(3) .withAttributeValueLengthLimit(4) .withEventCountLimit(5) diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanProcessorFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanProcessorFactoryTest.java index 19426bd1244..98af1e81ddc 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanProcessorFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/SpanProcessorFactoryTest.java @@ -14,11 +14,11 @@ import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; import io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException; import io.opentelemetry.sdk.extension.incubator.fileconfig.component.SpanProcessorComponentProvider; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleSpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessor; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SimpleSpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessorModel; import java.io.Closeable; import java.time.Duration; import java.util.ArrayList; @@ -41,7 +41,7 @@ void create_BatchNullExporter() { () -> SpanProcessorFactory.getInstance() .create( - new SpanProcessor().withBatch(new BatchSpanProcessor()), + new SpanProcessorModel().withBatch(new BatchSpanProcessorModel()), spiHelper, Collections.emptyList())) .isInstanceOf(ConfigurationException.class) @@ -60,10 +60,10 @@ void create_BatchDefaults() { io.opentelemetry.sdk.trace.SpanProcessor processor = SpanProcessorFactory.getInstance() .create( - new SpanProcessor() + new SpanProcessorModel() .withBatch( - new BatchSpanProcessor() - .withExporter(new SpanExporter().withOtlp(new Otlp()))), + new BatchSpanProcessorModel() + .withExporter(new SpanExporterModel().withOtlp(new OtlpModel()))), spiHelper, closeables); cleanup.addCloseable(processor); @@ -87,10 +87,10 @@ void create_BatchConfigured() { io.opentelemetry.sdk.trace.SpanProcessor processor = SpanProcessorFactory.getInstance() .create( - new SpanProcessor() + new SpanProcessorModel() .withBatch( - new BatchSpanProcessor() - .withExporter(new SpanExporter().withOtlp(new Otlp())) + new BatchSpanProcessorModel() + .withExporter(new SpanExporterModel().withOtlp(new OtlpModel())) .withScheduleDelay(1) .withMaxExportBatchSize(2) .withExportTimeout(3)), @@ -108,7 +108,7 @@ void create_SimpleNullExporter() { () -> SpanProcessorFactory.getInstance() .create( - new SpanProcessor().withSimple(new SimpleSpanProcessor()), + new SpanProcessorModel().withSimple(new SimpleSpanProcessorModel()), spiHelper, Collections.emptyList())) .isInstanceOf(ConfigurationException.class) @@ -126,10 +126,10 @@ void create_SimpleConfigured() { io.opentelemetry.sdk.trace.SpanProcessor processor = SpanProcessorFactory.getInstance() .create( - new SpanProcessor() + new SpanProcessorModel() .withSimple( - new SimpleSpanProcessor() - .withExporter(new SpanExporter().withOtlp(new Otlp()))), + new SimpleSpanProcessorModel() + .withExporter(new SpanExporterModel().withOtlp(new OtlpModel()))), spiHelper, closeables); cleanup.addCloseable(processor); @@ -144,7 +144,7 @@ void create_SpiProcessor_Unknown() { () -> SpanProcessorFactory.getInstance() .create( - new SpanProcessor() + new SpanProcessorModel() .withAdditionalProperty( "unknown_key", ImmutableMap.of("key1", "value1")), spiHelper, @@ -159,7 +159,7 @@ void create_SpiExporter_Valid() { io.opentelemetry.sdk.trace.SpanProcessor spanProcessor = SpanProcessorFactory.getInstance() .create( - new SpanProcessor() + new SpanProcessorModel() .withAdditionalProperty("test", ImmutableMap.of("key1", "value1")), spiHelper, new ArrayList<>()); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderFactoryTest.java index b3c637e124f..a46ac9cdd79 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/TracerProviderFactoryTest.java @@ -11,14 +11,14 @@ import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter; import io.opentelemetry.internal.testing.CleanupExtension; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOn; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimits; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Otlp; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Sampler; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporter; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessor; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProvider; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AlwaysOnModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AttributeLimitsModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.BatchSpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OtlpModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SamplerModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanExporterModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.SpanProcessorModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.TracerProviderModel; import io.opentelemetry.sdk.trace.SdkTracerProvider; import io.opentelemetry.sdk.trace.SpanLimits; import java.io.Closeable; @@ -58,28 +58,30 @@ private static Stream createArguments() { TracerProviderAndAttributeLimits.create(null, null), SdkTracerProvider.builder().build()), Arguments.of( - TracerProviderAndAttributeLimits.create(new AttributeLimits(), new TracerProvider()), + TracerProviderAndAttributeLimits.create( + new AttributeLimitsModel(), new TracerProviderModel()), SdkTracerProvider.builder().build()), Arguments.of( TracerProviderAndAttributeLimits.create( - new AttributeLimits(), - new TracerProvider() + new AttributeLimitsModel(), + new TracerProviderModel() .withLimits( new io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model - .SpanLimits() + .SpanLimitsModel() .withAttributeCountLimit(1) .withAttributeValueLengthLimit(2) .withEventCountLimit(3) .withLinkCountLimit(4) .withEventAttributeCountLimit(5) .withLinkAttributeCountLimit(6)) - .withSampler(new Sampler().withAlwaysOn(new AlwaysOn())) + .withSampler(new SamplerModel().withAlwaysOn(new AlwaysOnModel())) .withProcessors( Collections.singletonList( - new SpanProcessor() + new SpanProcessorModel() .withBatch( - new BatchSpanProcessor() - .withExporter(new SpanExporter().withOtlp(new Otlp())))))), + new BatchSpanProcessorModel() + .withExporter( + new SpanExporterModel().withOtlp(new OtlpModel())))))), SdkTracerProvider.builder() .setSpanLimits( SpanLimits.builder() diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactoryTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactoryTest.java index 087e68d5790..3e09caa4ad9 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactoryTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/ViewFactoryTest.java @@ -9,9 +9,9 @@ import static org.mockito.Mockito.mock; import io.opentelemetry.sdk.autoconfigure.internal.SpiHelper; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Aggregation; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogram; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.Stream; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.AggregationModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.ExplicitBucketHistogramModel; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.StreamModel; import io.opentelemetry.sdk.metrics.View; import java.util.Arrays; import java.util.Collections; @@ -27,7 +27,7 @@ void create_Defaults() { View view = ViewFactory.getInstance() .create( - new Stream().withAttributeKeys(null), + new StreamModel().withAttributeKeys(null), mock(SpiHelper.class), Collections.emptyList()); @@ -49,14 +49,14 @@ void create() { View view = ViewFactory.getInstance() .create( - new Stream() + new StreamModel() .withName("name") .withDescription("description") .withAttributeKeys(Arrays.asList("foo", "bar")) .withAggregation( - new Aggregation() + new AggregationModel() .withExplicitBucketHistogram( - new ExplicitBucketHistogram() + new ExplicitBucketHistogramModel() .withBoundaries(Arrays.asList(1.0, 2.0)))), mock(SpiHelper.class), Collections.emptyList()); diff --git a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigPropertiesTest.java b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigPropertiesTest.java index b29e4c97162..7e6ba27b522 100644 --- a/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigPropertiesTest.java +++ b/sdk-extensions/incubator/src/test/java/io/opentelemetry/sdk/extension/incubator/fileconfig/YamlStructuredConfigPropertiesTest.java @@ -9,7 +9,7 @@ import com.google.common.collect.ImmutableSet; import io.opentelemetry.sdk.autoconfigure.spi.internal.StructuredConfigProperties; -import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfiguration; +import io.opentelemetry.sdk.extension.incubator.fileconfig.internal.model.OpenTelemetryConfigurationModel; import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import java.util.Arrays; @@ -58,7 +58,7 @@ class YamlStructuredConfigPropertiesTest { @BeforeEach void setup() { - OpenTelemetryConfiguration configuration = + OpenTelemetryConfigurationModel configuration = FileConfiguration.parse( new ByteArrayInputStream(extendedSchema.getBytes(StandardCharsets.UTF_8))); structuredConfigProps = FileConfiguration.toConfigProperties(configuration);