-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for specific step size in CSV output #2
base: master
Are you sure you want to change the base?
Conversation
Added flag --step, which is the step size in seconds. This will generate a line every step seconds. Not specifying a step size, or supplying a step size of 0 uses the previous step size calculations.
This simplifies usage of the step feature by enabling users to specify steps as 5m, or 24h.
Does this result in the same steps when returning e.g. an hour by default? |
Bumped testify up to v1.2.1 (latest) to get support for duration units in asserts.
Steps are now tested to make sure errors are within 0.01 epsilon since the steps function now returns a time.Duration (float64). The steps function will now return an exact duration between steps when we devide the input into 254 steps.
I updated the tests to be successful, sorry for not doing that initially. As part of this PR, I switched the steps function to return a duration, in stead of integer seconds, as the prometheus API supports fractions in its steps. If no --step flag is given, the previous behaviour is maintained, where we divide the duration into 254 steps. Since steps no longer uses whole seconds, but rather time.Duration, I switched the factor 4.2 with 254 steps which seems to be what the original intent was. The code feels cleaner when using time.Duration is used, since that is what is actually being worked on. If --step is given, that actual value is used, bypassing the step calculation. |
I just tried to clone, build and test your repository. When using the
When runngin
|
Added flag --step, which is the step size in seconds. This will
generate a line every step seconds. Not specifying a step size,
or supplying a step size of 0 uses the previous step size
calculations.