-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Change Point Analysis #23931
Merged
tvalentyn
merged 73 commits into
apache:master
from
AnandInguva:change-point-with-config
Dec 22, 2022
Merged
Change Point Analysis #23931
Changes from 1 commit
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
6448677
ADd methods to Pytorch Benchmark to run Change Point analysis
AnandInguva b2239e7
Add GH issue API for Python
AnandInguva 8d1dd98
Add support for commenting on the issue
AnandInguva a231516
Add a description about the failing test
AnandInguva d947923
Add gh_issue object for perf tests
AnandInguva 3fca01c
Update API to read from parameters from config file
AnandInguva 5b194ea
Add find sibling change point method
AnandInguva 156af50
Add support for storing the metadata after regression issue is created
AnandInguva 544b8fb
Add logic for finding sibling changepoint
AnandInguva 5f3a94c
Update test_name
AnandInguva fc1de36
Update GH action
AnandInguva f825e4e
Update Description of the issue
AnandInguva c2cb8ae
Add commenting on the issue feature
AnandInguva 13c24bb
Add logic for not creating alert when its the same changepoint
AnandInguva bde9e14
Update config file
AnandInguva 7711303
Change owner name
AnandInguva fad21a2
fix lint, pydocs
AnandInguva 26d72cc
Add two tests in the config file
AnandInguva bd39279
Fix lint
AnandInguva c4c4486
Add labels to the config file
AnandInguva 18861e5
Fixup lints, and typehints
AnandInguva 3fd0899
add additional params to the config file
AnandInguva 0612c79
Refactor change point analysis code (#82)
AnandInguva af22414
Fixup lint
AnandInguva 963827c
Changes based on comments
AnandInguva 2600e24
Refactor fetch metrics from BQ
AnandInguva 1ae5949
Add readme on perf alerting tool
AnandInguva 0d7c72a
Add try catch statements
AnandInguva 6d28eb5
Update github action
AnandInguva 00bfee0
Add awaiting triage label
AnandInguva 929124b
Add link to edvisive algorithm
AnandInguva a02f275
Check with previous change point timestamp in the sibling change poin…
AnandInguva 801d79f
Changes based on comments on PR
AnandInguva af44c31
Fix test name
AnandInguva d167500
Merge remote-tracking branch 'upstream/master' into change-point-with…
AnandInguva 2f49383
Refactor code
AnandInguva ef015b8
Move constants and helper functions to separate .py file
AnandInguva d96460f
Merge remote-tracking branch 'upstream/master' into change-point-with…
AnandInguva 6db24e5
Refactoring
AnandInguva bdbf7a5
Rename files
AnandInguva d66b15d
Add tests
AnandInguva 759d3c3
Refactor and add steps in the doc string
AnandInguva 716a388
extend finding duplicate change points to search last 10 reported CPs
AnandInguva 01c06e2
fix tests
AnandInguva 8842b25
Fix whitespace lint
AnandInguva abef62d
Fix up lint
AnandInguva 7104e61
Add _ to internal variables
AnandInguva fd57d19
Remove steps and add it to the PR description
AnandInguva e1b59c6
Make big_query_metrics_fetcher as a function
AnandInguva 372ebc7
Add return in doc string
AnandInguva e8770cd
Add perf label and awaiting triage label default while creating alert
AnandInguva 43185c9
Refactor
AnandInguva 1797cc1
Modify loop
AnandInguva d130f1f
Fix up runtime errors
AnandInguva 433f5fe
Refactor metrics fetcher
AnandInguva 7672b99
Add test
AnandInguva b0f7b9c
Changes based on comments
AnandInguva 327ea01
Remove the confusion on sorted order of metrics and timestamps
AnandInguva 6fdfab4
Changes issue templates and add TODOs
AnandInguva 117f5fe
Add triaging issues section
AnandInguva 3a453cd
Fixup lint, whitespace
AnandInguva 397e7c7
Add notebook
AnandInguva 41a1a00
Changes based on comments
AnandInguva a0c3504
Mark optional params in readme
AnandInguva 57a4ef0
correct triage link
AnandInguva fad6bbe
Add unit tests and fix lints
AnandInguva 102d1b7
Fix up lint
AnandInguva 6b83629
Apply suggestions from code review
AnandInguva 4d7daf8
Change default optional param
AnandInguva 6a22e77
modify mock tests
AnandInguva fed8018
add docstring
AnandInguva 748ebd5
Change default values
AnandInguva c12b594
Add tests to GHA
AnandInguva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,10 +74,61 @@ Sometimes, the change point found might be way back in time and could be irrelev | |
reported only when it was observed in the last 7 runs from the current run, | ||
setting `num_runs_in_change_point_window=7` will achieve it. | ||
|
||
## Register a test for performance alerts. | ||
## Register a test for performance alerts | ||
|
||
If a new test needs to be registered for the performance alerting tool, please add the required test parameters to the | ||
config file. | ||
|
||
[//]: # (TODO : Add triaging section) | ||
## Triage performance alert issues | ||
|
||
All the performance/load tests metrics defined at [beam/.test-infra/jenkins](https://github.com/apache/beam/tree/master/.test-infra/jenkins) are imported to [Grafana dashboards](http://104.154.241.245/d/1/getting-started?orgId=1) for visualization. Please | ||
find the alerted test dashboard to find a spike in the metric values. | ||
|
||
For example, for the below configuration, | ||
* test: `apache_beam.testing.benchmarks.inference.pytorch_image_classification_benchmarks` | ||
* metric_name: `mean_load_model_latency_milli_secs` | ||
|
||
Grafana dashboard can be found at http://104.154.241.245/d/ZpS8Uf44z/python-ml-runinference-benchmarks?orgId=1&viewPanel=7 | ||
|
||
If the dashboard for a test is not found, you can use the | ||
code below to generate a plot for the given test, metric_name. | ||
|
||
If the performance/load test store the results in BigQuery using this [schema](https://github.com/apache/beam/blob/83679216cce2d52dbeb7e837f06ca1d57b31d509/sdks/python/apache_beam/testing/load_tests/load_test_metrics_utils.py#L66), | ||
then use the following code to fetch the metric_values for a `metric_name` for the last `30` runs and display a plot using matplotlib. | ||
|
||
**NOTE**: Install matplotlib and pandas using `pip install matplotlib pandas`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice, thanks. this would be better as a notebook in the repo, that people could refer to and update as necessary. |
||
``` | ||
import pandas as pd | ||
import matplotlib.pyplot as plt | ||
|
||
from apache_beam.testing.load_tests import load_test_metrics_utils | ||
from apache_beam.testing.load_tests.load_test_metrics_utils import BigQueryMetricsFetcher | ||
|
||
bq_project = 'apache-beam-testing' | ||
bq_dataset = '<bq-dataset-name>' | ||
bq_table = '<bq-table>' | ||
metric_name = '<perf-alerted-metric-name>' | ||
|
||
query = f""" | ||
SELECT * | ||
FROM {bq_project}.{bq_dataset}.{bq_table} | ||
WHERE CONTAINS_SUBSTR(({load_test_metrics_utils.METRICS_TYPE_LABEL}), '{metric_name}') | ||
ORDER BY {load_test_metrics_utils.SUBMIT_TIMESTAMP_LABEL} DESC | ||
LIMIT 30 | ||
""" | ||
|
||
big_query_metrics_fetcher = BigQueryMetricsFetcher() | ||
metric_data: pd.DataFrame = big_query_metrics_fetcher.fetch(query=query) | ||
# sort the data to view it in chronological order. | ||
metric_data.sort_values( | ||
by=[load_test_metrics_utils.SUBMIT_TIMESTAMP_LABEL], inplace=True) | ||
|
||
metric_data.plot(x=load_test_metrics_utils.SUBMIT_TIMESTAMP_LABEL, | ||
y=load_test_metrics_utils.VALUE_LABEL) | ||
plt.show() | ||
``` | ||
|
||
If you confirm there is a change in the pattern of the values for a test, find the timestamp of when that change happened | ||
and use that timestamp to find possible culprit commit. | ||
|
||
If the performance alert is a `false positive`, close the issue as `Close as not planned`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there an url that is not based on IP address?