Skip to content

Commit

Permalink
Merge pull request #65 from shashank-boyapally/max-lookback
Browse files Browse the repository at this point in the history
Max lookback
  • Loading branch information
vishnuchalla authored Sep 13, 2024
2 parents b337b72 + 2ae751e commit a6dd796
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,35 @@ Orion now supports anomaly detection for your data. Use the ```--anomaly-detecti

You can now constrain your look-back period using the ```--lookback``` option. The format for look-back is ```XdYh```, where X represents the number of days and Y represents the number of hours.

To specify how many runs to look back, you can use the ```--lookback-size``` option. By default, this option is set to 10000.

**_Note_** This particular feature clashes along with the idea of having to lookback for X number of days. The precedence of both the flags are equal and the using both at the same time returns the runs until the cutoff whichever is shorter. To provide precedence context one can understand the following example:

Consider the following runs
```
1 -- 21 Aug
2 -- 22 Aug
3 -- 22 Aug
4 -- 22 Aug
5 -- 23 Aug
6 -- 23 Aug
7 -- 24 Aug
8 -- 25 Aug
9 -- 26 Aug
```
Today is 27 Aug, and
case 1: we want to get data of previous 5 days, the `--lookback` flag gets us the runs [2,9]
case 2: we want to get data of previous 6 runs, the `--lookback-size` flag gets us the runs [4,9]
case 3: when we use both `--lookback` and `--lookback-size`
- Consider we pass `--lookback 5d --lookback-size 6` now this gets the union of both [2,9] and [4,9] which is [4,9]
- Consider we pass `--lookback 3d --lookback-size 6` now this gets the union of both [7,9] and [4,9] which is [7,9]

This is similar to how car manufacturers warranty plays out such as 5years or 60k miles whichever comes first.

**Why we do not want higher precedence for a single flag?**
- These flags are optional to use, if we give higher precedence to a single flag and use both flags, the same functionality can be achieved by just passing the single flag(higher precedence) and ignoring the other.
- In a use case where we would like to just see latest n number of runs and restricted to a date, using both operators can achieve it. Say I want latest 15 runs from past 10 days, this way of having no precedence allows us to have it. If there are more than 15 runs it gets only 15 runs, if there are less than 15 runs it gets the last 10 days runs.

You can open the match requirement by using the ```--node-count``` option to find any matching uuid based on the metadata and not have to have the same jobConfig.jobIterations. This variable is a ```True``` or ```False```, defaulted to False.

**_NOTE:_** The ```--hunter-analyze``` and ```--anomaly-detection``` flags are mutually exclusive. They cannot be used together because they represent different algorithms designed for distinct use cases.
Expand Down
1 change: 1 addition & 0 deletions orion.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def cli(max_content_width=120): # pylint: disable=unused-argument
@click.option("--convert-tinyurl", is_flag=True, help="Convert buildUrls to tiny url format for better formatting")
@click.option("--collapse", is_flag=True, help="Only outputs changepoints, previous and later runs in the xml format")
@click.option("--node-count", default=False, help="Match any node iterations count")
@click.option("--lookback-size", type=int, default=10000, help="Maximum number of entries to be looked back")
def cmd_analysis(**kwargs):
"""
Orion runs on command line mode, and helps in detecting regressions
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def process_test(
# getting metadata
metadata = extract_metadata_from_test(test) if options["uuid"] in ("", None) else get_metadata_with_uuid(options["uuid"], match)
# get uuids, buildUrls matching with the metadata
runs = match.get_uuid_by_metadata(metadata, fingerprint_index, lookback_date=start_timestamp)
runs = match.get_uuid_by_metadata(metadata, fingerprint_index, lookback_date=start_timestamp, lookback_size=options['lookback_size'])
uuids = [run["uuid"] for run in runs]
buildUrls = {run["uuid"]: run["buildUrl"] for run in runs}
# get uuids if there is a baseline
Expand Down

0 comments on commit a6dd796

Please sign in to comment.