OpenTSDB / opentsdb

A scalable, distributed Time Series Database.
http://opentsdb.net
GNU Lesser General Public License v2.1
5k stars 1.25k forks source link

tsdb scan --import help wrong #1490

Open HariSekhon opened 5 years ago

HariSekhon commented 5 years ago

In OpenTSDB 2.3 something that has been bothering me for a while is that the tsdb scan help does not match the usage:

$ tsdb scan
Not enough arguments.
Usage: scan [--delete|--import] START-DATE [END-DATE] query [queries...]
To see the format in which queries should be written, see the help of the 'query' command.
The --import flag changes the format in which the output is printed to use a format suiteable for the 'import' command instead of the default output format, which better represents how the data is stored in HBase.
The --delete flag will delete every row matched by the query.  This flag implies --import.
  --config=PATH    Path to a configuration file (default: Searches for file see docs).
  --delete         Deletes rows as they are scanned.
  --import         Prints the rows in a format suitable for the 'import' command.
  --table=TABLE    Name of the HBase table where to store the time series (default: tsdb).
  --uidtable=TABLE Name of the HBase table to use for Unique IDs (default: tsdb-uid).
  --zkbasedir=PATH Path under which is the znode for the -ROOT- region (default: /hbase).
  --zkquorum=SPEC  Specification of the ZooKeeper quorum to use (default: localhost).

but when you try to following the START-DATE [END-DATE] query format you will get the following error:

tsdb scan --import 30m-ago now <mymetric>
Exception in thread "main" java.util.NoSuchElementException: No such aggregator: now
        at net.opentsdb.core.Aggregators.get(Aggregators.java:200)
        at net.opentsdb.tools.CliQuery.parseCommandLineQuery(CliQuery.java:200)
        at net.opentsdb.tools.DumpSeries.doDump(DumpSeries.java:98)
        at net.opentsdb.tools.DumpSeries.main(DumpSeries.java:85)

so the second arg is an aggregator not a finish time.

manolama commented 5 years ago

Mmm yeah the CLI has it's own parsing code different from the HTTP API. We've never gotten around to combining the two.

twegener-embertec commented 5 years ago

Note that it is specifically the "now" case that is broken. It works if you give it an end time of "1s-ago", say.

suishaojian commented 5 years ago

I got the error when I want to use downsample :No such aggregator: sum:60m-max-none .... So I just want to confirm that downsample is not supported after scan --import ... ?

nezumisama commented 2 years ago

I'd like to note that now is also given as an example value in the docs.