Compare commits
10 Commits
feb2935a9c
...
e997984291
| Author | SHA1 | Date |
|---|---|---|
|
|
e997984291 | |
|
|
150c7e4c70 | |
|
|
f3ea759da7 | |
|
|
9a224ecd76 | |
|
|
ca89f2bc8e | |
|
|
0247b8e69d | |
|
|
e1b28373c9 | |
|
|
23a9646263 | |
|
|
bcba609ffd | |
|
|
595d5fb120 |
|
|
@ -38,7 +38,7 @@
|
|||
//cron('0 8 * * *')
|
||||
|
||||
//every monday at 08:00
|
||||
cron('0 8 * * 1')
|
||||
cron('0 6 * * 1')
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
stage('install required python packages') {
|
||||
steps {
|
||||
sh '''
|
||||
pip install --user -r requirements.txt
|
||||
pip3 install --user -r requirements.txt
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
stage('Execute Reporting Script') {
|
||||
steps {
|
||||
|
||||
sh 'python createReport.py -p week'
|
||||
sh 'python3 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, stephan.oertelt@bmw.de, Mohammed.Abadel@bmw.de, OOC-Support@bmwgroup.com, Sonja.Yildizoglu@bmw.de, Andreas.DA.Danzer@partner.bmw.de',
|
||||
to: 'rene.forstner@nttdata.com, philipp-peter.altmann@bmw.de,Chrisovalantis.Tararas@bmw.de',
|
||||
replyTo: 'coco-apm@bmw.de',
|
||||
attachmentsPattern: '*.xlsx'
|
||||
|
||||
|
|
@ -109,4 +109,4 @@
|
|||
cleanWs()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ def getSLO(DTAPIToken, DTENV, fromDate, toDate):
|
|||
"to": int(toDate),
|
||||
"timeFrame": "GTF",
|
||||
"evaluate": True,
|
||||
"sloSelector": "text(\"CoCo-QM-Report\")"
|
||||
"sloSelector": "text(\"Continuous Testing Platform 2.0 by Valantis\")"
|
||||
}
|
||||
r = make_request(DTAPIURL,headers=headers,parameters=parameters,verify=verify)
|
||||
try:
|
||||
|
|
@ -210,6 +210,7 @@ def main():
|
|||
hourlyall = pd.DataFrame()
|
||||
dailyall = pd.DataFrame()
|
||||
totalall = pd.DataFrame()
|
||||
ytd = pd.DataFrame()
|
||||
|
||||
for item, doc in doc.items():
|
||||
token = dict(doc[2])
|
||||
|
|
@ -232,38 +233,54 @@ 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', 'Touchpoint', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
|
||||
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))
|
||||
dailyall = pd.concat([dailyall,df],ignore_index=True)
|
||||
|
||||
#Calc hourly SLO
|
||||
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)
|
||||
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)
|
||||
|
||||
#sort columns in a try block - if API is returning columns which are non exist, this will not fail the script
|
||||
###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
|
||||
|
||||
df[['description','Touchpoint']] = df['description'].str.split('_',expand=True)
|
||||
try:
|
||||
df = df[['Date', 'HUB', 'id', 'enabled', 'name', 'description', 'Touchpoint', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
|
||||
df = df[['Year', '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)
|
||||
|
||||
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','Touchpoint', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
|
||||
df = df[['CW', '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))
|
||||
|
||||
|
|
@ -272,18 +289,15 @@ 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')
|
||||
hourlyall.to_excel(writer, sheet_name='hourly')
|
||||
if (args.preSelect == "week"):
|
||||
hourlyall.to_excel(writer, sheet_name='hourly')
|
||||
ytd.to_excel(writer, sheet_name='YTD')
|
||||
writer.save()
|
||||
writer.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
---
|
||||
euprod:
|
||||
- name: "EUprod"
|
||||
- env-url: "https://xxu26128.live.dynatrace.com"
|
||||
|
|
|
|||
Loading…
Reference in New Issue