-
Notifications
You must be signed in to change notification settings - Fork 31
InfluxDB 101
Lukas Rytz edited this page Apr 28, 2017
·
7 revisions
> curl -G 'https://scala-ci.typesafe.com/influx/query?pretty=true' --data-urlencode "u=scala" --data-urlencode "p=<>" --data-urlencode "db=scala_benchmark" --data-urlencode "q=SELECT * FROM result WHERE time > now() - 1d"
...
> ssh [email protected]
> influx -username scala -password <>
> use scala_benchmark
> SELECT * FROM result WHERE time > now() - 1d
...
> ssh [email protected] -L 8086:localhost:8086 -N &
> ssh [email protected] -L 8083:localhost:8083 -N &
Open http://localhost:8083. Host: localhost
, port: 8086
, no SSL.
In principle, it should work without the first tunnel (host: scala-ci.typesafe.com/influx
, port: 443
, with SSL), but I couldn't get it to work.
Try with query SELECT * FROM result WHERE time > now() - 1d
.
Measurement
- Similar to an sql table
- Examples in
scala_benchmark
:result
,commit
- Query:
SHOW MEASUREMENTS
Tags:
- Similar to an indexed column in sql
- Examples:
benchmark
,branch
,source
, ... - Queries:
SHOW TAG KEYS FROM result
,SHOW TAG VALUES FROM result WITH KEY = benchmark
Fields:
- Similar to non-indexed columns in sql
- Data and metadata
- Examples:
javaVersion
,score
, ... - Query:
SHOW FIELD KEYS FROM result
Point:
- A data entry, similar to a row in sql
- Contains a timestamp, values for all tag keys, values for some field keys (sparse)
Series
- A measurement with a unique list of tag key-value pairs
- Example:
result,benchmark=HotScalacBenchmark.compile,branch=2.12.x,source=better-files
Writing the same (measurement,timestamp,tagKeyValues)
twice overwrites the existing point. We can exploit this to re-run a benchmark.
- A query requires at least one field key in the
SELECT
clause to return data - Tag and field keys can be quoted in double quotes (if necessary)
- String literals need to be in single quotes
- Example:
SELECT * FROM result WHERE "benchmark" = 'HotScalacBenchmark.compile' LIMIT 5
- Example:
- Regex matching:
WHERE tagName =~ /regex/
- Query by time:
SELECT * FROM result WHERE time > now() - 7d