Bid calculation in InfluxDB

I have a table with three columns (time, value, result). timeand valueare the base of what db timeseries requires. A column tag resultcan have one of the following values ​​(success / hard failure / soft failure / unknown).

I would like to track the success rate (success / outcome) for a given time window (since I will consume this on graphane, the time window can change and must support the dynamic time range request)


Things I tried on Influx 0.9:

1: Using Grafana: 

Grafana has a percentage stack option to display account values. Unfortunately, it does not display a percentage value. It just shows a distribution chart. I am interested in generating a percentage, and I do not think Grafana has such an opportunity.


2: Continuous queries - single table:

, .

CREATE CONTINUOUS QUERY count_total ON metrics BEGIN SELECT SUM(value) as total INTO "metric_agg" FROM "original_metric" WHERE time > now() - 1h GROUP BY time(5m) END

CREATE CONTINUOUS QUERY count_success ON metrics BEGIN SELECT SUM(value) as success INTO "metric_agg" FROM "original_metric" WHERE result = 'success' and time > now() - 1h GROUP BY time(5m) END

, CQ , metric_agg, grafana. , - . Pelase ,

UPDATE. , , beckettsean. .

2 CQ :

CREATE CQ count_total ON metrics BEGIN SELECT SUM(value) as total INTO "metric_agg" FROM "original_metric" WHERE time > now() - 1h GROUP BY time(5m) END

CREATE CQ count_success ON metrics BEGIN SELECT SUM(value) as success INTO "metric_agg" FROM "original_metric" WHERE result = 'success' and time > now() - 1h GROUP BY time(5m) END

: select success / total from metric_agg where $timeFilter


3: Continuous queries - single table - overwrites:

"dummy" 0 CQ, , . 0 , .


4: Continuous queries - multiple tables:

CQ Grafana. "" , , .

SELECT sum("success") as success, sum("total") as total FROM merge /metric_result_*/ WHERE time > now() - 2h GROUP BY time(5m) fill(0)

2 (metric_result_success metric_result_total.. , CQ ).


, : 0,9+? CQ , , .

+4
2

2: - :

, CQ . , CQ CQ. , . . CQ metric_agg. GROUP BY <tag> GROUP BY *, , CQ, . , , GROUP BY time(), .

4: - :

( "" ). , .

, , , InfluxDB. , , InfluxDB.

+1

, ( - Influx 1.0).

Influx ** 0.10, "2: - :". . , . , grafana , /.

Kapacitor, .

** , Influx, 0.10, 0.10, , /feilds ( ).

0

Source: https://habr.com/ru/post/1618042/


All Articles