Skip to content

Commit

Permalink
Closes #927 - Added buffering option to influx exporter (#928)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Kunz authored Sep 21, 2020
1 parent 172258a commit 7840de5
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/inspectit-ocelot-eum-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dependencies {
'com.maxmind.geoip2:geoip2:2.12.0',
'commons-net:commons-net:3.3',
'org.springframework.boot:spring-boot-starter-actuator',
"rocks.inspectit:opencensus-influxdb-exporter:1.1",
"rocks.inspectit:opencensus-influxdb-exporter:1.2",
"org.influxdb:influxdb-java:2.15"
)
compileOnly "org.projectlombok:lombok:1.18.12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private void doEnable() {
.password(influx.getPassword())
.createDatabase(influx.isCreateDatabase())
.exportDifference(influx.isCountersAsDifferences())
.bufferSize(influx.getBufferSize())
.build();
exporterTask = executor.scheduleAtFixedRate(activeExporter::export, 0, influx.getExportInterval()
.toMillis(), TimeUnit.MILLISECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ inspectit-eum-server:
# This difference will only be written if the counter has changed (=the difference is non-zero).
# This can greatly reduce the total data written to influx and makes writing queries easier.
counters-as-differences: true
# The size of the buffer for failed batches.
# E.g. if the exportInterval is 15s and the buffer-size is 4, the export will keep up to one minute of data in memory.
buffer-size: 40
tracing:
jaeger:
# if jaeger exporter for the OT received spans is enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Data;
import org.hibernate.validator.constraints.time.DurationMin;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.time.Duration;

Expand Down Expand Up @@ -62,4 +63,11 @@ public class InfluxExporterSettings {
* This can greatly reduce the total data written to influx and makes writing queries easier.
*/
private boolean countersAsDifferences;

/**
* The size of the buffer for failed batches.
* E.g. if the exportInterval is 15s and the buffer-size is 4, the export will keep up to one minute of data in memory.
*/
@Min(1)
private int bufferSize;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ inspectit:
# This difference will only be written if the counter has changed (=the difference is non-zero).
# This can greatly reduce the total data written to influx and makes writing queries easier.
counters-as-differences: true
# The size of the buffer for failed batches.
# E.g. if the exportInterval is 15s and the buffer-size is 4, the export will keep up to one minute of data in memory.
buffer-size: 40

# settings for trace exporters
tracing:
Expand Down
2 changes: 1 addition & 1 deletion inspectit-ocelot-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ dependencies {
'io.netty:netty-tcnative-boringssl-static:2.0.20.Final',


"rocks.inspectit:opencensus-influxdb-exporter:1.1",
"rocks.inspectit:opencensus-influxdb-exporter:1.2",

// bytecode manipulation
"net.bytebuddy:byte-buddy:1.10.14"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ protected boolean doEnable(InspectitConfig configuration) {
.createDatabase(influx.isCreateDatabase())
.exportDifference(influx.isCountersAsDifferences())
.measurementNameProvider(percentileViewManager::getMeasureNameForSeries)
.bufferSize(influx.getBufferSize())
.build();
exporterTask = executor.scheduleAtFixedRate(activeExporter::export, 0, influx.getExportInterval()
.toMillis(), TimeUnit.MILLISECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ The following properties are nested properties below the `inspectit.exporters.me
|`.retention-policy`|`autogen`| The retention policy of the database to use for writing metrics.
|`.create-database`|`true`| If enabled, the database defined by the `database` property is automatically created on startup with an `autogen` retention policy if it does not exist yet.
|`.export-interval`|refers to `inspectit.metrics.frequency`|Defines how often metrics are pushed to the influxDB.
|<nobr>`.counters-as-differences`</nobr>|`true`|Defines whether counters are exported using their absolute value or as the increase between exports
|<nobr>`.counters-as-differences`</nobr>|`true`|Defines whether counters are exported using their absolute value or as the increase between exports
|`buffer-size`| `40` | In case the influxDB is not reachable, failed writes will be buffered and written on the next export. This value defines the maximum number of batches to buffer.

0 comments on commit 7840de5

Please sign in to comment.