I recently took interest in knowing how one of the projects I worked previously had evolved in JIRA over time. So I decided to write a python script to do it for me. Turns out it's pretty easy, using the xmlrpclib that comes with python, if your JIRA installation has this remote entry point enabled. Read the JIRA documentation on how to activate this.
Here's the source code. It will basically dump the number of created issues per month for a given JIRA filter (you need to create this filter first, which should basically be all the issues on the project you want to report about). If you uncomment line 53 (and comment 54) you will, instead, get the biggest reporter per month :)
Replace the bold entries with your own info and, on line 27, replace "16115" with the ID of the filter you created previously (you can see it in the browser status bar when you hover it's link in JIRA) ;)
#!/usr/bin/python
import xmlrpclib
from datetime import datetime
s = xmlrpclib.ServerProxy('http://jira_server/rpc/xmlrpc')
auth = s.jira1.login('username', 'password')
reporters_per_month = {}
def increase_item(key, sub_key, dict):
if not dict.has_key(key):
dict[key] = {}
if not dict[key].has_key(sub_key):
dict[key][sub_key] = 0
dict[key][sub_key] = dict[key][sub_key] + 1
def save(issue):
assignee = 'Unassigned'
if issue.has_key('assignee'):
assignee = issue['assignee']
#print '%s - %s - Reporter: %s - Assignee: %s' % (issue['id'], issue['created'], issue['reporter'], assignee)
created = issue['created'][:-2]
parsed_date = datetime.strptime(created, '%Y-%m-%d %H:%M:%S')
increase_item('%d %d' % (parsed_date.year, parsed_date.month), issue['reporter'], reporters_per_month)
issues = s.jira1.getIssuesFromFilter(auth, '16115')
i = 0
for issue in issues:
#if i > 10:
# break
save(issue)
i = i + 1
#print 'Total issues: %d' % len(issues)
def get_biggest_value(key, dict):
biggest = ('None', 0)
for entry in dict[key]:
if dict[key][entry] > biggest[1]:
biggest = (entry, dict[key][entry])
return biggest
def get_total_issues(key, dict):
total = 0
for entry in dict[key]:
total = total + dict[key][entry]
return total
for key in reporters_per_month:
#for sub_key in reporters_per_month[key]:
#print '%s\t%s\t%s' % (key, sub_key, reporters_per_month[key][sub_key])
biggest_reporter = get_biggest_value(key, reporters_per_month)
#print '%s (%s)\t%s' % (key, biggest_reporter[0], biggest_reporter[1])
print '%s\t%s' % (key, get_total_issues(key, reporters_per_month))