Script to compare prom output with m3 - #857
Conversation
| @@ -0,0 +1,15 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
nit: maybe add a check at the beginning to make sure m3db/prom are running?
There was a problem hiding this comment.
also rename to curl_diff.sh or curl-diff.sh
There was a problem hiding this comment.
added a check for running and renamed to prom-m3-diff.sh
| @@ -0,0 +1,15 @@ | |||
| #!/bin/bash | |||
| # This script can be used to compare prometheus query output with m3query output | |||
There was a problem hiding this comment.
Perhaps making this into a function so that it could be sourced into other scripts in the future. Just a thought
There was a problem hiding this comment.
that's a good idea but I'm not sure how useful it would be to call it as a function vs calling this script completely and then working off generated files. Also, note that this is a simple script which just generates output from prom and m3. We'll be working on a more complex way to compare prom output with m3 output.
| start=${2?"Missing start, usage: $0 target start"} | ||
| duration=${3:1000} | ||
| end=$((start + duration)) | ||
| m3command="localhost:7201/api/v1/prom/native/read?start=$start&end=$end&step=15s&debug=true --data-urlencode target=$target" |
There was a problem hiding this comment.
Perhaps let users specify step size? and then have the default as 15s
| promcommand="localhost:9090/api/v1/query_range?start=$start&end=$end&step=15s --data-urlencode query=$target" | ||
| echo $m3command | ||
| echo $promcommand | ||
| curl -G $m3command > m3out |
There was a problem hiding this comment.
nit: extra space after -G
Codecov Report
@@ Coverage Diff @@
## master #857 +/- ##
==========================================
- Coverage 78.4% 78.26% -0.14%
==========================================
Files 384 384
Lines 33060 33060
==========================================
- Hits 25920 25876 -44
- Misses 5363 5403 +40
- Partials 1777 1781 +4
Continue to review full report at Codecov.
|
| start=${2?"Missing start, usage: $0 target start"} | ||
| duration=${3:1000} | ||
| end=$((start + duration)) | ||
| m3command="localhost:7201/api/v1/prom/native/read?start=$start&end=$end&step=15s&debug=true --data-urlencode target=$target" |
There was a problem hiding this comment.
Take m3 endpoint and prom endpoint as parameters
There was a problem hiding this comment.
don't want to make the script too complicated. We can definitely add that when needed
| curl -G $m3command > m3out | ||
| curl -G $promcommand > promout | ||
| jq ".[]|.tags,.datapoints" m3out > m3result | ||
| jq ".data.result|.[]|.metric,.values" promout > promresult |
There was a problem hiding this comment.
You probably don't want to overwrite existing results you have here
There was a problem hiding this comment.
actually I like overwritting the results. This keeps the workflow simple where I don't have to constantly deleted created files. Also, the query should be idempotent.
There was a problem hiding this comment.
It's more to deal with different but similar queries, e.g. if you want to compare two results for the same query but different start/end to see where the points actually line up. Take a param to see if you should overwrite?
arnikola
left a comment
There was a problem hiding this comment.
This is a little useful but it doesn't actually run any comparisons on the outputs
|
The main purpose of this script is to create an easy way to quickly run a query through both prom and m3. It doesn't intend to be a way for comparisons but rather for manual inspection. |
Codecov Report
@@ Coverage Diff @@
## master #857 +/- ##
==========================================
- Coverage 78.4% 78.21% -0.19%
==========================================
Files 384 384
Lines 33060 33060
==========================================
- Hits 25920 25858 -62
- Misses 5363 5406 +43
- Partials 1777 1796 +19
Continue to review full report at Codecov.
|
|
Maybe printout file size post comparison to have a quick indicator to see if they're equal? Obviously this won't be perfect, but could be a good canary |
|
Added file size |
No description provided.