Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ void getInstrumentationConfigModel_KitchenSink() {
withInstrumentationConfig(
"my_instrumentation_library",
new ExperimentalLanguageSpecificInstrumentationPropertyModel()
.withAdditionalProperty("string_property", "value")
.withAdditionalProperty("boolean_property", true)
.withAdditionalProperty("long_property", 1L)
.withAdditionalProperty("double_property", 1.1d)
.withAdditionalProperty("string_list_property", Arrays.asList("val1", "val2"))
.withAdditionalProperty("boolean_list_property", Arrays.asList(true, false))
.withAdditionalProperty("long_list_property", Arrays.asList(1L, 2L))
.withAdditionalProperty("double_list_property", Arrays.asList(1.1d, 2.2d))
.withAdditionalProperty("map_property", Collections.singletonMap("childKey", "val"))
.withAdditionalProperty(
.setAdditionalProperty("string_property", "value")
.setAdditionalProperty("boolean_property", true)
.setAdditionalProperty("long_property", 1L)
.setAdditionalProperty("double_property", 1.1d)
.setAdditionalProperty("string_list_property", Arrays.asList("val1", "val2"))
.setAdditionalProperty("boolean_list_property", Arrays.asList(true, false))
.setAdditionalProperty("long_list_property", Arrays.asList(1L, 2L))
.setAdditionalProperty("double_list_property", Arrays.asList(1.1d, 2.2d))
.setAdditionalProperty("map_property", Collections.singletonMap("childKey", "val"))
.setAdditionalProperty(
"structured_list_property",
Collections.singletonList(
ImmutableMap.of("key", "the_key", "value", "the_value"))));
Expand Down Expand Up @@ -130,12 +130,12 @@ private static ConfigProvider withInstrumentationConfig(
ExperimentalLanguageSpecificInstrumentationPropertyModel instrumentationConfig) {
ExperimentalLanguageSpecificInstrumentationModel javaConfig =
new ExperimentalLanguageSpecificInstrumentationModel();
javaConfig.withAdditionalProperty(instrumentationName, instrumentationConfig);
javaConfig.setAdditionalProperty(instrumentationName, instrumentationConfig);
DeclarativeConfigProperties modelProperties =
DeclarativeConfiguration.toConfigProperties(
OpenTelemetryConfigurationModelAccessor.withInstrumentation(
OpenTelemetryConfigurationModelAccessor.setInstrumentation(
new OpenTelemetryConfigurationModel(),
new ExperimentalInstrumentationModel().withJava(javaConfig)));
new ExperimentalInstrumentationModel().setJava(javaConfig)));

return SdkConfigProvider.create(modelProperties);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class DeclarativeConfigPojoGenerator(

/**
* The base name used to build getter/builder names. Strips the leading underscore from
* "_default" so the methods are "getDefault"/"withDefault", not "get_default".
* "_default" so the methods are "getDefault"/"setDefault", not "get_default".
*/
private fun baseNameFor(jsonKey: String): String {
val field = fieldName(jsonKey)
Expand All @@ -111,7 +111,7 @@ class DeclarativeConfigPojoGenerator(
"get${baseNameFor(jsonKey).replaceFirstChar { it.uppercase() }}"

private fun builderName(jsonKey: String) =
"with${baseNameFor(jsonKey).replaceFirstChar { it.uppercase() }}"
"set${baseNameFor(jsonKey).replaceFirstChar { it.uppercase() }}"

// ── Type resolution ──────────────────────────────────────────────────────────

Expand Down Expand Up @@ -465,7 +465,7 @@ class DeclarativeConfigPojoGenerator(
append(" @JsonAnyGetter\n")
append(" public $additionalPropsType getAdditionalProperties() {\n return this.additionalProperties;\n }\n\n")
append(" @JsonAnySetter\n")
append(" public $className withAdditionalProperty(String name, $apValueType value) {\n")
append(" public $className setAdditionalProperty(String name, $apValueType value) {\n")
append(" this.additionalProperties.put(name, value);\n return this;\n }\n\n")
}

Expand All @@ -479,7 +479,7 @@ class DeclarativeConfigPojoGenerator(
}
append(" }\n\n")
append(" @JsonAnySetter\n")
append(" public $className withExtensionProperty(String name, @Nullable Object value) {\n")
append(" public $className setExtensionProperty(String name, @Nullable Object value) {\n")
append(" ExtensionPropertyUtil.handleAnySetter(\n")
val experimentalPropsArg = if (expProps.isNotEmpty()) "EXPERIMENTAL_PROPERTIES" else "Collections.emptyMap()"
val stablePropsArg = if (stableObjectProps.isNotEmpty()) "STABLE_PROPERTIES" else "Collections.emptyMap()"
Expand Down Expand Up @@ -591,7 +591,7 @@ class DeclarativeConfigPojoGenerator(
append(" public static $stableClassName ${p.builder}(\n")
append(" $stableClassName model, ${p.typeExpr} value) {\n")
append(" requireNonNull(value, \"value\");\n")
append(" model.withExtensionProperty(${p.constName}, value);\n")
append(" model.setExtensionProperty(${p.constName}, value);\n")
append(" return model;\n")
append(" }\n\n")
}
Expand All @@ -618,7 +618,7 @@ class DeclarativeConfigPojoGenerator(
append(" @JsonAnyGetter\n")
append(" public Map<String, Object> getAdditionalProperties() {\n return this.additionalProperties;\n }\n\n")
append(" @JsonAnySetter\n")
append(" public $className withAdditionalProperty(String name, Object value) {\n")
append(" public $className setAdditionalProperty(String name, Object value) {\n")
append(" this.additionalProperties.put(name, value);\n return this;\n }\n\n")
appendToString(className, listOf("additionalProperties"))
append("\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public DefaultAggregationModel getDefault() {
}

@JsonProperty(DEFAULT)
public AggregationModel withDefault(DefaultAggregationModel _default) {
public AggregationModel setDefault(DefaultAggregationModel _default) {
this._default = _default;
return this;
}
Expand All @@ -109,7 +109,7 @@ public DropAggregationModel getDrop() {
}

@JsonProperty(DROP)
public AggregationModel withDrop(DropAggregationModel drop) {
public AggregationModel setDrop(DropAggregationModel drop) {
this.drop = drop;
return this;
}
Expand All @@ -135,7 +135,7 @@ public ExplicitBucketHistogramAggregationModel getExplicitBucketHistogram() {
}

@JsonProperty(EXPLICIT_BUCKET_HISTOGRAM)
public AggregationModel withExplicitBucketHistogram(
public AggregationModel setExplicitBucketHistogram(
ExplicitBucketHistogramAggregationModel explicitBucketHistogram) {
this.explicitBucketHistogram = explicitBucketHistogram;
return this;
Expand Down Expand Up @@ -163,7 +163,7 @@ public Base2ExponentialBucketHistogramAggregationModel getBase2ExponentialBucket
}

@JsonProperty(BASE_2_EXPONENTIAL_BUCKET_HISTOGRAM)
public AggregationModel withBase2ExponentialBucketHistogram(
public AggregationModel setBase2ExponentialBucketHistogram(
Base2ExponentialBucketHistogramAggregationModel base2ExponentialBucketHistogram) {
this.base2ExponentialBucketHistogram = base2ExponentialBucketHistogram;
return this;
Expand All @@ -187,7 +187,7 @@ public LastValueAggregationModel getLastValue() {
}

@JsonProperty(LAST_VALUE)
public AggregationModel withLastValue(LastValueAggregationModel lastValue) {
public AggregationModel setLastValue(LastValueAggregationModel lastValue) {
this.lastValue = lastValue;
return this;
}
Expand All @@ -210,7 +210,7 @@ public SumAggregationModel getSum() {
}

@JsonProperty(SUM)
public AggregationModel withSum(SumAggregationModel sum) {
public AggregationModel setSum(SumAggregationModel sum) {
this.sum = sum;
return this;
}
Expand All @@ -221,7 +221,7 @@ public Map<String, Object> getExtensionProperties() {
}

@JsonAnySetter
public AggregationModel withExtensionProperty(String name, @Nullable Object value) {
public AggregationModel setExtensionProperty(String name, @Nullable Object value) {
ExtensionPropertyUtil.handleAnySetter(
name,
value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Integer getAttributeValueLengthLimit() {
}

@JsonProperty(ATTRIBUTE_VALUE_LENGTH_LIMIT)
public AttributeLimitsModel withAttributeValueLengthLimit(Integer attributeValueLengthLimit) {
public AttributeLimitsModel setAttributeValueLengthLimit(Integer attributeValueLengthLimit) {
this.attributeValueLengthLimit = attributeValueLengthLimit;
return this;
}
Expand All @@ -84,7 +84,7 @@ public Integer getAttributeCountLimit() {
}

@JsonProperty(ATTRIBUTE_COUNT_LIMIT)
public AttributeLimitsModel withAttributeCountLimit(Integer attributeCountLimit) {
public AttributeLimitsModel setAttributeCountLimit(Integer attributeCountLimit) {
this.attributeCountLimit = attributeCountLimit;
return this;
}
Expand All @@ -95,7 +95,7 @@ public Map<String, Object> getExtensionProperties() {
}

@JsonAnySetter
public AttributeLimitsModel withExtensionProperty(String name, @Nullable Object value) {
public AttributeLimitsModel setExtensionProperty(String name, @Nullable Object value) {
ExtensionPropertyUtil.handleAnySetter(
name,
value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public String getName() {
}

@JsonProperty(NAME)
public AttributeNameValueModel withName(String name) {
public AttributeNameValueModel setName(String name) {
this.name = name;
return this;
}
Expand All @@ -84,7 +84,7 @@ public Object getValue() {
}

@JsonProperty(VALUE)
public AttributeNameValueModel withValue(Object value) {
public AttributeNameValueModel setValue(Object value) {
this.value = value;
return this;
}
Expand Down Expand Up @@ -123,7 +123,7 @@ public AttributeTypeModel getType() {
}

@JsonProperty(TYPE)
public AttributeNameValueModel withType(AttributeTypeModel type) {
public AttributeNameValueModel setType(AttributeTypeModel type) {
this.type = type;
return this;
}
Expand All @@ -134,7 +134,7 @@ public Map<String, Object> getExtensionProperties() {
}

@JsonAnySetter
public AttributeNameValueModel withExtensionProperty(String name, @Nullable Object value) {
public AttributeNameValueModel setExtensionProperty(String name, @Nullable Object value) {
ExtensionPropertyUtil.handleAnySetter(
name,
value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public Integer getMaxScale() {
}

@JsonProperty(MAX_SCALE)
public Base2ExponentialBucketHistogramAggregationModel withMaxScale(Integer maxScale) {
public Base2ExponentialBucketHistogramAggregationModel setMaxScale(Integer maxScale) {
this.maxScale = maxScale;
return this;
}
Expand All @@ -83,7 +83,7 @@ public Integer getMaxSize() {
}

@JsonProperty(MAX_SIZE)
public Base2ExponentialBucketHistogramAggregationModel withMaxSize(Integer maxSize) {
public Base2ExponentialBucketHistogramAggregationModel setMaxSize(Integer maxSize) {
this.maxSize = maxSize;
return this;
}
Expand All @@ -103,7 +103,7 @@ public Boolean getRecordMinMax() {
}

@JsonProperty(RECORD_MIN_MAX)
public Base2ExponentialBucketHistogramAggregationModel withRecordMinMax(Boolean recordMinMax) {
public Base2ExponentialBucketHistogramAggregationModel setRecordMinMax(Boolean recordMinMax) {
this.recordMinMax = recordMinMax;
return this;
}
Expand All @@ -114,7 +114,7 @@ public Map<String, Object> getExtensionProperties() {
}

@JsonAnySetter
public Base2ExponentialBucketHistogramAggregationModel withExtensionProperty(
public Base2ExponentialBucketHistogramAggregationModel setExtensionProperty(
String name, @Nullable Object value) {
ExtensionPropertyUtil.handleAnySetter(
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Integer getScheduleDelay() {
}

@JsonProperty(SCHEDULE_DELAY)
public BatchLogRecordProcessorModel withScheduleDelay(Integer scheduleDelay) {
public BatchLogRecordProcessorModel setScheduleDelay(Integer scheduleDelay) {
this.scheduleDelay = scheduleDelay;
return this;
}
Expand All @@ -100,7 +100,7 @@ public Integer getExportTimeout() {
}

@JsonProperty(EXPORT_TIMEOUT)
public BatchLogRecordProcessorModel withExportTimeout(Integer exportTimeout) {
public BatchLogRecordProcessorModel setExportTimeout(Integer exportTimeout) {
this.exportTimeout = exportTimeout;
return this;
}
Expand All @@ -120,7 +120,7 @@ public Integer getMaxQueueSize() {
}

@JsonProperty(MAX_QUEUE_SIZE)
public BatchLogRecordProcessorModel withMaxQueueSize(Integer maxQueueSize) {
public BatchLogRecordProcessorModel setMaxQueueSize(Integer maxQueueSize) {
this.maxQueueSize = maxQueueSize;
return this;
}
Expand All @@ -141,7 +141,7 @@ public Integer getMaxExportBatchSize() {
}

@JsonProperty(MAX_EXPORT_BATCH_SIZE)
public BatchLogRecordProcessorModel withMaxExportBatchSize(Integer maxExportBatchSize) {
public BatchLogRecordProcessorModel setMaxExportBatchSize(Integer maxExportBatchSize) {
this.maxExportBatchSize = maxExportBatchSize;
return this;
}
Expand All @@ -162,7 +162,7 @@ public LogRecordExporterModel getExporter() {
}

@JsonProperty(EXPORTER)
public BatchLogRecordProcessorModel withExporter(LogRecordExporterModel exporter) {
public BatchLogRecordProcessorModel setExporter(LogRecordExporterModel exporter) {
this.exporter = exporter;
return this;
}
Expand All @@ -173,7 +173,7 @@ public Map<String, Object> getExtensionProperties() {
}

@JsonAnySetter
public BatchLogRecordProcessorModel withExtensionProperty(String name, @Nullable Object value) {
public BatchLogRecordProcessorModel setExtensionProperty(String name, @Nullable Object value) {
ExtensionPropertyUtil.handleAnySetter(
name,
value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Integer getScheduleDelay() {
}

@JsonProperty(SCHEDULE_DELAY)
public BatchSpanProcessorModel withScheduleDelay(Integer scheduleDelay) {
public BatchSpanProcessorModel setScheduleDelay(Integer scheduleDelay) {
this.scheduleDelay = scheduleDelay;
return this;
}
Expand All @@ -100,7 +100,7 @@ public Integer getExportTimeout() {
}

@JsonProperty(EXPORT_TIMEOUT)
public BatchSpanProcessorModel withExportTimeout(Integer exportTimeout) {
public BatchSpanProcessorModel setExportTimeout(Integer exportTimeout) {
this.exportTimeout = exportTimeout;
return this;
}
Expand All @@ -120,7 +120,7 @@ public Integer getMaxQueueSize() {
}

@JsonProperty(MAX_QUEUE_SIZE)
public BatchSpanProcessorModel withMaxQueueSize(Integer maxQueueSize) {
public BatchSpanProcessorModel setMaxQueueSize(Integer maxQueueSize) {
this.maxQueueSize = maxQueueSize;
return this;
}
Expand All @@ -141,7 +141,7 @@ public Integer getMaxExportBatchSize() {
}

@JsonProperty(MAX_EXPORT_BATCH_SIZE)
public BatchSpanProcessorModel withMaxExportBatchSize(Integer maxExportBatchSize) {
public BatchSpanProcessorModel setMaxExportBatchSize(Integer maxExportBatchSize) {
this.maxExportBatchSize = maxExportBatchSize;
return this;
}
Expand All @@ -162,7 +162,7 @@ public SpanExporterModel getExporter() {
}

@JsonProperty(EXPORTER)
public BatchSpanProcessorModel withExporter(SpanExporterModel exporter) {
public BatchSpanProcessorModel setExporter(SpanExporterModel exporter) {
this.exporter = exporter;
return this;
}
Expand All @@ -173,7 +173,7 @@ public Map<String, Object> getExtensionProperties() {
}

@JsonAnySetter
public BatchSpanProcessorModel withExtensionProperty(String name, @Nullable Object value) {
public BatchSpanProcessorModel setExtensionProperty(String name, @Nullable Object value) {
ExtensionPropertyUtil.handleAnySetter(
name,
value,
Expand Down
Loading
Loading