Last active
          January 15, 2022 21:13 
        
      - 
      
- 
        Save yairst/93b1726b5f6b51ef412a5c76bea16c37 to your computer and use it in GitHub Desktop. 
Revisions
- 
        yairst revised this gist Jan 15, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ EBP = 2 # percent ALERTING_WIN = 1 df = pd.read_csv('sav_2013_2017.csv', parse_dates=['date']) # aviod divide by zero df['hits'] += 1 
- 
        yairst created this gist Jan 14, 2022 .There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ import pandas as pd from matplotlib import pyplot as plt SLO_PERIOD = 28 EBP = 2 # percent ALERTING_WIN = 1 df = pd.read_csv('sav_2013_2017.csv') # aviod divide by zero df['hits'] += 1 # add constant column for plotting df['static burn rate'] = (24 * SLO_PERIOD) / ALERTING_WIN * (EBP / 100) # calculate dynamic burn rate df['total_hits_last_28_days']= df.hits.rolling(24 * SLO_PERIOD).sum() df['dynamic burn rate'] = df['total_hits_last_28_days'] / (df['hits']) * (EBP / 100) # sample idx = 36984 df_sample = df[idx:idx+96] # 96 hours # plot fig, ax = plt.subplots(figsize=(16, 5)) df_sample.plot(x='date',y='hits', ax=ax, logy=True) df_sample.plot(x='date',y='dynamic burn rate', ax=ax, logy=True) df_sample.plot(x='date',y='static burn rate', ax=ax, logy=True, linestyle='--') ax.grid()