-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from mariusoe/spring-actuator
Adding Spring Boot Web for Actuators and configuring InfluxDB auto-conf
- Loading branch information
Showing
7 changed files
with
126 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,4 @@ | |
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
application.yml | ||
/.nb-gradle/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
src/main/java/de/novatec/baselining/config/InfluxSettings.java
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
src/main/java/de/novatec/baselining/spring/BeanConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package de.novatec.baselining.spring; | ||
|
||
import okhttp3.OkHttpClient; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.influx.InfluxDbOkHttpClientBuilderProvider; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import java.time.Duration; | ||
|
||
@Configuration | ||
public class BeanConfiguration { | ||
|
||
@Value("${spring.influx.connect-timeout:60s}") | ||
private Duration connectTimeout; | ||
|
||
@Value("${spring.influx.read-timeout:60s}") | ||
private Duration readTimeout; | ||
|
||
@Value("${spring.influx.write-timeout:60s}") | ||
private Duration writeTimeout; | ||
|
||
/** | ||
* Used by the {@link org.springframework.boot.autoconfigure.influx.InfluxDbAutoConfiguration} to | ||
* create the {@link org.influxdb.InfluxDB} client. | ||
* | ||
* @return HTTP builder which is used for the InfluxDB client. | ||
*/ | ||
@Bean | ||
public InfluxDbOkHttpClientBuilderProvider influxOkHttpClientBuilderProvider() { | ||
return () -> { | ||
OkHttpClient.Builder builder = new OkHttpClient.Builder(); | ||
|
||
if (connectTimeout != null) { | ||
builder.connectTimeout(connectTimeout); | ||
} | ||
if (connectTimeout != null) { | ||
builder.readTimeout(readTimeout); | ||
} | ||
if (connectTimeout != null) { | ||
builder.writeTimeout(writeTimeout); | ||
} | ||
|
||
return builder; | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
server: | ||
port: 8080 | ||
|
||
spring: | ||
influx: | ||
# URL of the InfluxDB | ||
url: http://localhost:8086 | ||
# Username for the InfluxDB | ||
user: "root" | ||
# Password for the InfluxDB | ||
password: "" | ||
|
||
## OPTIONAL: timeout to use when connecting to influx | ||
# connect-timeout: 60s | ||
## OPTIONAL: timeout to use when reading data from influx | ||
# read-timeout: 60s | ||
## OPTIONAL: timeout to use when writing data to influx | ||
# write-timeout: 60s | ||
|
||
|
||
baselining: | ||
|
||
# When starting up, the service will compute baselines based on historical data | ||
# This defines how far the service should look into the past | ||
backfill: 30d | ||
|
||
# Commonly data takes some time until it actual gets to the influxDB | ||
# This property tells the service to wait the given amount of time before updating the baselines. | ||
# E.g. a delay of 30s means that the baselines for 14:00 to 15:00 will be computed at 15:00:30 | ||
update-delay: 30s | ||
|
||
# #Baselines for gauge metrics | ||
# gauges: | ||
# - precision: 15m | ||
# seasonality: 1d | ||
# input: baseline.autogen.sinus.value | ||
# output: baseline.autogen.sinus_baseline | ||
# | ||
# # Baselines for counters (increase per second) | ||
# counters: | ||
# - precision: 15m | ||
# seasonality: 7d | ||
# windows: [28d, 56d] | ||
# input: telegraf.autogen.http_requests_count.value | ||
# output: baselines.autogen.http_request_rate_weekly | ||
# tags: [http_path] | ||
# | ||
# # Baselines for ratio between two counters (e.g. response time) | ||
# counter-ratios: | ||
# - precision: 15m | ||
# seasonality: 1d | ||
# windows: [15d, 30d] | ||
# input: telegraf.autogen.http_requests_time.counter | ||
# divide-by: telegraf.autogen.http_requests_count.counter | ||
# output: baselines.autogen.http_time_daily | ||
# tags: [http_path] |