Skip to content

Commit 1b99ee3

Browse files
authored
feat: Update documentation and golang dependencies (#146)
Signed-off-by: flacatus <flacatus@redhat.com>
1 parent ac1d070 commit 1b99ee3

5 files changed

Lines changed: 254 additions & 871 deletions

File tree

README.md

Lines changed: 125 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,173 @@
11
# DORA Metrics Server
22

3-
A professional Go Fiber server with a clean, minimal API focused on health monitoring.
3+
Automated collection and forwarding of DORA metrics data from ArgoCD deployments and WebRCA incidents to [Apache DevLake](https://devlake.apache.org/). Enables engineering teams to measure software delivery performance through the four key DORA metrics without manual data entry.
4+
5+
## Overview
6+
7+
```text
8+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
9+
│ ArgoCD │ │ DORA Metrics │ │ Apache DevLake │
10+
│ Deployments │────▶│ Server │────▶│ Dashboards │
11+
└─────────────────┘ └────────┬────────┘ └─────────────────┘
12+
13+
┌─────────────────┐ │
14+
│ WebRCA │──────────────┘
15+
│ Incidents │
16+
└─────────────────┘
17+
```
418

5-
## Features
19+
This server watches ArgoCD applications for deployment events, collects incident data from WebRCA, and forwards everything to DevLake via webhooks. DevLake then calculates and visualizes DORA metrics in Grafana dashboards.
620

7-
- 🚀 Built with [Go Fiber](https://gofiber.io/) - Fast HTTP framework
8-
- 🏥 Health check endpoint
9-
- 🔍 WebRCA incident monitoring (checks OpenShift WebRCA API every 30 minutes)
10-
- 🔧 Environment-based configuration
11-
- 📝 Structured logging
12-
- 🌐 CORS support
13-
- 🛡️ Error handling middleware
14-
- 📁 Standard Go project layout
21+
## What are DORA Metrics?
1522

16-
## Quick Start
23+
[DORA](https://dora.dev/) (DevOps Research and Assessment) metrics are industry-standard indicators for measuring software delivery performance:
1724

18-
### Prerequisites
25+
| Metric | What It Measures | Data Source |
26+
|--------|------------------|-------------|
27+
| **Deployment Frequency** | How often you deploy to production | ArgoCD deployments |
28+
| **Lead Time for Changes** | Time from commit to production | Commit timestamps → Deployment time |
29+
| **Change Failure Rate** | Percentage of failed deployments | ArgoCD sync failures |
30+
| **Mean Time to Recovery** | Time to recover from incidents | WebRCA incidents |
1931

20-
- Go 1.21 or higher
21-
- Git
32+
Learn more in [Apache DevLake's DORA documentation](https://devlake.apache.org/docs/DORA/).
2233

23-
### Installation
34+
## How It Works
2435

25-
1. Clone the repository:
26-
```bash
27-
git clone <repository-url>
28-
cd dora-metrics
29-
```
36+
### ArgoCD Integration
3037

31-
2. Install dependencies:
32-
```bash
33-
go mod tidy
34-
```
38+
The server monitors ArgoCD applications across configured namespaces and:
3539

36-
3. Copy environment file:
37-
```bash
38-
cp .env.example .env
39-
```
40+
1. **Detects deployments** when applications sync to new revisions
41+
2. **Extracts commit information** from container images with SHA-based tags
42+
3. **Retrieves commit metadata** from GitHub (author, message, timestamp)
43+
4. **Sends deployment events** to DevLake with full commit history
4044

41-
4. Run the server:
42-
```bash
43-
go run .
44-
```
45+
### WebRCA Integration
4546

46-
The server will start on `http://localhost:3000` by default.
47+
For incident tracking, the server:
4748

48-
## API Endpoints
49+
1. **Polls WebRCA API** at configured intervals
50+
2. **Collects incident data** including creation time and resolution
51+
3. **Forwards incidents** to DevLake for MTTR calculation
4952

50-
### Health Check
51-
```http
52-
GET /api/v1/health
53-
```
53+
### Team Routing
5454

55-
Returns server health status, uptime, and version information.
55+
Deployments can be routed to multiple DevLake projects:
5656

57-
### Root
58-
```http
59-
GET /
60-
```
57+
- **Global Project**: Receives all deployments for organization-wide visibility
58+
- **Team Projects**: Receive only deployments for specific components
6159

62-
Returns basic server information and available endpoints.
60+
This enables both executive dashboards and team-specific metrics views.
6361

64-
## Configuration
62+
## Quick Start
6563

66-
The server can be configured using a YAML file (`configs/config.yaml`) with environment variable overrides:
64+
### Prerequisites
6765

68-
### YAML Configuration
66+
- Go 1.21+
67+
- Redis (for deployment deduplication)
68+
- Access to ArgoCD cluster (for deployment monitoring)
69+
- DevLake instance with webhook configured
6970

70-
Create `configs/config.yaml`:
71+
### Running Locally
7172

72-
```yaml
73-
server:
74-
port: "3000"
75-
environment: "development"
76-
log_level: "info"
73+
```bash
74+
# Clone and install dependencies
75+
git clone <repository-url>
76+
cd dora-metrics
77+
go mod tidy
7778

78-
webrca:
79-
enabled: true
80-
api_url: "https://api.openshift.com/api/web-rca/v1/incidents"
81-
interval: "30m"
82-
# OCM token should be set via environment variable OCM_TOKEN for security
79+
# Set required environment variables
80+
export OFFLINE_TOKEN="your_ocm_offline_token"
81+
export DEVLAKE_WEBHOOK_TOKEN="your_devlake_token"
82+
83+
# Run the server
84+
go run cmd/server/main.go
8385
```
8486

85-
### Environment Variables
87+
### Deploying to Kubernetes
8688

87-
Environment variables override YAML settings:
89+
Kubernetes manifests are provided in `manifests/`:
8890

89-
| Variable | Default | Description |
90-
|----------|---------|-------------|
91-
| `PORT` | `3000` | Server port |
92-
| `ENVIRONMENT` | `development` | Environment (development/production) |
93-
| `LOG_LEVEL` | `info` | Log level |
94-
| `WEBRCA_ENABLED` | `true` | Enable WebRCA incident checking |
95-
| `WEBRCA_API_URL` | `https://api.openshift.com/api/web-rca/v1/incidents` | WebRCA API URL |
96-
| `WEBRCA_INTERVAL` | `30m` | WebRCA check interval |
97-
| `OCM_TOKEN` | `` | OCM token for WebRCA API authentication |
91+
```bash
92+
# For production
93+
kubectl apply -k manifests/production/
9894

99-
## Project Structure
95+
# For local/staging
96+
kubectl apply -k manifests/local/
97+
```
10098

101-
Following the [Go Standard Project Layout](https://github.com/golang-standards/project-layout):
99+
## Configuration
102100

103-
```
104-
.
105-
├── cmd/
106-
│ └── server/
107-
│ └── main.go # Application entry point
108-
├── internal/
109-
│ ├── config/
110-
│ │ └── config.go # Configuration management
111-
│ ├── handlers/
112-
│ │ └── handlers.go # HTTP handlers and routes
113-
│ └── server/
114-
│ └── server.go # Server setup and configuration
115-
├── configs/
116-
│ └── config.yaml # Application configuration
117-
├── go.mod # Go module definition
118-
├── Dockerfile # Docker configuration
119-
└── README.md # This file
120-
```
101+
Configuration is managed via YAML files with environment variable overrides.
121102

122-
## Development
103+
### Key Configuration Areas
123104

124-
### Running in Development
105+
| Area | Description |
106+
|------|-------------|
107+
| **ArgoCD** | Namespaces to watch, components to ignore, known clusters |
108+
| **WebRCA** | API endpoint, polling interval |
109+
| **DevLake** | Base URL, project IDs, team routing |
110+
| **Redis** | Connection settings for deployment caching |
125111

126-
```bash
127-
# Set your offline token
128-
export OFFLINE_TOKEN="your_offline_token_here"
112+
### Environment Variables
129113

130-
# Run the application
131-
go run cmd/server/main.go
114+
| Variable | Required | Description |
115+
|----------|----------|-------------|
116+
| `OFFLINE_TOKEN` | Yes | Red Hat OCM offline token for WebRCA API |
117+
| `DEVLAKE_WEBHOOK_TOKEN` | Yes | Authentication token for DevLake webhooks |
118+
| `REDIS_HOST` | No | Redis host (default: from config) |
119+
| `REDIS_PASSWORD` | No | Redis password |
120+
121+
### Example Configuration
122+
123+
```yaml
124+
argocd:
125+
enabled: true
126+
namespaces:
127+
- konflux-public-production
128+
components_to_ignore:
129+
- monitoring
130+
- openshift-gitops
131+
132+
integration:
133+
devlake:
134+
enabled: true
135+
base_url: "https://devlake.example.com"
136+
project_id: "1" # Global project
137+
teams:
138+
- name: "my-team"
139+
project_id: "2"
140+
argocd_components:
141+
- my-service
142+
- my-api
132143
```
133144
134-
### Building
145+
## Documentation
135146
136-
```bash
137-
# Build the application
138-
go build -o bin/dora-metrics cmd/server/main.go
147+
| Document | Description |
148+
|----------|-------------|
149+
| [Configuration Guide](docs/configuration-sop.md) | Comprehensive configuration reference |
150+
| [Deployment Guide](docs/deployment-guide.md) | Kubernetes deployment instructions |
151+
| [Architecture](docs/architecture.md) | System design and data flow diagrams |
139152
140-
# Run the binary
141-
./bin/dora-metrics
142-
```
153+
## API Endpoints
143154
144-
### Running Tests
155+
| Endpoint | Description |
156+
|----------|-------------|
157+
| `GET /` | Server info and available endpoints |
158+
| `GET /api/v1/health` | Health check with uptime and version |
159+
160+
## Development
145161

146162
```bash
163+
# Run tests
147164
go test ./...
148-
```
149-
150-
## Docker Support
151165
152-
To run with Docker:
166+
# Build binary
167+
go build -o bin/dora-metrics cmd/server/main.go
153168
154-
```bash
155-
# Build the image
169+
# Build Docker image
156170
docker build -t dora-metrics .
157-
158-
# Run the container
159-
docker run -p 3000:3000 dora-metrics
160171
```
161172

162173
## Contributing
@@ -169,4 +180,4 @@ docker run -p 3000:3000 dora-metrics
169180

170181
## License
171182

172-
This project is licensed under the MIT License - see the LICENSE file for details.
183+
This project is licensed under the MIT License - see the LICENSE file for details.

docs/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ This directory contains comprehensive documentation for the DORA Metrics system
1111
| [**Architecture**](architecture.md) | Complete system architecture and design | Components, data flow, DORA metrics, configuration |
1212
| [**Data Flow**](data-flow.md) | Detailed data flow diagrams and processes | Event processing, commit handling, DevLake integration |
1313
| [**Deployment Guide**](deployment-guide.md) | Step-by-step deployment instructions | Kubernetes manifests, configuration, monitoring |
14-
| [**Configuration SOP**](configuration-sop.md) | Comprehensive configuration guide | All configuration options, team setup, troubleshooting |
1514

1615
## 🏗️ System Architecture
1716

0 commit comments

Comments
 (0)