Compare commits

..

No commits in common. "e9979842911ab4f7e34504696e719cef74661b13" and "feb2935a9caa92203778ba9b932d52a0b6d18cd9" have entirely different histories.

3 changed files with 27 additions and 42 deletions

10
Jenkinsfile vendored
View File

@ -38,7 +38,7 @@
//cron('0 8 * * *')
//every monday at 08:00
cron('0 6 * * 1')
cron('0 8 * * 1')
}
@ -68,7 +68,7 @@
stage('install required python packages') {
steps {
sh '''
pip3 install --user -r requirements.txt
pip install --user -r requirements.txt
'''
}
}
@ -76,7 +76,7 @@
stage('Execute Reporting Script') {
steps {
sh 'python3 createReport.py -p week'
sh 'python createReport.py -p week'
//Only required once CN is not reachable from EMEA
@ -91,7 +91,7 @@
emailext subject: env.JOB_NAME,
body: 'Please find the output of the weekly QM-Report attached',
//to: 'rene.forstner@nttdata.com',
to: 'rene.forstner@nttdata.com, philipp-peter.altmann@bmw.de,Chrisovalantis.Tararas@bmw.de',
to: 'rene.forstner@nttdata.com, stephan.oertelt@bmw.de, Mohammed.Abadel@bmw.de, OOC-Support@bmwgroup.com, Sonja.Yildizoglu@bmw.de, Andreas.DA.Danzer@partner.bmw.de',
replyTo: 'coco-apm@bmw.de',
attachmentsPattern: '*.xlsx'
@ -109,4 +109,4 @@
cleanWs()
}
}
}
}

View File

@ -58,7 +58,7 @@ def getSLO(DTAPIToken, DTENV, fromDate, toDate):
"to": int(toDate),
"timeFrame": "GTF",
"evaluate": True,
"sloSelector": "text(\"Continuous Testing Platform 2.0 by Valantis\")"
"sloSelector": "text(\"CoCo-QM-Report\")"
}
r = make_request(DTAPIURL,headers=headers,parameters=parameters,verify=verify)
try:
@ -210,7 +210,6 @@ def main():
hourlyall = pd.DataFrame()
dailyall = pd.DataFrame()
totalall = pd.DataFrame()
ytd = pd.DataFrame()
for item, doc in doc.items():
token = dict(doc[2])
@ -233,54 +232,38 @@ def main():
#sort columns in a try block - if API is returning columns which are non exist, this will not fail the script
df[['description','Touchpoint']] = df['description'].str.split('_',expand=True)
try:
df = df[['Date', 'HUB', 'id', 'enabled', 'name', 'description', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
df = df[['Date', 'HUB', 'id', 'enabled', 'name', 'description', 'Touchpoint', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
except Exception as e:
print("Could not rearrange columns: " + str(e))
dailyall = pd.concat([dailyall,df],ignore_index=True)
#Calc hourly SLO
if (args.preSelect == "week"):
df = pd.DataFrame()
for index, row in hours.iterrows():
temp_df = getSLO(DTTOKEN,DTURL,row['startTime'],row['endTime'])
temp_df['Date'] = row['Date']
temp_df['HUB'] = item
df = pd.concat([df,temp_df],ignore_index=True)
#sort columns in a try block - if API is returning columns which are non exist, this will not fail the script
try:
df = df[['Date', 'HUB', 'id', 'enabled', 'name', 'description', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
except Exception as e:
print("Could not rearrange columns: " + str(e))
hourlyall = pd.concat([hourlyall,df],ignore_index=True)
df = pd.DataFrame()
for index, row in hours.iterrows():
temp_df = getSLO(DTTOKEN,DTURL,row['startTime'],row['endTime'])
temp_df['Date'] = row['Date']
temp_df['HUB'] = item
df = pd.concat([df,temp_df],ignore_index=True)
###Calc Overall YTD SLO
yearstart = toDate.replace(month=2,day=28)
yearstart = datetime.datetime(yearstart.year, yearstart.month, yearstart.day)
yearstart = time.mktime(yearstart.timetuple()) * 1000
df = getSLO(DTTOKEN,DTURL,yearstart,days['endTime'].max())
df['Year'] = fromDate.year
df['HUB'] = item
#sort columns in a try block - if API is returning columns which are non exist, this will not fail the script
df[['description','Touchpoint']] = df['description'].str.split('_',expand=True)
try:
df = df[['Year', 'HUB', 'id', 'enabled', 'name', 'description','evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
df = df[['Date', 'HUB', 'id', 'enabled', 'name', 'description', 'Touchpoint', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
except Exception as e:
print("Could not rearrange columns: " + str(e))
hourlyall = pd.concat([hourlyall,df],ignore_index=True)
ytd = pd.concat([ytd,df],ignore_index=True)
###Calc Overall SLO
df = getSLO(DTTOKEN,DTURL,days['startTime'].min(),days['endTime'].max())
df['CW'] = fromDate.isocalendar()[1]
df['HUB'] = item
df[['description','Touchpoint']] = df['description'].str.split('_',expand=True)
try:
df = df[['CW', 'HUB', 'id', 'enabled', 'name', 'description', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
df = df[['CW', 'HUB', 'id', 'enabled', 'name', 'description','Touchpoint', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
except Exception as e:
print("Could not rearrange columns: " + str(e))
@ -289,15 +272,18 @@ def main():
else:
print("token not found, skipping " + item)
touchpoints = ['Vehicle' , 'Mobile']
hourlyall = hourlyall[hourlyall['Touchpoint'].isin(touchpoints)]
dailyall = dailyall[dailyall['Touchpoint'].isin(touchpoints)]
totalall = totalall[totalall['Touchpoint'].isin(touchpoints)]
writer = pd.ExcelWriter("./QM_Report_" + str(fromDate.isocalendar()[1]) + ".xlsx")
totalall.to_excel(writer, sheet_name='total')
dailyall.to_excel(writer, sheet_name='daily')
if (args.preSelect == "week"):
hourlyall.to_excel(writer, sheet_name='hourly')
ytd.to_excel(writer, sheet_name='YTD')
hourlyall.to_excel(writer, sheet_name='hourly')
writer.save()
writer.close()
if __name__ == "__main__":
main()
main()

View File

@ -1,4 +1,3 @@
---
euprod:
- name: "EUprod"
- env-url: "https://xxu26128.live.dynatrace.com"