TritonDataCenter / dragnet

event stream analysis
MIT License
11 stars 4 forks source link

querying hourly indexes in Manta produces no results #38

Open davepacheco opened 8 years ago

davepacheco commented 8 years ago

I created this datasource and metric:

$ dn datasource-show -v muskie_logs
DATASOURCE           LOCATION                                                   
muskie_logs          manta://us-east.manta.joyent.com/poseidon/stor/logs/muskie 
    filter:     {"eq":["audit",true]}
    dataFormat: "json"
    indexPath:  "/poseidon/stor/dragnet/muskie_logs"
    timeFormat: "%Y/%m/%d/%H"
    timeField:  "time"

$ dn metric-list -v muskie_logs
DATASOURCE           METRIC              
muskie_logs          muskie_logs.by_timestamp_status_method_latency
    breakdowns: timestamp, req.method, res.statusCode, latency

I built indexes with:

$ dn build --assetroot=/poseidon/stor/dragnet/assets --interval=hour --after=2016-01-11T23:00:00Z --before=2016-01-12T00:00:00Z muskie_logs
using existing asset: "/poseidon/stor/dragnet/assets/dragnet-0.0.4.tgz"
submitted job b042e2c4-6645-ee86-c8d0-b0240dcfda5a
submitted 2 inputs
indexes for "muskie_logs" built

Note that it's an hourly index. The index file looks fine -- at least it has data in it for the specified interval. But querying it shows no results:

$ dn query muskie_logs --assetroot=/poseidon/stor/dragnet/assets --interval=hour --after=2016-01-11T23:55:00Z --before=2016-01-12T02:00:00Z
note: skipping index check (not yet implemented)
using existing asset: "/poseidon/stor/dragnet/assets/dragnet-0.0.4.tgz"
submitted job b90f86f3-1007-4d2c-b9cd-9dd08e587cb7
submitted 1 inputs
VALUE
    0

The reason is that Manta job runs the file-based "dn query", but without specifying --interval=hour, so we end up looking for a daily index, find none, and then report nothing:

# LOG_LEVEL=trace dn query --counters --points input --before "2016-01-12T00:00:00.000Z" --after "2016-01-11T23:55:00.000Z"  < /dev/null | bunyan
[2016-01-12T18:13:36.234Z] TRACE: dragnet/statter/32280 on 0436b820-a8e9-4b75-8d8d-fd863ef80c6d: stat "/manta/poseidon/stor/dragnet/muskie_logs/by_day/2016-01-11.sqlite"
PathEnumerator     noutputs:           2
[2016-01-12T18:13:36.238Z] TRACE: dragnet/statter/32280 on 0436b820-a8e9-4b75-8d8d-fd863ef80c6d: emitting EOF signal
FindStart          ninputs:            1
[2016-01-12T18:13:36.238Z] TRACE: dragnet/traverser/32280 on 0436b820-a8e9-4b75-8d8d-fd863ef80c6d: emitting EOF signal
FindStart          noutputs:           1
[2016-01-12T18:13:36.239Z] TRACE: dragnet/feedback/32280 on 0436b820-a8e9-4b75-8d8d-fd863ef80c6d: read EOF signal: ending statter
{"fields":{},"value":0}
FindStatter        badstat:            1
FindStatter        ninputs:            2
FindStatter        noutputs:           1
FindTraverser      ninputs:            1
FindTraverser      noutputs:           1
FindFeedback       ninputs:            1
Index Result Aggregator noutputs:           1

Note that the file we stat'd is for the daily index, which is the wrong thing here.