Skip to content

Commit f5c9d34

Browse files
Wzy19930507mhalbritter
authored andcommitted
Unify 'observation-enabled' property defaults
Change spring.pulsar.listener.observation-enabled and spring.pulsar.template.observations-enabled to false See gh-39276
1 parent 50cae75 commit f5c9d34

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ public static class Listener {
761761
* Whether to record observations for when the Observations API is available and
762762
* the client supports it.
763763
*/
764-
private boolean observationEnabled = true;
764+
private boolean observationEnabled;
765765

766766
public SchemaType getSchemaType() {
767767
return this.schemaType;
@@ -856,7 +856,7 @@ public static class Template {
856856
/**
857857
* Whether to record observations for when the Observations API is available.
858858
*/
859-
private boolean observationsEnabled = true;
859+
private boolean observationsEnabled;
860860

861861
public boolean isObservationsEnabled() {
862862
return this.observationsEnabled;

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/pulsar/PulsarAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ void whenHasUseDefinedProducerInterceptorsInjectsBeansInCorrectOrder() {
304304
@Test
305305
void whenNoPropertiesEnablesObservation() {
306306
this.contextRunner.run((context) -> assertThat(context).getBean(PulsarTemplate.class)
307-
.hasFieldOrPropertyWithValue("observationEnabled", true));
307+
.hasFieldOrPropertyWithValue("observationEnabled", false));
308308
}
309309

310310
@Test
@@ -451,7 +451,7 @@ void whenHasCustomProperties() {
451451
void whenNoPropertiesEnablesObservation() {
452452
this.contextRunner
453453
.run((context) -> assertThat(context).getBean(ConcurrentPulsarListenerContainerFactory.class)
454-
.hasFieldOrPropertyWithValue("containerProperties.observationEnabled", true));
454+
.hasFieldOrPropertyWithValue("containerProperties.observationEnabled", false));
455455
}
456456

457457
@Test

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesMapperTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,12 @@ void customizeContainerProperties() {
219219
PulsarProperties properties = new PulsarProperties();
220220
properties.getConsumer().getSubscription().setType(SubscriptionType.Shared);
221221
properties.getListener().setSchemaType(SchemaType.AVRO);
222-
properties.getListener().setObservationEnabled(false);
222+
properties.getListener().setObservationEnabled(true);
223223
PulsarContainerProperties containerProperties = new PulsarContainerProperties("my-topic-pattern");
224224
new PulsarPropertiesMapper(properties).customizeContainerProperties(containerProperties);
225225
assertThat(containerProperties.getSubscriptionType()).isEqualTo(SubscriptionType.Shared);
226226
assertThat(containerProperties.getSchemaType()).isEqualTo(SchemaType.AVRO);
227-
assertThat(containerProperties.isObservationEnabled()).isFalse();
227+
assertThat(containerProperties.isObservationEnabled()).isTrue();
228228
}
229229

230230
@Test

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ class ListenerProperties {
354354
void bind() {
355355
Map<String, String> map = new HashMap<>();
356356
map.put("spring.pulsar.listener.schema-type", "avro");
357-
map.put("spring.pulsar.listener.observation-enabled", "false");
357+
map.put("spring.pulsar.listener.observation-enabled", "true");
358358
PulsarProperties.Listener properties = bindPropeties(map).getListener();
359359
assertThat(properties.getSchemaType()).isEqualTo(SchemaType.AVRO);
360-
assertThat(properties.isObservationEnabled()).isFalse();
360+
assertThat(properties.isObservationEnabled()).isTrue();
361361
}
362362

363363
}
@@ -389,9 +389,9 @@ class TemplateProperties {
389389
@Test
390390
void bind() {
391391
Map<String, String> map = new HashMap<>();
392-
map.put("spring.pulsar.template.observations-enabled", "false");
392+
map.put("spring.pulsar.template.observations-enabled", "true");
393393
PulsarProperties.Template properties = bindPropeties(map).getTemplate();
394-
assertThat(properties.isObservationsEnabled()).isFalse();
394+
assertThat(properties.isObservationsEnabled()).isTrue();
395395
}
396396

397397
}

0 commit comments

Comments
 (0)