Skip to content

Commit 32500e0

Browse files
authored
build: add axion-release, Spotless, GHCR publish workflow (#17)
1 parent 9128265 commit 32500e0

6 files changed

Lines changed: 274 additions & 129 deletions

File tree

.git-blame-ignore-revs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Commits listed here are skipped by `git blame`.
2+
# Locally, run: git config blame.ignoreRevsFile .git-blame-ignore-revs
3+
# GitHub honors this file automatically.
4+
5+
# Add the SHA of the one-shot Spotless reformat commit here once it lands:
6+
# <reformat-commit-sha> style: apply Google Java Format via Spotless

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
release:
14+
name: Build and publish Docker image
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v6
19+
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v5
22+
with:
23+
java-version: '17'
24+
distribution: 'temurin'
25+
26+
- name: Setup Gradle
27+
uses: gradle/actions/setup-gradle@v6
28+
29+
- name: Build (Spotless + Spotbugs + tests)
30+
run: ./gradlew build -x integrationTest
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
- name: Log in to GHCR
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Compute image tags
46+
id: meta
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: ghcr.io/${{ github.repository_owner }}/ugroup
50+
tags: |
51+
type=semver,pattern={{version}}
52+
type=semver,pattern={{major}}.{{minor}}
53+
type=semver,pattern={{major}}
54+
type=raw,value=latest
55+
56+
- name: Build and push image
57+
uses: docker/build-push-action@v6
58+
with:
59+
context: .
60+
file: docker/Dockerfile
61+
platforms: linux/amd64,linux/arm64
62+
push: true
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}
65+
66+
- name: Create GitHub Release
67+
uses: softprops/action-gh-release@v2
68+
with:
69+
generate_release_notes: true
70+
files: build/libs/*-boot.jar

CONTRIBUTING.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Thank you for your interest in contributing to uGroup! This document explains ho
1919

2020
- **Tests required**: All new functionality must include automated tests. Bug fixes should include a test that reproduces the issue.
2121
- **Build must pass**: Run `./gradlew build` before submitting. This runs unit tests, integration tests, static analysis, and coverage checks.
22+
- **Formatting**: Run `./gradlew spotlessApply` before submitting. CI runs `spotlessCheck` as part of `build` and will fail on unformatted code.
2223
- **Code coverage**: The project enforces a minimum coverage threshold via JaCoCo. New code should maintain or improve coverage.
2324
- **No broken windows**: Fix any static analysis warnings introduced by your changes.
2425

@@ -33,6 +34,15 @@ Thank you for your interest in contributing to uGroup! This document explains ho
3334

3435
# Run integration tests (requires Docker)
3536
./gradlew integrationTest
37+
38+
# Apply Google Java Format
39+
./gradlew spotlessApply
40+
```
41+
42+
The repo includes a `.git-blame-ignore-revs` file that hides the one-shot Spotless reformat commit from `git blame`. GitHub honors it automatically; for local `git blame`, run once:
43+
44+
```bash
45+
git config blame.ignoreRevsFile .git-blame-ignore-revs
3646
```
3747

3848
## Reporting Issues
@@ -46,14 +56,15 @@ Use [GitHub Issues](https://github.com/uber/uGroup/issues) to report bugs or req
4656

4757
All pull requests require approval from at least one of the following code reviewers before merging:
4858

49-
| Reviewer | Email | Coverage Area |
50-
|----------|-------|---------------|
51-
| Qichao Chu | qichao@uber.com | All areas |
52-
| Si Lao | sil@uber.com | All areas |
59+
| Reviewer | GitHub | Coverage Area |
60+
|----------|--------|---------------|
61+
| Qichao Chu | [@ex172000](https://github.com/ex172000) | All areas |
62+
| Si Lao | [@laosiaudi](https://github.com/laosiaudi) | All areas |
63+
| Yulan Feng | [@yfeng21](https://github.com/yfeng21) | All areas |
5364

5465
**Review process:**
5566
- Every PR must be reviewed and approved by at least one of the engineers listed above.
56-
- For critical changes (security fixes, breaking changes, or core processing logic), approval from both reviewers is recommended.
67+
- For critical changes (security fixes, breaking changes, or core processing logic), approval from two reviewers is recommended.
5768
- Reviewers should be assigned via GitHub's reviewer request feature when opening a PR.
5869
- Reviews should focus on correctness, test coverage, performance implications, and adherence to project conventions.
5970

README.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ uGroup monitors Kafka consumer groups by reading the `__consumer_offsets` topic
1818

1919
```bash
2020
cd docker
21-
docker-compose up -d
21+
docker compose up -d
2222
```
2323

24-
This starts Kafka, Zookeeper, and uGroup. Access the API at `http://localhost:8080`.
24+
This starts Kafka, Zookeeper, and uGroup. Point uGroup at any consumer group running against the same broker and lag will appear at `http://localhost:8080`.
2525

2626
### Using Gradle
2727

@@ -33,6 +33,58 @@ This starts Kafka, Zookeeper, and uGroup. Access the API at `http://localhost:80
3333
KAFKA_BOOTSTRAP_SERVERS=localhost:9092 ./gradlew bootRun
3434
```
3535

36+
## Usage
37+
38+
### Query lag via REST
39+
40+
```bash
41+
# Lag for every topic a group consumes
42+
curl http://localhost:8080/api/v1/lag/my-consumer-group
43+
44+
# Lag for one group/topic pair
45+
curl http://localhost:8080/api/v1/lag/my-consumer-group/events-topic
46+
47+
# Liveness / status
48+
curl http://localhost:8080/api/v1/status
49+
```
50+
51+
### Scrape lag with Prometheus
52+
53+
uGroup exposes metrics at `/actuator/prometheus`. Example PromQL for the worst-lagging group in each cluster:
54+
55+
```promql
56+
max by (cluster, group) (ugroup_consumer_lag)
57+
```
58+
59+
See the [Metrics wiki page](https://github.com/uber/uGroup/wiki/Metrics) for the full metric and label reference.
60+
61+
## Common scenarios
62+
63+
uGroup decides which groups to monitor via `UGROUP_WATCHLIST_MODE`. Pick the mode that fits your use case and see the linked wiki page for the YAML/regex details.
64+
65+
**Monitor every consumer group in the cluster** — zero config, useful for ops dashboards:
66+
67+
```bash
68+
UGROUP_WATCHLIST_MODE=all ./gradlew bootRun
69+
```
70+
71+
**Monitor a curated list** — declare the exact groups + topics you care about in a YAML file (see [`watchlist-sample.yaml`](src/main/resources/watchlist-sample.yaml) and the [Watchlist wiki page](https://github.com/uber/uGroup/wiki/Watchlist-Configuration)):
72+
73+
```bash
74+
UGROUP_WATCHLIST_MODE=static UGROUP_WATCHLIST_FILE=/etc/ugroup/watchlist.yaml ./gradlew bootRun
75+
```
76+
77+
**Monitor by regex with a blocklist** — useful when group names follow a naming convention but a few should be excluded (see the [Blocklist wiki page](https://github.com/uber/uGroup/wiki/Blocklist-Configuration)):
78+
79+
```bash
80+
UGROUP_WATCHLIST_MODE=regex \
81+
UGROUP_INCLUDE_PATTERNS='prod-.*' \
82+
UGROUP_BLOCKLIST_FILE=/etc/ugroup/blocklist.yaml \
83+
./gradlew bootRun
84+
```
85+
86+
For the full list of environment variables and their defaults, see the [Configuration wiki page](https://github.com/uber/uGroup/wiki/Configuration).
87+
3688
## Documentation
3789

3890
Full documentation is available on the [Wiki](https://github.com/uber/uGroup/wiki):

0 commit comments

Comments
 (0)