axiomhq / cli

The power of Axiom on the command line.
https://axiom.co
MIT License
42 stars 11 forks source link

make query start/endtimes relative capable #125

Closed gordallott closed 2 years ago

gordallott commented 2 years ago

I had a need for this, which was admitedly mostly driven for lazyness. but I just wanted to check the last hour in my query, and doing that with --start-time was a bit of a pain when I had to make timestamps

so this PR allows for duration timestamps in --start/end-time. for example:

./cmd/axiom query "['jaeger'] | sort by _time" --format json --start-time="-1h"

I'm not super invested in this so if it's not what we want for the cli that's fine too, this just took me five minutes to make so why not

codecov[bot] commented 2 years ago

Codecov Report

Merging #125 (1b541fa) into main (4d3d118) will increase coverage by 1.16%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #125      +/-   ##
==========================================
+ Coverage   14.31%   15.47%   +1.16%     
==========================================
  Files          10       10              
  Lines         531      782     +251     
==========================================
+ Hits           76      121      +45     
- Misses        439      645     +206     
  Partials       16       16              
Impacted Files Coverage Δ
pkg/terminal/io.go 0.00% <0.00%> (ø)
internal/cmd/root/help.go 0.00% <0.00%> (ø)
internal/cmd/root/root.go 0.00% <0.00%> (ø)
pkg/terminal/epipe_other.go 0.00% <0.00%> (ø)
internal/cmd/root/help_topic.go 100.00% <0.00%> (ø)
internal/config/config.go 6.14% <0.00%> (+0.87%) :arrow_up:
pkg/terminal/color.go 5.26% <0.00%> (+1.00%) :arrow_up:
cmd/axiom/main.go 21.79% <0.00%> (+1.04%) :arrow_up:
pkg/doc/doc.go 76.19% <0.00%> (+1.19%) :arrow_up:
pkg/terminal/table_printer.go 49.41% <0.00%> (+2.24%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4d3d118...1b541fa. Read the comment docs.

lukasmalkmus commented 2 years ago

I'm not super invested in this so if it's not what we want for the cli that's fine too, this just took me five minutes to make so why not

Nah, this is a great addition and super helpful!