Sprint Analytics Pipeline
Enterprise Jira sprint telemetry and analytics pipeline with automated Confluence dashboards, developer velocity metrics, and LLM blocker summarization.
Technology Stack
HSTG Digital Jira Report Generator
Generates Jira sprint reports for multiple teams, posts one consolidated page to Confluence, and notifies a Microsoft Teams channel. Includes Developer lookup: open the report and use the link (or embedded iframe) to look up a developer and see their story points and issues.
Features
- Multi-team reports from
team_config.py(board ID per team, optional members / excluded sprints) - Single Confluence page — the same page is updated each run; sprint details, spillover, verification violations, Blockers (from Jira). Uses Confluence REST API v2 for better performance and reliability.
- Sprint details table — Sprint name, Actual Start/End, Completed story points, Issues in Sprint, Issues in backlog, Issues with no story points, Total Story Points
- Spillover — Issues not completed in the last closed sprint (table: Issue, Summary, Assignee, Label e.g. tech-debt)
- Blockers section — Issues on Backlog then Issues on Hold, each line: Ticket number - Status - Description (from Jira; backlog first, then on hold). Comment summaries for those issues are generated by the LLM (Groq or Gemini); LLM is required for the report.
- Jira Verification Violations — Doughnut chart by type + Per-issue details table (Issue, Status, Assignee, Violations). Rules are status-dependent: In Progress → +1 AC only; In Test → +1 AC + PR link; Ready for Production / Resolved → all 7 (PR link, branch cleanup, Concourse, rollback, evidence labels, time logged)
- Story point breakdown (Developer lookup) — Not started, In progress, Completed, Blocked/On hold (board column or status name)
- Teams notification with Confluence link (date in IST)
- Developer lookup — Link and optional iframe on Confluence; type name, pick team/sprint, fetch to see story points and issue list
- Cloud Scheduler — Run the report on a schedule (default: daily Mon-Sat 7 AM IST; configurable)
Prerequisites
- Python 3.11+
- Jira account + API token
- Confluence space (for the report page)
- Microsoft Teams incoming webhook (for the report link)
- Groq or Gemini API key (required for LLM-generated comment summaries under Blockers)
How to run
📋 Step-by-step guide: all ways to run the report + Developer lookup — Run the report (once, web app, GCP, cron, GitHub Actions, HTTP trigger) and how to use the HTML Developer lookup page (enter name, team, sprint → fetch from Jira).
🚀 GitHub Actions + host Developer lookup (Render or Railway) — Schedule the report with GitHub Actions (daily Mon-Sat 7 AM IST) and host the Developer lookup at a public URL. Use Render (free or paid) or Railway (Hobby ~$5/mo for always-on). For Render deploy steps, see RENDER_DEPLOY_CHECKLIST.md.
Step 1: Clone and install
cd /path/to/Jira
pip install -r requirements.txt
Step 2: Configure environment
cp .env.example .env
Edit .env and set at least:
| Variable | Required | Description |
|---|---|---|
JIRA_USER_NAME | Yes | Jira user email |
JIRA_TOKEN | Yes | Jira API token |
CONFLUENCE_BASE_URL | For report | e.g. https://your-site.atlassian.net/wiki |
CONFLUENCE_USER | For report | Confluence user email |
CONFLUENCE_TOKEN | For report | Confluence API token |
CONFLUENCE_SPACE_KEY | For report | Space key (e.g. HGD) |
VELOCITY_DASHBOARD_URL | Optional | Link under the Velocity heading (replaces inline table) |
TEAMS_WEBHOOK | For report | Teams incoming webhook URL |
LLM_PROVIDER | For report | groq or gemini (required for Blockers comment summaries) |
GROQ_API_KEY | If groq | Groq API key (required when LLM_PROVIDER=groq) |
GEMINI_API_KEY or GOOGLE_API_KEY | If gemini | Gemini/Google AI key (required when LLM_PROVIDER=gemini) |
APP_BASE_URL | For Person Lookup on Confluence | Public URL of this app (see Step 4 / Deploy) |
Step 3: Configure teams
Edit team_config.py: set board_id for each team. Use members: [] to auto-detect assignees from the sprint.
Step 4: Run locally
Option A – Generate the report once (no browser)
python main.py
Runs the full flow (fetch from Jira, build report, post to Confluence, send link to Teams) and exits.
Option B – Run the web app (report + Person Lookup in browser)
functions_framework --target=generate_and_send_report --port=8080 --debug
Use --debug so the app runs in a single process (Flask dev server). That can avoid worker crashes (SIGSEGV) you may see when hitting /report with the default multi-worker setup. Keep the terminal running. Then:
| What you want | Open in browser |
|---|---|
| Developer lookup (name, team/sprint, fetch) | http://localhost:8080/ or http://localhost:8080/person |
| Run the report manually | http://localhost:8080/report |
For Developer lookup to appear on the Confluence page when deployed, set APP_BASE_URL in .env (e.g. http://localhost:8080 locally, or your Cloud Function URL in production).
Step 5: Run with Docker (optional)
Run the app in a containerized environment using Docker:
Build the Docker image:
docker build -t jira-report-app .
Run the container:
docker run -p 8080:8080 --env-file .env jira-report-app
The app will be available at:
- Developer lookup: http://localhost:8080/ or http://localhost:8080/person
- Run the report: http://localhost:8080/report
Notes:
- The
--env-file .envflag loads all environment variables from your.envfile - The Dockerfile uses the same
functions-frameworkentry point as local/GCP deployment - Uses Python 3.11 slim image with minimal dependencies
- Port 8080 is exposed by default (configurable via
PORTenvironment variable)
Alternative: Run with docker-compose (create docker-compose.yml first):
version: '3.8'
services:
jira-report:
build: .
ports:
- "8080:8080"
env_file:
- .env
Then run:
docker-compose up
Step 6: Deploy to Google Cloud (production)
- In
.env, set:GCP_PROJECT_ID,GCP_REGION,CLOUD_FUNCTION_NAME- All vars from Step 2 (Jira, Confluence, Teams, LLM)
- Run:
./deploy.sh
This will:
- Deploy the app as a Cloud Function (HTTP).
- Create a Cloud Scheduler job that calls the function daily Monday through Saturday at 7:00 AM IST at
/report(generates the report and posts to Confluence + Teams).
-
After the first deploy: copy the function URL from the script output and set in
.env:APP_BASE_URL=https://REGION-PROJECT.cloudfunctions.net/FUNCTION_NAMEThen run
./deploy.shagain so the function getsAPP_BASE_URL. The Confluence report will then show the Developer lookup section (link and optional embedded iframe).
Deploy to Cloud Run (alternative):
If you prefer Cloud Run over Cloud Functions:
# Build and push to Google Container Registry
gcloud builds submit --tag gcr.io/$GCP_PROJECT_ID/jira-report
# Deploy to Cloud Run
gcloud run deploy jira-report \
--image gcr.io/$GCP_PROJECT_ID/jira-report \
--platform managed \
--region $GCP_REGION \
--allow-unauthenticated \
--set-env-vars="$(cat .env | grep -v '^#' | xargs | tr ' ' ',')"
Schedule: Default is daily Mon-Sat 7:00 AM IST (30 1 * * 1-6). To change it, set in .env before deploying:
SCHEDULE_CRON="30 1 * * 1-6" # 1=Mon, 6=Sat (0=Sun)
SCHEDULE_TIMEZONE=Asia/Kolkata
Alternative: Terraform
Use main.tf and terraform.tfvars (copy from terraform.tfvars.example) to provision the Cloud Function and Scheduler. Set teams_webhook, Confluence vars, and LLM keys in terraform.tfvars. The app uses a single Teams webhook for the report link.
Other ways to run the report on a schedule (no Cloud Function + Scheduler)
If you prefer not to use GCP Cloud Function + Cloud Scheduler, you can run the report on a schedule with one of these:
| Option | Best for | Notes |
|---|---|---|
| Cron on a server | You have a Linux/macOS VM or always-on machine | Run python main.py or curl http://your-app/report at any schedule you want. No cloud scheduler needed. |
| GitHub Actions | Repo is on GitHub; you're okay running in CI | Included workflow runs daily Mon-Sat at 7 AM IST (30 1 * * 1-6 in UTC = 01:30 UTC). Customize the schedule in .github/workflows/jira-report.yml. Store secrets in repo secrets. |
| Cloud Run Job + Scheduler | You want to stay on GCP but not use a Function | Deploy the app as a Cloud Run Job (runs to completion). Use Cloud Scheduler to invoke the job at the same cron. |
| Other clouds | You already use AWS/Azure | AWS: Lambda + EventBridge schedule. Azure: Function App with timer trigger. You’d deploy the same Python app and call the report entrypoint on schedule. |
Cron example (server / VM): Use the same cron expression in the server’s timezone (e.g. if the server is in IST):
# crontab -e (Mon & Thu 9:00 AM)
0 9 * * 1,4 cd /path/to/Jira && /usr/bin/python3 main.py
If the server is in UTC, 9 AM IST = 03:30 UTC:
30 3 * * 1,4 cd /path/to/Jira && /usr/bin/python3 main.py
GitHub Actions:
A workflow is included at .github/workflows/jira-report.yml — runs daily Mon-Sat at 7:00 AM IST (30 1 * * 1-6 = 01:30 UTC). To customize the schedule, edit the cron expression in the workflow file. Add repository secrets: JIRA_USER_NAME, JIRA_TOKEN, TEAMS_WEBHOOK, CONFLUENCE_*, LLM_PROVIDER, GROQ_API_KEY or GEMINI_API_KEY. For the Developer lookup and Sprint metrics dashboard links to appear in the Confluence report, also add APP_BASE_URL (your hosted app URL, no trailing slash) and optionally VELOCITY_DASHBOARD_URL. See GITHUB_ACTIONS_AND_DEVELOPER_LOOKUP.md. Trigger the workflow manually from the Actions tab.
End-to-end flow
-
Report is generated Either by Cloud Scheduler (daily Mon-Sat 7 AM IST for GCP deployments), GitHub Actions (daily Mon-Sat 7 AM IST), or manually (e.g.
python main.pyor http://localhost:8080/report). The app posts one Confluence page with all teams' sections. -
You open the Confluence page From the link in Teams or from your Confluence space. You see the full report: date, teams included, Developer lookup link, then per team — sprint details, naming alerts (if any), Jira Verification Violations (doughnut + per-issue table), spillover, and Blockers (Issues on Backlog, then Issues on Hold; each line: Ticket number - Status - Description).
-
Developer lookup Scroll to the bottom of the Confluence page. Use "Open Developer lookup in a new tab" (recommended; Confluence often blocks iframes). Type the developer name, select team and sprint, click Fetch from Jira to see story points (Total, Not started, In progress, Completed, Blocked/On hold) and the issue list.
Project structure
.
├── main.py # HTTP entrypoint: routing, report, Person Lookup API
├── config.py # Env, Jira/Confluence config, centralized matplotlib setup
├── team_config.py # Teams, board IDs, optional members, violation labels
├── jira_api/
│ ├── jira_sprint.py # Sprint info, spillover, velocity (consolidated board cache)
│ ├── jira_issues.py # Issue fetch, team members, backlog/on-hold, verification
│ └── verification_helpers.py # Status-dependent checklist (+1 AC, PR link, evidence, etc.)
├── report/
│ ├── report_builder.py # Build team reports and consolidated Confluence content
│ ├── violations_chart.py # Verification violations: doughnut chart, stacked bar, summary table
│ └── llm_report.py # LLM for Blockers comment summaries (required)
├── clients/
│ ├── confluence_client.py # Post/update Confluence page (REST API v2)
│ └── teams_client.py # Post to Teams webhook
├── person/
│ └── person_lookup.py # Developer list, sprints, person details (with performance logging)
├── utils/
│ ├── jira_helpers.py # Shared Jira utilities (story points parsing, field extraction)
│ └── markdown.py # Markdown/table helpers (e.g. escape for table cells)
├── static/
│ └── person.html # Person Lookup UI (embedded on Confluence)
├── docs/
│ ├── RUNNING_THE_REPORT.md # All ways to run report + Developer lookup
│ ├── GITHUB_ACTIONS_AND_DEVELOPER_LOOKUP.md # GitHub Actions + host lookup (Render/Railway)
│ └── RENDER_DEPLOY_CHECKLIST.md # Render deploy checklist (env vars, Docker, instance type)
├── requirements.txt # All dependencies
├── .env.example
├── deploy.sh # Deploy Cloud Function + Scheduler (with comprehensive validation)
├── main.tf # Optional: Terraform for function + scheduler
├── terraform.tfvars.example
├── Dockerfile # Container image for Cloud Run / local
└── README.md
Configuration
- JQL and issue types: Only Story and Bug are included in the report and Developer lookup (see
JIRA_REPORT_ISSUE_TYPES_JQLinteam_config.py).JIRA_CUSTOM_JQL_FILTERis applied where relevant (e.g. report JQL, spillover fallback). Issues in Sprint counts parent issues only (no subtasks). - Sprint metrics dashboard: Set
VELOCITY_DASHBOARD_URLin.env(or in GitHub Secrets when using Actions) to show a Sprint metrics dashboard link on the report. - Developer lookup / report links: Set
APP_BASE_URL(and optionallyVELOCITY_DASHBOARD_URL) so the Confluence report shows the Developer lookup link and Sprint metrics dashboard link. When using GitHub Actions, add these as repository secrets so the scheduled report includes the links. - Sprint naming: Report warns if the name doesn’t match
PI<X> S<X> Squad_Name; it does not change behavior. - Rate limiting: 15-second delay between teams when generating the report.
- Confluence page: Fixed title "HSTG Digital Sprint status report". Uses Confluence REST API v2 with automatic space key → space ID conversion. Each run updates that page if it exists; otherwise a new page is created.
- Jira Verification Violations: Per team: doughnut chart (counts by type) and Per-issue details table (Issue, Status, Assignee, Violations). Violation types are defined in
team_config.py(VIOLATION_LABELSandVIOLATION_SHORT): Missing +1 AC comment, Missing PR link, No time logged, No dev/local evidence, Branch Cleanup not mentioned, Concourse link not pasted, Rollback strategy not mentioned. PR link is detected in comments (including ADF), issuelinks, or Development/remotelinks. - Developer lookup: Story point breakdowns (Sprint and This person's) are shown as doughnut charts alongside the cards. Only Story and Bug issues are shown. Performance logging tracks slow sprint lookup operations (fallback queries with timing).
- Blockers section: List is from Jira: Issues on Backlog then Issues on Hold, each line Ticket number - Status - Description (backlog first, then on hold). Comment summaries are generated by the LLM (required): set
LLM_PROVIDER(groq or gemini) and the corresponding API key. For GCP/Vertex AI, Vertex AI Gemini 2.0 Flash or Gemini 2.0 Flash Lite are options. See Vertex AI pricing. - Logging: Most operational logs are at DEBUG. Use
logging.getLogger("jira_api.jira_sprint").setLevel(logging.DEBUG)(or similar) to see spillover/board details. Performance-sensitive operations (e.g., sprint lookup fallback) now log at INFO with timing information.
Troubleshooting
"Failed to load developers" on Developer lookup page
The page shows the error in the Developer/Team area. Common causes:
- Jira credentials: Ensure
JIRA_USER_NAMEandJIRA_TOKENin.envare correct and the user has access to the boards inteam_config.py. - Network: If the app runs in a restricted environment, Jira API calls may fail; check firewall/proxy.
- Server crash: If the server is crashing (see SIGSEGV below), the request to
/api/developersmay never complete. Use--debugwhen running locally.
SIGSEGV when opening /report or when loading developers
The log shows Worker (pid:...) was sent SIGSEGV! and the browser may show "This page isn't working" / "ERR_EMPTY_RESPONSE". Try:
-
Run with a single process (recommended for local): Run with Docker |
docker build -t jira-report-app . && docker run -p 8080:8080 --env-file .env jira-report-app| | Deploy to GCP (Functions) |./deploy.sh| | Deploy to GCP (Cloud Run) | `gcloud builds submit --tag gcr.io/$GCP_PROJECT_ID/jira-report && gcloud run deploy jira-report --image gcr.io/$GCP_PROJECT_ID/jira-report --platform managed --region $GCP_REGION --allow-unauthenticated functions_framework --target=generate_and_send_report --port=8080 --debug`--debug` uses the Flask dev server instead of multi-worker gunicorn, which often avoids this crash. -
Confirm the report runs outside the server: Run
python main.pyin the same environment. If that completes without a crash, the issue is likely the HTTP worker process;--debugshould help. Ifpython main.pyalso crashes, the segfault is probably in a native dependency (e.g. Jira client, SSL, or LLM library). Try updating:pip install --upgrade jira requests. -
Check dependencies: SIGSEGV can come from C extensions (e.g. in
cryptography,requests). Ensure you're on a supported Python version and that packages are installed for your platform.
Useful commands
| Task | Command |
|---|---|
| Run report once | python main.py |
| Start web app (local) | functions_framework --target=generate_and_send_report --port=8080 --debug |
| Deploy to GCP | ./deploy.sh |
| Trigger scheduler manually | gcloud scheduler jobs run CLOUD_FUNCTION_NAME-scheduler --location=GCP_REGION |
| View function logs | gcloud functions logs read CLOUD_FUNCTION_NAME --region=GCP_REGION --limit=50 |
| Run report via GitHub Actions | Add secrets (see docs), then Actions → Jira Sprint Report → Run workflow |
Documentation
| Doc | Description |
|---|---|
| RUNNING_THE_REPORT.md | All ways to run the report (local, web app, GCP, cron, GitHub Actions, HTTP) + how to use the Developer lookup page |
| GITHUB_ACTIONS_AND_DEVELOPER_LOOKUP.md | GitHub Actions for scheduled report (daily Mon-Sat 7 AM IST) + host Developer lookup on Render or Railway |
| RENDER_DEPLOY_CHECKLIST.md | Step-by-step Render deploy (env vars, Docker, instance type, health check) |
Recent Optimizations
This codebase has been optimized for maintainability, performance, and reliability:
Code Quality
- Eliminated ~140+ lines of duplicate code across multiple modules
- Created
utils/jira_helpers.py- Shared story points parsing logic, eliminating circular imports - Consolidated board caching - Single
_board_cachestructure replacing 3 separate caches - Refactored report generation - Extracted
_generate_reports_internal()helper to eliminate ~100 lines of duplication between HTTP and CLI modes
Configuration & Deployment
- Centralized configuration - Matplotlib setup in
config.py, violation labels inteam_config.py - Enhanced deployment validation -
deploy.shnow validates all required environment variables (GCP, Jira, Teams, LLM) with color-coded output - Dependency pinning - Pinned
markdown==3.7.0to prevent version mismatch issues
Error Handling & Monitoring
- Specific exception types - Added
JIRAErrorandRequestExceptionhandling across 7+ files - Performance logging - Sprint lookup fallback now logs timing (e.g., "50 queries in 3.25s")
- Better error visibility - Successful lookups promoted from DEBUG to INFO level
API Upgrades
- Confluence REST API v2 - Upgraded from v1 with automatic space key → space ID conversion
- Table width fix - Confluence tables properly formatted with div wrappers and inline styles
License
Internal use. Adjust team_config.py and .env for your org.