Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #694 - Added option to expose counters as differences to influxDB exporter #695

Merged
merged 3 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ hooks
/.nb-gradle/

/working_directory/
inspectit-ocelot-demo/configuration-server/users.db
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 @@ -61,7 +61,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.0",
"rocks.inspectit:opencensus-influxdb-exporter:1.1",
"org.influxdb:influxdb-java:2.15"
)
compileOnly "org.projectlombok:lombok:1.18.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ private boolean shouldEnable() {
private void doEnable() {
InfluxExporterSettings influx = config.getExporters().getMetrics().getInflux();
if (shouldEnable()) {
log.info("Starting InfluxDB Exporter to '{}:{}' on '{}'", influx.getDatabase(), influx.getRetentionPolicy(), influx.getUrl());
log.info("Starting InfluxDB Exporter to '{}:{}' on '{}'", influx.getDatabase(), influx.getRetentionPolicy(), influx
.getUrl());
activeExporter = InfluxExporter.builder()
.url(influx.getUrl())
.database(influx.getDatabase())
.retention(influx.getRetentionPolicy())
.user(influx.getUser())
.password(influx.getPassword())
.createDatabase(influx.isCreateDatabase())
.exportDifference(influx.isCountersAsDifferences())
.build();
exporterTask = executor.scheduleAtFixedRate(activeExporter::export, 0, influx.getExportInterval().toMillis(), TimeUnit.MILLISECONDS);
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 @@ -114,6 +114,11 @@ inspectit-eum-server:
retention-policy: "autogen"
# If true, the specified database will be created with the autogen retention policy
create-database: true
# If disabled, the raw values of each counter will be written to the InfluxDB on each export.
# When enabled, only the change of the counter in comparison to the previous export will be written.
# 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

# settings for the EUM server's self-monitoring
self-monitoring:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,12 @@ public class InfluxExporterSettings {
* If enabled, the Influx Exporter creates the specified database upon initial connection.
*/
private boolean createDatabase;

/**
* If disabled, the raw values of each counter will be written to the InfluxDB on each export.
* When enabled, only the change of the counter in comparison to the previous export will be written.
* This difference will only be exposed 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.
*/
private boolean countersAsDifferences;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ inspectit:
retention-policy: "autogen"
# If true, the specified database will be created with the autogen retention policy
create-database: true
# If disabled, the raw values of each counter will be written to the InfluxDB on each export.
# When enabled, only the change of the counter in comparison to the previous export will be written.
# 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

# 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 @@ -38,7 +38,6 @@ dependencies {
project(':inspectit-ocelot-config'),
project(':inspectit-ocelot-sdk'),

"rocks.inspectit:opencensus-influxdb-exporter:1.0",

// spring releated
"org.springframework.boot:spring-boot:${springVersion}",
Expand Down Expand Up @@ -69,6 +68,7 @@ dependencies {
"io.opencensus:opencensus-exporter-trace-jaeger:${openCensusVersion}",
"io.opencensus:opencensus-exporter-metrics-ocagent:${openCensusVersion}",
"io.opencensus:opencensus-exporter-trace-ocagent:${openCensusVersion}",
"rocks.inspectit:opencensus-influxdb-exporter:1.1",

// bytecode manipulation
"net.bytebuddy:byte-buddy:1.9.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public class InfluxExporterService extends DynamicallyActivatableService {
*/
private Future exporterTask;


public InfluxExporterService() {
super("exporters.metrics.influx", "metrics.enabled");
}
Expand All @@ -51,16 +50,19 @@ protected boolean checkEnabledForConfig(InspectitConfig conf) {
@Override
protected boolean doEnable(InspectitConfig configuration) {
InfluxExporterSettings influx = configuration.getExporters().getMetrics().getInflux();
log.info("Starting InfluxDB Exporter to '{}:{}' on '{}'", influx.getDatabase(), influx.getRetentionPolicy(), influx.getUrl());
log.info("Starting InfluxDB Exporter to '{}:{}' on '{}'", influx.getDatabase(), influx.getRetentionPolicy(), influx
.getUrl());
activeExporter = InfluxExporter.builder()
.url(influx.getUrl())
.database(influx.getDatabase())
.retention(influx.getRetentionPolicy())
.user(influx.getUser())
.password(influx.getPassword())
.createDatabase(influx.isCreateDatabase())
.exportDifference(influx.isCountersAsDifferences())
.build();
exporterTask = executor.scheduleAtFixedRate(activeExporter::export, 0, influx.getExportInterval().toMillis(), TimeUnit.MILLISECONDS);
exporterTask = executor.scheduleAtFixedRate(activeExporter::export, 0, influx.getExportInterval()
.toMillis(), TimeUnit.MILLISECONDS);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ inspectit:
metrics:
# root setting for the polling frequency of all metrics
# when a metrics has no frequency defined separately, this frequency will be used
frequency: 1s
frequency: 5s
logging:
debug: false # set to true to see more details in the agents logs
34 changes: 17 additions & 17 deletions inspectit-ocelot-demo/grafana/marketplace/influx/http.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1580728981189,
"iteration": 1587549556162,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -179,7 +179,7 @@
"pattern": "Time",
"thresholds": [],
"type": "hidden",
"unit": "short"
"unit": "none"
}
],
"targets": [
Expand All @@ -201,7 +201,7 @@
"hide": false,
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT * FROM (\n SELECT SUM(total) as za_requests, SUM(times) / SUM(total) AS zb_response_time FROM (\n SELECT spread(\"count\") AS total, spread(\"sum\") AS times FROM \"http_in_responsetime\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY *) GROUP BY http_path fill(0)\n) WHERE za_requests > 0",
"query": "SELECT SUM(total) as za_requests, SUM(times) / SUM(total) AS zb_response_time FROM (\n SELECT SUM(\"count\") AS total, SUM(\"sum\") AS times FROM \"http_in_responsetime\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY http_path\n) GROUP BY http_path",
"rawQuery": true,
"refId": "A",
"resultFormat": "table",
Expand Down Expand Up @@ -236,10 +236,9 @@
"type": "fill"
}
],
"hide": false,
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT zc_error_rate FROM (\nSELECT SUM(errors) / SUM(total) AS zc_error_rate, SUM(total) as total FROM (\n SELECT spread(\"count\") AS total, spread(\"errorcount\")AS errors FROM \"http_in_error\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY *) \nGROUP BY http_path fill(0)\n) WHERE total > 0 GROUP BY http_path fill(0)",
"query": "SELECT SUM(errors) / SUM(total) AS zc_error_rate FROM (\n SELECT SUM(\"count\") AS total, SUM(\"errorcount\") AS errors FROM \"http_in_error\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY http_path fill(0)\n)\nGROUP BY http_path",
"rawQuery": true,
"refId": "B",
"resultFormat": "table",
Expand Down Expand Up @@ -279,7 +278,7 @@
"y": 1
},
"id": 23,
"interval": "5s",
"interval": "15s",
"legend": {
"avg": false,
"current": false,
Expand Down Expand Up @@ -325,7 +324,7 @@
"legendFormat": "{{http_path}}",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(times) / SUM(total) AS value FROM (\n SELECT difference(\"count\") AS total, difference(\"sum\") AS times FROM \"http_in_responsetime\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application=~ /^$application$/ AND http_path=~ /^$path$/ GROUP BY *) \nWHERE total > 0\nGROUP BY time($__interval), http_path fill(linear)",
"query": "SELECT SUM(sum) / SUM(count)\nFROM \"http_in_responsetime\" \nWHERE $timeFilter AND service =~ /^$service$/ AND application=~ /^$application$/ AND http_path=~ /^$path$/\nGROUP BY time($__interval), http_path fill(none)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
Expand Down Expand Up @@ -415,7 +414,7 @@
},
"hideTimeOverride": true,
"id": 6,
"interval": "1s",
"interval": "15s",
"links": [],
"mappingType": 1,
"mappingTypes": [
Expand Down Expand Up @@ -471,7 +470,7 @@
"intervalFactor": 1,
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(total)/$__interval_ms*1000 AS value FROM (\n SELECT difference(\"count\") AS total FROM \"http_in_responsetime\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application=~ /^$application$/ AND http_path=~ /^$path$/ GROUP BY *) \nGROUP BY time($__interval) fill(linear)",
"query": "SELECT SUM(count)/$__interval_ms*1000 AS value\nFROM \"http_in_responsetime\" \nWHERE $timeFilter AND service =~ /^$service$/ AND application=~ /^$application$/ AND http_path=~ /^$path$/ \nGROUP BY time($__interval) fill(0)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
Expand Down Expand Up @@ -592,7 +591,7 @@
"intervalFactor": 1,
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(errors)/SUM(total) AS value FROM (\n SELECT difference(\"count\") AS total, difference(\"errorcount\") AS errors FROM \"http_in_error\" \n WHERE $timeFilter AND service =~ /^$service/ AND application=~ /^$application$/ AND http_path=~ /^$path$/ GROUP BY * ) \nGROUP BY time($__interval) fill(0)",
"query": "SELECT SUM(errors) / SUM(total) AS value FROM (\n SELECT SUM(\"count\") AS total, SUM(\"errorcount\") AS errors FROM \"http_in_error\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY time($__interval) fill(0)\n)\nWHERE total > 0\nGROUP BY time($__interval)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
Expand Down Expand Up @@ -774,7 +773,7 @@
"legendFormat": "",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT * FROM (\n SELECT SUM(total) as za_requests, SUM(times) / SUM(total) AS zb_response_time FROM (\n SELECT spread(\"count\") AS total, spread(\"sum\") AS times FROM \"http_out_responsetime\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY *) GROUP BY http_host, http_path fill(0)\n) WHERE za_requests > 0",
"query": "SELECT SUM(total) as za_requests, SUM(times) / SUM(total) AS zb_response_time FROM (\n SELECT SUM(\"count\") AS total, SUM(\"sum\") AS times FROM \"http_out_responsetime\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY http_path,http_host\n) GROUP BY *",
"rawQuery": true,
"refId": "A",
"resultFormat": "table",
Expand Down Expand Up @@ -811,7 +810,7 @@
],
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT zc_error_rate FROM (\nSELECT SUM(errors) / SUM(total) AS zc_error_rate, SUM(total) as total FROM (\n SELECT spread(\"count\") AS total, spread(\"errorcount\")AS errors FROM \"http_out_error\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY *) \nGROUP BY http_host,http_path fill(0)\n) WHERE total > 0 GROUP BY http_host, http_path fill(0)",
"query": "SELECT SUM(errors) / SUM(total) AS zc_error_rate FROM (\n SELECT SUM(\"count\") AS total, SUM(\"errorcount\") AS errors FROM \"http_out_error\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY http_path,http_host fill(0)\n)\nGROUP BY *",
"rawQuery": true,
"refId": "B",
"resultFormat": "table",
Expand Down Expand Up @@ -851,6 +850,7 @@
"y": 6
},
"id": 76,
"interval": "15s",
"legend": {
"avg": false,
"current": false,
Expand Down Expand Up @@ -891,7 +891,7 @@
],
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(times) / SUM(total) AS value FROM (\n SELECT difference(\"count\") AS total, difference(\"sum\") AS times FROM \"http_out_responsetime\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application=~ /^$application$/ AND http_path=~ /^$path$/ GROUP BY *) \nWHERE total > 0\nGROUP BY time($__interval), http_path,http_host fill(linear)",
"query": "SELECT SUM(sum) / SUM(count) AS value \nFROM \"http_out_responsetime\" \nWHERE $timeFilter AND service =~ /^$service$/ AND application=~ /^$application$/ AND http_path=~ /^$path$/\nGROUP BY time($__interval), http_path,http_host fill(none)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
Expand Down Expand Up @@ -1037,7 +1037,7 @@
"intervalFactor": 1,
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(total)/$__interval_ms*1000 AS value FROM (\n SELECT difference(\"count\") AS total FROM \"http_out_responsetime\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application=~ /^$application$/ AND http_path=~ /^$path$/ GROUP BY * ) \nGROUP BY time($__interval) fill(linear)",
"query": "SELECT SUM(count)/$__interval_ms*1000 AS value\nFROM \"http_out_responsetime\" \nWHERE $timeFilter AND service =~ /^$service$/ AND application=~ /^$application$/ AND http_path=~ /^$path$/ \nGROUP BY time($__interval) fill(0)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
Expand Down Expand Up @@ -1158,7 +1158,7 @@
"intervalFactor": 1,
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(errors)/SUM(total) AS value FROM (\n SELECT difference(\"count\") AS total, difference(\"errorcount\") AS errors FROM \"http_out_error\" \n WHERE $timeFilter AND service =~ /^$service/ AND application=~ /^$application$/ AND http_path=~ /^$path$/ GROUP BY *) \nGROUP BY time($__interval) fill(0)",
"query": "SELECT SUM(errors) / SUM(total) AS value FROM (\n SELECT SUM(\"count\") AS total, SUM(\"errorcount\") AS errors FROM \"http_out_error\" \n WHERE $timeFilter AND service =~ /^$service$/ AND application =~ /^$application$/ AND http_path =~ /^$path$/ GROUP BY time($__interval) fill(0)\n)\nWHERE total > 0\nGROUP BY time($__interval)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
Expand Down Expand Up @@ -1270,7 +1270,7 @@
]
},
"time": {
"from": "now-15m",
"from": "now-5m",
"to": "now"
},
"timepicker": {
Expand Down Expand Up @@ -1301,5 +1301,5 @@
"timezone": "",
"title": "HTTP Overview",
"uid": "523wqxqmz",
"version": 2
"version": 5
}
12 changes: 6 additions & 6 deletions inspectit-ocelot-demo/grafana/marketplace/influx/jvm.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1580138904831,
"iteration": 1587549648580,
"links": [],
"panels": [
{
Expand Down Expand Up @@ -890,7 +890,7 @@
"measurement": "jvm_gc_memory_allocated",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(val) FROM (SELECT NON_NEGATIVE_DIFFERENCE(\"counter\") AS val FROM \"jvm_gc_memory_allocated\" WHERE (\"service\" =~ /^$service$/) AND $timeFilter GROUP BY *) GROUP BY time($__interval)",
"query": "SELECT SUM(\"counter\") FROM \"jvm_gc_memory_allocated\" WHERE (\"service\" =~ /^$service$/) AND $timeFilter GROUP BY time($__interval)",
"rawQuery": true,
"refId": "D",
"resultFormat": "time_series",
Expand Down Expand Up @@ -934,7 +934,7 @@
"measurement": "jvm_gc_memory_promoted",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(val) FROM (SELECT NON_NEGATIVE_DIFFERENCE(\"counter\") AS val FROM \"jvm_gc_memory_promoted\" WHERE (\"service\" =~ /^$service$/) AND $timeFilter GROUP BY *) GROUP BY time($__interval)",
"query": "SELECT SUM(\"counter\") FROM \"jvm_gc_memory_promoted\" WHERE (\"service\" =~ /^$service$/) AND $timeFilter GROUP BY time($__interval)",
"rawQuery": true,
"refId": "F",
"resultFormat": "time_series",
Expand Down Expand Up @@ -1648,7 +1648,7 @@
"measurement": "jvm_gc_pause",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(times) FROM (SELECT non_negative_difference(\"counter\") AS times FROM \"jvm_gc_pause\" WHERE (\"service\" =~ /^$service$/ AND \"action\" = 'end of minor GC') AND $timeFilter GROUP BY *) WHERE times > 0 GROUP BY time($__interval) fill(none)",
"query": "SELECT SUM(\"counter\") FROM \"jvm_gc_pause\" WHERE (\"service\" =~ /^$service$/ AND \"action\" = 'end of minor GC') AND $timeFilter GROUP BY time($__interval) fill(none)",
"rawQuery": true,
"refId": "C",
"resultFormat": "time_series",
Expand Down Expand Up @@ -1698,7 +1698,7 @@
"measurement": "jvm_gc_pause",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT SUM(times) FROM (SELECT non_negative_difference(\"counter\") AS times FROM \"jvm_gc_pause\" WHERE (\"service\" =~ /^$service$/ AND \"action\" = 'end of major GC') AND $timeFilter GROUP BY *) WHERE times > 0 GROUP BY time($__interval) fill(none)",
"query": "SELECT SUM(\"counter\") FROM \"jvm_gc_pause\" WHERE (\"service\" =~ /^$service$/ AND \"action\" = 'end of major GC') AND $timeFilter GROUP BY time($__interval) fill(none)",
"rawQuery": true,
"refId": "A",
"resultFormat": "time_series",
Expand Down Expand Up @@ -1959,5 +1959,5 @@
"timezone": "",
"title": "JVM Metrics",
"uid": "jaEIHn8ik",
"version": 1
"version": 2
}
Loading