diff --git a/build.gradle b/build.gradle index be42408..59c16ff 100644 --- a/build.gradle +++ b/build.gradle @@ -229,5 +229,7 @@ project(":core") { api 'de.ruedigermoeller:fst:2.56' api "org.joml:joml:1.10.5" + + implementation "com.influxdb:influxdb-client-java:6.6.0" } } diff --git a/core/src/com/protoevo/core/Simulation.java b/core/src/com/protoevo/core/Simulation.java index b01caa7..0bc0cac 100644 --- a/core/src/com/protoevo/core/Simulation.java +++ b/core/src/com/protoevo/core/Simulation.java @@ -9,6 +9,7 @@ import com.protoevo.settings.SimulationSettings; import com.protoevo.utils.EnvironmentImageRenderer; import com.protoevo.utils.FileIO; +import com.protoevo.utils.InfluxWriter; import com.protoevo.utils.TimedEventsManager; import com.protoevo.utils.Utils; @@ -44,6 +45,7 @@ public class Simulation implements Runnable private String name; private List statsNames; private final REPL repl = new REPL(this); + private InfluxWriter influxWriter = new InfluxWriter(); public Simulation() { this(Environment.settings.simulationSeed.get()); @@ -389,20 +391,22 @@ public void createAutoSave() { public void makeStatisticsSnapshot() { Statistics stats = new Statistics(environment.getStats()); + stats.putAll(environment.getDebugStats()); stats.putAll(environment.getPhysicsDebugStats()); stats.putAll(environment.getProtozoaSummaryStats(true, false, true)); String timeStamp = Utils.getTimeStampString(); + influxWriter.write(name, stats); - FileIO.writeJson(stats, getSaveFolder() + "/stats/summaries/" + timeStamp); + //FileIO.writeJson(stats, getSaveFolder() + "/stats/summaries/" + timeStamp); if (Environment.settings.misc.writeGenomes.get()) { List protozoaGenomes = environment.getCells().stream() .filter(cell -> cell instanceof Protozoan) .map(cell -> ((Protozoan) cell).getGeneExpressionFunction().getGRNGenome()) .collect(Collectors.toList()); - FileIO.writeJson(protozoaGenomes, getSaveFolder() + "/stats/protozoa-genomes/" + timeStamp); + //FileIO.writeJson(protozoaGenomes, getSaveFolder() + "/stats/protozoa-genomes/" + timeStamp); } // PythonRunner.runPython("pyprotoevo.create_plots", "--quiet --simulation " + name); diff --git a/core/src/com/protoevo/settings/MiscSettings.java b/core/src/com/protoevo/settings/MiscSettings.java index b4efc95..ba7cd3c 100644 --- a/core/src/com/protoevo/settings/MiscSettings.java +++ b/core/src/com/protoevo/settings/MiscSettings.java @@ -22,7 +22,7 @@ public class MiscSettings extends Settings { public final Settings.Parameter statisticsSnapshotTime = new Settings.Parameter<>( "Save Statistics Time", "Amount of in-simulation time between making a new snapshot of the summary statistics.", - 20.0f, Statistics.ComplexUnit.TIME); + 2.0f, Statistics.ComplexUnit.TIME); public final Settings.Parameter writeGenomes = new Settings.Parameter<>( "Write Genomes", "Whether or not to write genome information (warning: generates lots of data).", diff --git a/core/src/com/protoevo/test/InfluxDBTest.java b/core/src/com/protoevo/test/InfluxDBTest.java new file mode 100644 index 0000000..96e29a0 --- /dev/null +++ b/core/src/com/protoevo/test/InfluxDBTest.java @@ -0,0 +1,33 @@ +package com.protoevo.test; + +import java.time.Instant; +import java.util.List; + +import com.influxdb.annotations.Column; +import com.influxdb.annotations.Measurement; +import com.influxdb.client.InfluxDBClient; +import com.influxdb.client.InfluxDBClientFactory; +import com.influxdb.client.WriteApi; +import com.influxdb.client.WriteApiBlocking; +import com.influxdb.client.domain.WritePrecision; +import com.influxdb.client.write.Point; +import com.influxdb.query.FluxTable; + +public class InfluxDBTest { + public static void main(String[] args) { + String token = "my-super-secret-auth-token"; + String bucket = "my-bucket"; + String org = "protoevo"; + + InfluxDBClient client = InfluxDBClientFactory.create("http://localhost:8086", token.toCharArray()); + + Point point = Point + .measurement("mem") + .addTag("host", "host1") + .addField("used_percent", 23.43234543) + .time(Instant.now(), WritePrecision.NS); + + WriteApiBlocking writeApi = client.getWriteApiBlocking(); + writeApi.writePoint(bucket, org, point); + } +} \ No newline at end of file diff --git a/core/src/com/protoevo/utils/InfluxWriter.java b/core/src/com/protoevo/utils/InfluxWriter.java new file mode 100644 index 0000000..c2ce110 --- /dev/null +++ b/core/src/com/protoevo/utils/InfluxWriter.java @@ -0,0 +1,43 @@ +package com.protoevo.utils; + +import java.time.Instant; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.TimeUnit; + +import com.influxdb.annotations.Column; +import com.influxdb.annotations.Measurement; +import com.influxdb.client.InfluxDBClient; +import com.influxdb.client.InfluxDBClientFactory; +import com.influxdb.client.WriteApi; +import com.influxdb.client.WriteApiBlocking; +import com.influxdb.client.domain.WritePrecision; +import com.influxdb.client.write.Point; +import com.influxdb.query.FluxTable; +import com.protoevo.core.Statistics; +import com.protoevo.core.Statistics.Stat; + +public class InfluxWriter { + private InfluxDBClient client; + private String token = "my-super-secret-auth-token"; + private String bucket = "my-bucket"; + private String org = "protoevo"; + + public InfluxWriter() { + client = InfluxDBClientFactory.create("http://localhost:8086", token.toCharArray()); + } + + public void write(String simulationName, Statistics stats) { + Point point = Point + .measurement("environment") + .addTag("simulation", simulationName); + for (Map.Entry entry : stats.getStatsMap().entrySet()) { + Stat val = entry.getValue(); + point.addField(entry.getKey(), val.getDouble()); + } + + WriteApiBlocking writeApi = client.getWriteApiBlocking(); + writeApi.writePoint(bucket, org, point); + } +} \ No newline at end of file diff --git a/stats_server/README.md b/stats_server/README.md new file mode 100644 index 0000000..cb53d44 --- /dev/null +++ b/stats_server/README.md @@ -0,0 +1,63 @@ +# Stats server +Statistics server consists of two containers, influxdb and grafana. They can be started with docker-compose. The protoevo Java application is configured to send data to the influxdb container. + +## Setup +Startup the containers: +(In detached mode) +`docker-compose up -d` + +If you wish to look at the logs, you can either omit the `-d` flag or use `docker-compose logs -f`. + +### InfluxDB +InfluxDB is available in the url `http://localhost:8086/`, the username is `influx_admin` and the password is `protoevo_influx` as defined in the `docker-compose.yml` file. + +### Grafana +Grafana is available in the url `http://localhost:3000/`, the username is `admin` and the password is `stats_grafana` as defined in the `docker-compose.yml` file. + +The InfluxDB data source needs to be added manually to Grafana. From the toggle menu, choose connections -> data sources. Then add a new data source. Choose InfluxDB as the type and fill in the following fields: +- Query Language: `Flux` +- URL: `http://influxdb:8086` in HTTP section +- Basic auth: uncheck in Auth section +- Organization: `protoevo` in influxDB Details section +- Token: `my-super-secret-auth-token` in influxDB Details section + +Everything else can be left as empty and all auth check boxes can be left unchecked. + +![data source settings](img/data_source_settings.jpg) + +Then click save and test. If everything is working, you should see a green notification saying "Data source is working". + +Now you can start protoevo and it should start sending data to the database. You can create dashboards and panels to visualize the data. + +To verify that data is flowing correctly all the way to Grafana, you can go to the explore tab and run a query. For example, you can run the following query: +```flux +from(bucket: "my-bucket") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "environment") + |> filter(fn: (r) => r["_field"] == "Age Max") + |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false) + |> yield(name: "mean") +``` +You should see a graph showing the maximum age of the protozoa over time. + +### Importing existing dashboards +There's an example dashboard, `main_dashboard.json`, in the `example_queries` folder. You can import it to Grafana, but first you'll need to change the data source id to match the id of the InfluxDB data source you created earlier. You can find the id by going to the data sources page and clicking on the data source. The id is in the url. For example for a url like `http://localhost:3000/connections/datasources/edit/c7c7acfc-6644-4276-b55e-a0065f069bab` the id is `c7c7acfc-6644-4276-b55e-a0065f069bab`. + +All instances of `REPLACE_ME_WITH_CORRECT_ID` in the main_dashboard.json file should be replaced with the id of the InfluxDB data source. + +Then you can import the dashboard by going to the dashboard page and clicking on the plus icon on the left. Then choose import and upload the main_dashboard.json file. + +![imported dashboard](img/imported_dashboard.jpg) + +### Creating new queries +Understanding `flux` is not necessary to create new queries. If you log in to the InfluxDB UI, you can go to the Data Explorer tab and use Query Builder to create queries. Once you're happy with the query, you can switch to the script editor to see the `flux` code. You can copy the code to Grafana and modify it there. + +For example you can create a query that shows Age Max, Age Min and Age Mean with the query builder like this: +![query builder](img/query_builder.jpg) + +And then switch to the script editor to see the `flux` code: +![script editor](img/script_editor.jpg) + +## Shutdown and data deletion +Shutdown the containers with `docker-compose down`. This will keep the data in the volumes. If you wish to delete the data as well, use +`docker-compose down -v` \ No newline at end of file diff --git a/stats_server/docker-compose.yml b/stats_server/docker-compose.yml new file mode 100644 index 0000000..a50b9bd --- /dev/null +++ b/stats_server/docker-compose.yml @@ -0,0 +1,32 @@ +version: '2' +services: + influxdb: + image: influxdb:latest + ports: + - '8086:8086' + volumes: + - influxdb-storage:/var/lib/influxdb + environment: + - INFLUXDB_DB=db0 + - DOCKER_INFLUXDB_INIT_MODE=setup + - DOCKER_INFLUXDB_INIT_USERNAME=influx_admin + - DOCKER_INFLUXDB_INIT_PASSWORD=protoevo_influx + - DOCKER_INFLUXDB_INIT_ORG=protoevo + - DOCKER_INFLUXDB_INIT_BUCKET=my-bucket + - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token + + grafana: + image: grafana/grafana:latest + ports: + - '3000:3000' + volumes: + - grafana-storage:/var/lib/grafana + - ./grafana-provisioning/:/etc/grafana/provisioning + depends_on: + - influxdb + environment: + - GF_SECURITY_ADMIN_USER=protoevo + - GF_SECURITY_ADMIN_PASSWORD=stats_grafana +volumes: + influxdb-storage: + grafana-storage: \ No newline at end of file diff --git a/stats_server/example_queries/dashboardv2.json b/stats_server/example_queries/dashboardv2.json new file mode 100644 index 0000000..33ada70 --- /dev/null +++ b/stats_server/example_queries/dashboardv2.json @@ -0,0 +1,1648 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 3, + "links": [], + "liveNow": false, + "panels": [ + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 21, + "panels": [], + "title": "Simulation information", + "type": "row" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 1 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Time of Day\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Time of day", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 1 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Generation Max\" or r[\"_field\"] == \"Generation Mean\" or r[\"_field\"] == \"Generation Min\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Generation", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 1 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Bodies\" or r[\"_field\"] == \"Protozoa\" or r[\"_field\"] == \"Plants\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Number of entities", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 9 + }, + "id": 20, + "panels": [], + "title": "Protozoa properties", + "type": "row" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 4, + "x": 0, + "y": 10 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "key": "Q-8770bf4c-5205-497e-9d43-8816daea463c-0", + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Health Mean\" or r[\"_field\"] == \"Health Min\" or r[\"_field\"] == \"Health Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Protozoa health", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 4, + "x": 4, + "y": 10 + }, + "id": 15, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Meat to Digest Mean\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"uranus-paras-ut\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Meat to digest", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 5, + "x": 8, + "y": 10 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Herbivore Factor Mean\" or r[\"_field\"] == \"Herbivore Factor Min\" or r[\"_field\"] == \"Herbivore Factor Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Herbivore Factor", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 5, + "x": 13, + "y": 10 + }, + "id": 7, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Speed Max\" or r[\"_field\"] == \"Speed Mean\" or r[\"_field\"] == \"Speed Min\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Speed", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 18, + "y": 10 + }, + "id": 9, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Growth Rate Min\" or r[\"_field\"] == \"Growth Rate Mean\" or r[\"_field\"] == \"Growth Rate Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Growth Rate", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 18 + }, + "id": 14, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Mean Mutation Chance Max\" or r[\"_field\"] == \"Mean Mutation Chance Mean\" or r[\"_field\"] == \"Mean Mutation Chance Min\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"uranus-paras-ut\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Mutation chance", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 100, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 3, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 18 + }, + "id": 12, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "10.2.1", + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Died from being eaten\" or r[\"_field\"] == \"Died from exceeding environment capacity\" or r[\"_field\"] == \"Died from cytokinesis\" or r[\"_field\"] == \"Died from decay\" or r[\"_field\"] == \"Died from hyperthermia\" or r[\"_field\"] == \"Died from hypothermia\" or r[\"_field\"] == \"Died from old age\" or r[\"_field\"] == \"Died from overcrowding\" or r[\"_field\"] == \"Died from running out of health\" or r[\"_field\"] == \"Died from shrinking too much\" or r[\"_field\"] == \"Died from suffocation\" or r[\"_field\"] == \"Died from the void\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Death reasons", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 26 + }, + "id": 13, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Light Sensitive Nodes Max\" or r[\"_field\"] == \"Light Sensitive Nodes Mean\" or r[\"_field\"] == \"Light Sensitive Nodes Min\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"uranus-paras-ut\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Number of light sensitive nodes", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 26 + }, + "id": 22, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Multicell Structure Size Max\" or r[\"_field\"] == \"Multicell Structure Size Mean\" or r[\"_field\"] == \"Multicell Structure Size Min\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"uranus-paras-ut\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Multicell structure", + "type": "timeseries" + }, + { + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 34 + }, + "id": 19, + "title": "GRN properties", + "type": "row" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 0, + "y": 35 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"GRN Size Mean\" or r[\"_field\"] == \"GRN Size Min\" or r[\"_field\"] == \"GRN Size Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "GRN Size", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 6, + "y": 35 + }, + "id": 11, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"GRN Depth Mean\" or r[\"_field\"] == \"GRN Depth Min\" or r[\"_field\"] == \"GRN Depth Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "GRN Depth", + "type": "timeseries" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 43 + }, + "id": 23, + "panels": [], + "title": "Special molecules", + "type": "row" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 44 + }, + "id": 24, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "import \"strings\"\r\n\r\nfrom(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => strings.hasPrefix(v: r[\"_field\"], prefix: \"Molecule\"))\r\n |> filter(fn: (r) => strings.hasSuffix(v: r[\"_field\"], suffix: \" Available Count\"))\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Molecule counts", + "type": "timeseries" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 52 + }, + "id": 16, + "panels": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 14, + "w": 12, + "x": 0, + "y": 53 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "import \"strings\"\r\n\r\nfrom(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => strings.hasPrefix(v: r[\"_field\"], prefix: \"Node 1: Construction\"))\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Node 1 Construction", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 14, + "w": 12, + "x": 12, + "y": 53 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "import \"strings\"\r\n\r\nfrom(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => strings.hasPrefix(v: r[\"_field\"], prefix: \"Node 2: Construction\"))\r\n |> filter(fn: (r) => strings.hasSuffix(v: r[\"_field\"], suffix: \" Mean\"))\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Node 2 construction", + "type": "timeseries" + } + ], + "title": "Node construction", + "type": "row" + } + ], + "refresh": "10s", + "schemaVersion": 38, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Main Dashboard", + "uid": "f30b4c9d-7475-48ef-8238-1b09c2402237", + "version": 10, + "weekStart": "" +} \ No newline at end of file diff --git a/stats_server/example_queries/grafana_filtered.txt b/stats_server/example_queries/grafana_filtered.txt new file mode 100644 index 0000000..a7ba0f4 --- /dev/null +++ b/stats_server/example_queries/grafana_filtered.txt @@ -0,0 +1,7 @@ +from(bucket: "my-bucket") + |> range(start: v.timeRangeStart, stop: v.timeRangeStop) + |> filter(fn: (r) => r["_measurement"] == "environment") + |> filter(fn: (r) => r["simulation"] == "${simulation}") + |> filter(fn: (r) => r["_field"] == "Health Mean" or r["_field"] == "Health Min" or r["_field"] == "Health Max") + |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false) + |> yield(name: "mean") \ No newline at end of file diff --git a/stats_server/example_queries/main_dashboard.json b/stats_server/example_queries/main_dashboard.json new file mode 100644 index 0000000..7a6b962 --- /dev/null +++ b/stats_server/example_queries/main_dashboard.json @@ -0,0 +1,1064 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 1, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 5, + "x": 0, + "y": 0 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Time of Day\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Time of day", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 5, + "x": 5, + "y": 0 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Generation Max\" or r[\"_field\"] == \"Generation Mean\" or r[\"_field\"] == \"Generation Min\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Generation", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 5, + "x": 10, + "y": 0 + }, + "id": 7, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Speed Max\" or r[\"_field\"] == \"Speed Mean\" or r[\"_field\"] == \"Speed Min\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Speed", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 5, + "x": 15, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Bodies\" or r[\"_field\"] == \"Protozoa\" or r[\"_field\"] == \"Plants\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Number of entities", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 4, + "x": 20, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "key": "Q-8770bf4c-5205-497e-9d43-8816daea463c-0", + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Health Mean\" or r[\"_field\"] == \"Health Min\" or r[\"_field\"] == \"Health Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Protozoa health", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 14, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "import \"strings\"\r\n\r\nfrom(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => strings.hasPrefix(v: r[\"_field\"], prefix: \"Node 1: Construction\"))\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Node 1 Construction", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 14, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "import \"strings\"\r\n\r\nfrom(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => strings.hasPrefix(v: r[\"_field\"], prefix: \"Node 2: Construction\"))\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Node 2 construction", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 0, + "y": 22 + }, + "id": 8, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Herbivore Factor Mean\" or r[\"_field\"] == \"Herbivore Factor Min\" or r[\"_field\"] == \"Herbivore Factor Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Herbivore Factor", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 6, + "y": 22 + }, + "id": 9, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"Growth Rate Min\" or r[\"_field\"] == \"Growth Rate Mean\" or r[\"_field\"] == \"Growth Rate Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "Growth Rate", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 12, + "y": 22 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"GRN Size Mean\" or r[\"_field\"] == \"GRN Size Min\" or r[\"_field\"] == \"GRN Size Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "GRN Size", + "type": "timeseries" + }, + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 18, + "y": 22 + }, + "id": 11, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "query": "from(bucket: \"my-bucket\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"environment\")\r\n |> filter(fn: (r) => r[\"simulation\"] == \"${simulation}\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"GRN Depth Mean\" or r[\"_field\"] == \"GRN Depth Min\" or r[\"_field\"] == \"GRN Depth Max\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean\")", + "refId": "A" + } + ], + "title": "GRN Depth", + "type": "timeseries" + } + ], + "refresh": "10s", + "schemaVersion": 38, + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "aion-1k-plant", + "value": "aion-1k-plant" + }, + "datasource": { + "type": "influxdb", + "uid": "REPLACE_ME_WITH_CORRECT_ID" + }, + "definition": "from(bucket: \"my-bucket\")\r\n|> range(start: v.timeRangeStart)\r\n|> filter(fn: (r) => r._measurement == \"environment\")\r\n|> distinct(column: \"simulation\")\r\n|> keep(columns: [\"simulation\"])\r\n", + "hide": 0, + "includeAll": false, + "multi": false, + "name": "simulation", + "options": [], + "query": "from(bucket: \"my-bucket\")\r\n|> range(start: v.timeRangeStart)\r\n|> filter(fn: (r) => r._measurement == \"environment\")\r\n|> distinct(column: \"simulation\")\r\n|> keep(columns: [\"simulation\"])\r\n", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Main Dashboard", + "uid": "f30b4c9d-7475-48ef-8238-1b09c2402237", + "version": 8, + "weekStart": "" +} \ No newline at end of file diff --git a/stats_server/example_queries/simulation_var_from_influx.txt b/stats_server/example_queries/simulation_var_from_influx.txt new file mode 100644 index 0000000..488b8d6 --- /dev/null +++ b/stats_server/example_queries/simulation_var_from_influx.txt @@ -0,0 +1,5 @@ +from(bucket: "my-bucket") +|> range(start: v.timeRangeStart) +|> filter(fn: (r) => r._measurement == "environment") +|> distinct(column: "simulation") +|> keep(columns: ["simulation"]) \ No newline at end of file diff --git a/stats_server/img/data_source_settings.jpg b/stats_server/img/data_source_settings.jpg new file mode 100644 index 0000000..c5e07c2 Binary files /dev/null and b/stats_server/img/data_source_settings.jpg differ diff --git a/stats_server/img/imported_dashboard.jpg b/stats_server/img/imported_dashboard.jpg new file mode 100644 index 0000000..180a0d7 Binary files /dev/null and b/stats_server/img/imported_dashboard.jpg differ diff --git a/stats_server/img/query_builder.jpg b/stats_server/img/query_builder.jpg new file mode 100644 index 0000000..5402a61 Binary files /dev/null and b/stats_server/img/query_builder.jpg differ diff --git a/stats_server/img/script_editor.jpg b/stats_server/img/script_editor.jpg new file mode 100644 index 0000000..b0a3d92 Binary files /dev/null and b/stats_server/img/script_editor.jpg differ