use of com.wavefront.sdk.common.WavefrontSender in project spring-boot by spring-projects.
the class WavefrontMetricsExportAutoConfigurationTests method configureWavefrontSender.
@Test
void configureWavefrontSender() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class).withPropertyValues("management.metrics.export.wavefront.api-token=abcde", "management.metrics.export.wavefront.batch-size=50", "management.metrics.export.wavefront.sender.max-queue-size=100", "management.metrics.export.wavefront.sender.message-size=1KB").run((context) -> {
WavefrontSender sender = context.getBean(WavefrontSender.class);
assertThat(sender).hasFieldOrPropertyWithValue("batchSize", 50);
assertThat(sender).extracting("metricsBuffer", as(InstanceOfAssertFactories.type(LinkedBlockingQueue.class))).satisfies((queue) -> assertThat(queue.remainingCapacity() + queue.size()).isEqualTo(100));
assertThat(sender).hasFieldOrPropertyWithValue("messageSizeBytes", 1024);
});
}
use of com.wavefront.sdk.common.WavefrontSender in project spring-boot by spring-projects.
the class WavefrontMetricsExportAutoConfigurationTests method defaultWavefrontSenderSettingsAreConsistent.
@Test
void defaultWavefrontSenderSettingsAreConsistent() {
this.contextRunner.withUserConfiguration(BaseConfiguration.class).withPropertyValues("management.metrics.export.wavefront.api-token=abcde").run((context) -> {
WavefrontProperties properties = new WavefrontProperties();
WavefrontSender sender = context.getBean(WavefrontSender.class);
assertThat(sender).extracting("metricsBuffer", as(InstanceOfAssertFactories.type(LinkedBlockingQueue.class))).satisfies((queue) -> assertThat(queue.remainingCapacity() + queue.size()).isEqualTo(properties.getSender().getMaxQueueSize()));
assertThat(sender).hasFieldOrPropertyWithValue("batchSize", properties.getBatchSize());
assertThat(sender).hasFieldOrPropertyWithValue("messageSizeBytes", (int) properties.getSender().getMessageSize().toBytes());
});
}
use of com.wavefront.sdk.common.WavefrontSender in project spring-boot by spring-projects.
the class WavefrontMetricsExportAutoConfiguration method createWavefrontSender.
private WavefrontSender createWavefrontSender(WavefrontConfig wavefrontConfig) {
Builder builder = WavefrontMeterRegistry.getDefaultSenderBuilder(wavefrontConfig);
PropertyMapper mapper = PropertyMapper.get().alwaysApplyingWhenNonNull();
Sender sender = this.properties.getSender();
mapper.from(sender.getMaxQueueSize()).to(builder::maxQueueSize);
mapper.from(sender.getFlushInterval()).asInt(Duration::getSeconds).to(builder::flushIntervalSeconds);
mapper.from(sender.getMessageSize()).asInt(DataSize::toBytes).to(builder::messageSizeBytes);
return builder.build();
}
Aggregations