Spring Boot

Axibase Time Series Database has a storage driver for Spring Boot.

You can find the ATSD Spring Boot Storage Driver on GitHub.

Settings

NameRequiredDefault ValueDescription
metrics.export.urlNohttp://localhost:8088/api/v1/commandATSD API URL
metrics.export.usernameYesATSD Username
metrics.export.passwordYesATSD Password
metrics.export.bufferSizeNo64Size of metrics buffer. Metrics writer flushes the buffer if it is full or by schedule (configured by spring.metrics.export.* properties)
metrics.names.entityNoatsd-defaultEntity name
metrics.names.metricPrefixNoA prefix to be added to original metric name
metrics.names.tags.*NoOptional set of key-value pairs in ATSD time series identifier

Configuration

Configuration settings are specified in the application.properties file.

application.properties file example:

metrics.export.username: admin
metrics.export.password: secret
metrics.export.url: http://localhost:8088/api/v1/command
metrics.export.bufferSize: 16
metrics.names.entity: spring-boot-sample
metrics.names.metricPrefix: spring-boot
metrics.names.tags.ip: 127.0.0.1
metrics.names.tags.organization: Axibase

Metrics

In order for the application to know about metrics.export. and metrics.names. they need to be specified in the configuration: AtsdNamingStrategy and AtsdMetricWriter

Enable public metrics export:

@Bean
	public MetricsEndpointMetricReader metricsEndpointMetricReader(MetricsEndpoint metricsEndpoint) {
		return new MetricsEndpointMetricReader(metricsEndpoint);
	}
 
        @Bean
	@ExportMetricWriter
	@ConfigurationProperties("metrics.export")
	public MetricWriter atsdMetricWriter() {
		AtsdMetricWriter writer = new AtsdMetricWriter();
		writer.setNamingStrategy(namingStrategy());
		return writer;
	}
 
	@Bean
	@ConfigurationProperties("metrics.names")
	public AtsdNamingStrategy namingStrategy() {
		return new DefaultAtsdNamingStrategy();
	}
Wrapping methods using custom metrics.

Wrap all class methods using custom metrics:

@Measured
public class JdbcCityRepository implements CityRepository

Wrap a single methods using custom metrics: